mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Coral 2.12.0
This commit is contained in:
parent
859ecea027
commit
8c911d5bca
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"require_version": [],
|
||||
"coral": {
|
||||
"znca_version": "2.7.0"
|
||||
"znca_version": "2.12.0"
|
||||
},
|
||||
"coral_auth": {
|
||||
"default": [
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const debug = createDebug('nxapi:api:coral');
|
|||
|
||||
const ZNCA_PLATFORM = 'Android';
|
||||
const ZNCA_PLATFORM_VERSION = '8.0.0';
|
||||
const ZNCA_VERSION = '2.2.0';
|
||||
export const ZNCA_VERSION = '2.12.0';
|
||||
const ZNCA_USER_AGENT = `com.nintendo.znca/${ZNCA_VERSION}(${ZNCA_PLATFORM}/${ZNCA_PLATFORM_VERSION})`;
|
||||
|
||||
const ZNC_URL = 'https://api-lp1.znc.srv.nintendo.net';
|
||||
|
|
@ -295,7 +295,14 @@ export default class CoralApi implements CoralApiInterface {
|
|||
};
|
||||
|
||||
try {
|
||||
return await this.call<WebServiceToken>('/v2/Game/GetWebServiceToken', req, false);
|
||||
const uuid = randomUUID();
|
||||
|
||||
return this.fetch<WebServiceToken>('/v2/Game/GetWebServiceToken', 'POST', JSON.stringify({
|
||||
parameter: req,
|
||||
requestId: uuid,
|
||||
}), {
|
||||
'X-IntegrityTokenError': 'NETWORK_ERROR',
|
||||
}, false);
|
||||
} catch (err) {
|
||||
if (err instanceof CoralErrorResponse && err.status === CoralStatus.TOKEN_EXPIRED && !_attempt && this.onTokenExpired) {
|
||||
debug('Error getting web service token, renewing token before retrying', err);
|
||||
|
|
@ -336,7 +343,14 @@ export default class CoralApi implements CoralApiInterface {
|
|||
naIdToken: nintendoAccountToken.id_token,
|
||||
};
|
||||
|
||||
const data = await this.call<AccountToken>('/v3/Account/GetToken', req, false);
|
||||
const uuid = randomUUID();
|
||||
|
||||
const data = await this.fetch<AccountToken>('/v3/Account/GetToken', 'POST', JSON.stringify({
|
||||
parameter: req,
|
||||
requestId: uuid,
|
||||
}), {
|
||||
'X-IntegrityTokenError': 'NETWORK_ERROR',
|
||||
}, false);
|
||||
|
||||
return {
|
||||
nintendoAccountToken,
|
||||
|
|
@ -438,6 +452,7 @@ export default class CoralApi implements CoralApiInterface {
|
|||
headers: {
|
||||
'X-Platform': ZNCA_PLATFORM,
|
||||
'X-ProductVersion': config.znca_version,
|
||||
'X-IntegrityTokenError': 'NETWORK_ERROR',
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'User-Agent': znca_useragent,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { defineResponse, ErrorResponse } from './util.js';
|
|||
import createDebug from '../util/debug.js';
|
||||
import { timeoutSignal } from '../util/misc.js';
|
||||
import { getUserAgent } from '../util/useragent.js';
|
||||
import { ZNCA_VERSION } from './coral.js';
|
||||
|
||||
const debugFlapg = createDebug('nxapi:api:flapg');
|
||||
const debugImink = createDebug('nxapi:api:imink');
|
||||
|
|
@ -219,6 +220,7 @@ export async function genf(
|
|||
});
|
||||
if (app?.platform) headers.append('X-znca-Platform', app.platform);
|
||||
if (app?.version) headers.append('X-znca-Version', app.version);
|
||||
if (ZNCA_VERSION) headers.append('X-znca-Client-Version', ZNCA_VERSION);
|
||||
|
||||
const [signal, cancel] = timeoutSignal();
|
||||
const response = await fetch(url, {
|
||||
|
|
@ -271,16 +273,17 @@ export class ZncaApiNxapi extends ZncaApi {
|
|||
}
|
||||
|
||||
async genf(token: string, hash_method: HashMethod, user?: {na_id: string; coral_user_id?: string}) {
|
||||
const request_id = randomUUID();
|
||||
// const request_id = randomUUID();
|
||||
|
||||
const result = await genf(this.url + '/f', hash_method, token, undefined, request_id,
|
||||
const result = await genf(this.url + '/f', hash_method, token, undefined, undefined,
|
||||
user, this.app, this.useragent);
|
||||
|
||||
return {
|
||||
provider: 'nxapi' as const,
|
||||
url: this.url + '/f',
|
||||
hash_method, token, request_id,
|
||||
hash_method, token,
|
||||
timestamp: result.timestamp!, // will be included as not sent in request
|
||||
request_id: result.request_id!,
|
||||
f: result.f,
|
||||
user,
|
||||
result,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user