chore: update Id -> ID

This commit is contained in:
Jonathan Barrow
2024-04-14 19:19:37 -04:00
parent cb10a16668
commit 6d3f516612
4 changed files with 20 additions and 20 deletions

View File

@@ -14,14 +14,14 @@ function nintendoClientHeaderCheck(request: express.Request, response: express.R
response.set('Server', 'Nintendo 3DS (http)');
response.set('X-Nintendo-Date', new Date().getTime().toString());
const clientId = getValueFromHeaders(request.headers, 'x-nintendo-client-id');
const clientID = getValueFromHeaders(request.headers, 'x-nintendo-client-id');
const clientSecret = getValueFromHeaders(request.headers, 'x-nintendo-client-secret');
if (
!clientId ||
!clientID ||
!clientSecret ||
!VALID_CLIENT_ID_SECRET_PAIRS[clientId] ||
clientSecret !== VALID_CLIENT_ID_SECRET_PAIRS[clientId]
!VALID_CLIENT_ID_SECRET_PAIRS[clientID] ||
clientSecret !== VALID_CLIENT_ID_SECRET_PAIRS[clientID]
) {
response.send(xmlbuilder.create({
errors: {

View File

@@ -77,7 +77,7 @@ class NintendoCertificate {
issuer: string;
keyType: number;
certificateName: string;
ngKeyId: number;
ngKeyID: number;
publicKey: Buffer;
valid: boolean;
publicKeyData: Buffer;
@@ -91,7 +91,7 @@ class NintendoCertificate {
this.issuer = '';
this.keyType = 0;
this.certificateName = '';
this.ngKeyId = 0;
this.ngKeyID = 0;
this.publicKey = Buffer.alloc(0);
this.valid = false;
this.publicKeyData = Buffer.alloc(0);
@@ -128,7 +128,7 @@ class NintendoCertificate {
this.issuer = this._certificate.subarray(0x80, 0xC0).toString().split('\0')[0];
this.keyType = this._certificate.readUInt32BE(0xC0);
this.certificateName = this._certificate.subarray(0xC4, 0x104).toString().split('\0')[0];
this.ngKeyId = this._certificate.readUInt32BE(0x104);
this.ngKeyID = this._certificate.readUInt32BE(0x104);
this.publicKeyData = this._certificate.subarray(0x108);
if (this.issuer === 'Root-CA00000003-MS00000012') {

View File

@@ -52,13 +52,13 @@ app.use(assets);
LOG_INFO('Creating 404 status handler');
app.use((request: express.Request, response: express.Response): void => {
const url = fullUrl(request);
let deviceId = getValueFromHeaders(request.headers, 'X-Nintendo-Device-ID');
let deviceID = getValueFromHeaders(request.headers, 'X-Nintendo-Device-ID');
if (!deviceId) {
deviceId = 'Unknown';
if (!deviceID) {
deviceID = 'Unknown';
}
LOG_WARN(`HTTP 404 at ${url} from ${deviceId}`);
LOG_WARN(`HTTP 404 at ${url} from ${deviceID}`);
response.set('Content-Type', 'text/xml');
response.set('Server', 'Nintendo 3DS (http)');
@@ -80,13 +80,13 @@ LOG_INFO('Creating non-404 status handler');
app.use((error: any, request: express.Request, response: express.Response, _next: express.NextFunction): void => {
const status = error.status || 500;
const url = fullUrl(request);
let deviceId = getValueFromHeaders(request.headers, 'X-Nintendo-Device-ID');
let deviceID = getValueFromHeaders(request.headers, 'X-Nintendo-Device-ID');
if (!deviceId) {
deviceId = 'Unknown';
if (!deviceID) {
deviceID = 'Unknown';
}
LOG_WARN(`HTTP ${status} at ${url} from ${deviceId}: ${error.message}`);
LOG_WARN(`HTTP ${status} at ${url} from ${deviceID}: ${error.message}`);
response.status(status).json({
app: 'api',

View File

@@ -321,14 +321,14 @@ router.get('/@me/devices', async (request: express.Request, response: express.Re
response.set('X-Nintendo-Date', new Date().getTime().toString());
const pnid = request.pnid;
const deviceId = getValueFromHeaders(request.headers, 'x-nintendo-device-id');
const deviceID = getValueFromHeaders(request.headers, 'x-nintendo-device-id');
const acceptLanguage = getValueFromHeaders(request.headers, 'accept-language');
const platformId = getValueFromHeaders(request.headers, 'x-nintendo-platform-id');
const platformID = getValueFromHeaders(request.headers, 'x-nintendo-platform-id');
const region = getValueFromHeaders(request.headers, 'x-nintendo-region');
const serialNumber = getValueFromHeaders(request.headers, 'x-nintendo-serial-number');
const systemVersion = getValueFromHeaders(request.headers, 'x-nintendo-system-version');
if (!deviceId || !acceptLanguage || !platformId || !region || !serialNumber || !systemVersion) {
if (!deviceID || !acceptLanguage || !platformID || !region || !serialNumber || !systemVersion) {
// TODO - Research these error more
response.status(400).send(xmlbuilder.create({
errors: {
@@ -362,11 +362,11 @@ router.get('/@me/devices', async (request: express.Request, response: express.Re
devices: [
{
device: {
device_id: deviceId,
device_id: deviceID,
language: acceptLanguage,
updated: moment().format('YYYY-MM-DDTHH:MM:SS'),
pid: pnid.pid,
platform_id: platformId,
platform_id: platformID,
region: region,
serial_number: serialNumber,
status: 'ACTIVE',