mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-04-26 00:13:08 -05:00
Send client compatibility version to remote config API
This commit is contained in:
parent
57ce3c21de
commit
e00a0a6e3b
|
|
@ -10,7 +10,7 @@ const debug = createDebug('nxapi:api:moon');
|
||||||
const MOON_URL = 'https://api-lp1.pctl.srv.nintendo.net/moon';
|
const MOON_URL = 'https://api-lp1.pctl.srv.nintendo.net/moon';
|
||||||
export const ZNMA_CLIENT_ID = '54789befb391a838';
|
export const ZNMA_CLIENT_ID = '54789befb391a838';
|
||||||
|
|
||||||
const ZNMA_VERSION = '1.17.0';
|
export const ZNMA_VERSION = '1.17.0';
|
||||||
const ZNMA_BUILD = '261';
|
const ZNMA_BUILD = '261';
|
||||||
const ZNMA_USER_AGENT = 'moon_ANDROID/' + ZNMA_VERSION + ' (com.nintendo.znma; build:' + ZNMA_BUILD +
|
const ZNMA_USER_AGENT = 'moon_ANDROID/' + ZNMA_VERSION + ' (com.nintendo.znma; build:' + ZNMA_BUILD +
|
||||||
'; ANDROID 26)';
|
'; ANDROID 26)';
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import * as path from 'node:path';
|
||||||
import * as fs from 'node:fs/promises';
|
import * as fs from 'node:fs/promises';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { fetch } from 'undici';
|
import { fetch } from 'undici';
|
||||||
|
import { ZNCA_VERSION } from '../api/coral.js';
|
||||||
|
import { ZNMA_VERSION } from '../api/moon.js';
|
||||||
import { ErrorResponse, ResponseSymbol } from '../api/util.js';
|
import { ErrorResponse, ResponseSymbol } from '../api/util.js';
|
||||||
import createDebug from '../util/debug.js';
|
import createDebug from '../util/debug.js';
|
||||||
import { timeoutSignal } from '../util/misc.js';
|
import { timeoutSignal } from '../util/misc.js';
|
||||||
|
|
@ -53,6 +55,10 @@ async function loadRemoteConfig() {
|
||||||
expires_at: Date.now(),
|
expires_at: Date.now(),
|
||||||
version,
|
version,
|
||||||
revision: git?.revision ?? null,
|
revision: git?.revision ?? null,
|
||||||
|
compatible_versions: {
|
||||||
|
znca: ZNCA_VERSION,
|
||||||
|
znma: ZNMA_VERSION,
|
||||||
|
},
|
||||||
url: url_parsed.toString(),
|
url: url_parsed.toString(),
|
||||||
headers: {},
|
headers: {},
|
||||||
data: config,
|
data: config,
|
||||||
|
|
@ -122,6 +128,10 @@ async function loadRemoteConfig() {
|
||||||
expires_at,
|
expires_at,
|
||||||
version,
|
version,
|
||||||
revision: git?.revision ?? null,
|
revision: git?.revision ?? null,
|
||||||
|
compatible_versions: {
|
||||||
|
znca: ZNCA_VERSION,
|
||||||
|
znma: ZNMA_VERSION,
|
||||||
|
},
|
||||||
url: response.url,
|
url: response.url,
|
||||||
headers: Object.fromEntries(response.headers.entries()),
|
headers: Object.fromEntries(response.headers.entries()),
|
||||||
data: config,
|
data: config,
|
||||||
|
|
@ -147,6 +157,8 @@ async function getRemoteConfig(url: string, useragent?: string, cache?: {
|
||||||
'User-Agent': getUserAgent(),
|
'User-Agent': getUserAgent(),
|
||||||
'X-nxapi-Version': version,
|
'X-nxapi-Version': version,
|
||||||
'X-nxapi-Revision': git?.revision ?? undefined!,
|
'X-nxapi-Revision': git?.revision ?? undefined!,
|
||||||
|
'X-znca-Compatible-Version': ZNCA_VERSION,
|
||||||
|
'X-znma-Compatible-Version': ZNMA_VERSION,
|
||||||
'If-Modified-Since': cache ? cache.updated_at.toUTCString() : undefined!,
|
'If-Modified-Since': cache ? cache.updated_at.toUTCString() : undefined!,
|
||||||
'If-None-Match': cache?.etag ?? undefined!,
|
'If-None-Match': cache?.etag ?? undefined!,
|
||||||
},
|
},
|
||||||
|
|
@ -239,6 +251,7 @@ export interface RemoteConfigCacheData {
|
||||||
expires_at: number;
|
expires_at: number;
|
||||||
version: string;
|
version: string;
|
||||||
revision: string | null;
|
revision: string | null;
|
||||||
|
compatible_versions?: Partial<Record<'znca' | 'znma', string>>;
|
||||||
url: string;
|
url: string;
|
||||||
headers: Record<string, string> | Record<string, string[]>;
|
headers: Record<string, string> | Record<string, string[]>;
|
||||||
data: NxapiRemoteConfig;
|
data: NxapiRemoteConfig;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user