Update NookLink

This commit is contained in:
Samuel Elliott 2022-08-16 18:41:45 +01:00
parent 0d54381c6d
commit 7423da8d98
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
4 changed files with 18 additions and 4 deletions

View File

@ -12,5 +12,8 @@
"moon": {
"znma_version": "1.17.0",
"znma_build": "261"
},
"coral_gws_nooklink": {
"blanco_version": "2.1.1"
}
}

View File

@ -14,7 +14,7 @@ export const NOOKLINK_WEBSERVICE_URL = 'https://web.sd.lp1.acbaa.srv.nintendo.ne
export const NOOKLINK_WEBSERVICE_USERAGENT = 'Mozilla/5.0 (Linux; Android 8.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/58.0.3029.125 Mobile Safari/537.36';
const NOOKLINK_URL = NOOKLINK_WEBSERVICE_URL + '/api';
const BLANCO_VERSION = '2.1.0';
const BLANCO_VERSION = '2.1.1';
export default class NooklinkApi {
protected constructor(
@ -34,7 +34,6 @@ export default class NooklinkApi {
'dnt': '1',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-GB,en-US;q=0.8',
'X-Requested-With': 'com.nintendo.znca',
'Origin': 'https://web.sd.lp1.acbaa.srv.nintendo.net',
'Content-Type': 'application/json',
'X-Blanco-Version': this.client_version,
@ -90,6 +89,9 @@ export default class NooklinkApi {
static async loginWithWebServiceToken(
webserviceToken: WebServiceToken, user: NintendoAccountUser
): Promise<NooklinkAuthData> {
const { default: { coral_gws_nooklink: config } } = await import('../common/remote-config.js');
if (!config) throw new Error('Remote configuration prevents NookLink authentication');
const url = new URL(NOOKLINK_WEBSERVICE_URL);
url.search = new URLSearchParams({
lang: user.language,
@ -144,7 +146,7 @@ export default class NooklinkApi {
gtoken,
expires_at,
useragent: NOOKLINK_WEBSERVICE_USERAGENT,
version: BLANCO_VERSION,
version: config.blanco_version,
};
}
}
@ -270,7 +272,7 @@ export class NooklinkUserApi {
static createWithCliTokenData(data: NooklinkUserCliTokenData) {
return new NooklinkUserApi(
data.user_id, data.auth_token,
data.gtoken, NOOKLINK_WEBSERVICE_USERAGENT, data.language, BLANCO_VERSION
data.gtoken, NOOKLINK_WEBSERVICE_USERAGENT, data.language, data.version
);
}
}
@ -299,6 +301,7 @@ export interface NooklinkUserAuthData {
export interface NooklinkUserCliTokenData {
gtoken: string;
version: string;
auth_token: string;
expires_at: number;

View File

@ -42,6 +42,8 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
if (argv.json || argv.jsonPrettyPrint) {
const result: NooklinkUserCliTokenData = {
gtoken: nooklinkuser.gtoken,
version: nooklinkuser.client_version,
auth_token: data.token.token,
expires_at: data.token.expireAt,
user_id: data.user_id,

View File

@ -233,6 +233,8 @@ export interface NxapiRemoteConfig {
imink: {} | null;
};
moon: MoonRemoteConfig | null;
coral_gws_nooklink: NooklinkRemoteConfig | null;
}
export type DefaultZncaApiProvider =
@ -248,3 +250,7 @@ export interface MoonRemoteConfig {
znma_version: string;
znma_build: string;
}
export interface NooklinkRemoteConfig {
blanco_version: string;
}