Get updated queries from remote configuration

This commit is contained in:
Samuel Elliott 2022-12-17 13:44:51 +00:00
parent b9f9fd7f4a
commit 7035fb6b19
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
4 changed files with 9 additions and 2 deletions

View File

@ -231,6 +231,8 @@ Environment variable | Description
`NXAPI_REMOTE_CONFIG_FALLBACK` | Allows using local configuration data if the remote configuration data cannot be fetched if set to `1`. This should not be used, as it can cause nxapi to revert to local configuration data after previously using newer remote configuration data.
`NXAPI_CONFIG_URL` | Sets the URL to fetch remote configuration data from.
`NXAPI_SKIP_UPDATE_CHECK` | Disables the update check in the nxapi command and the Electron app if set to `1`.
`NXAPI_SPLATNET3_UPGRADE_QUERIES` | Sets when the SplatNet 3 client is allowed to upgrade persisted query IDs to newer versions. If `0` queries are never upgraded (not recommended). If `1` queries are upgraded if they do not contain potentially breaking changes (not recommended, as like `0` this allows older queries to be sent to the API). If `2` queries are upgraded, requests that would include breaking changes are rejected. If `3` all queries are upgraded, even if they contain potentially breaking changes (default).
`NXAPI_SPLATNET3_STRICT` | Disables strict handling of errors from the SplatNet 3 GraphQL API if set to `0`. If set to `1` (default) requests will be rejected if the response includes any errors, even if the response includes a result.
`DEBUG` | Used by the [debug](https://github.com/debug-js/debug) package. Sets which modules should have debug logging enabled. See [debug logs](#debug-logs).
Other environment variables may also be used by Node.js, Electron or other packages nxapi depends on.

View File

@ -921,7 +921,7 @@ export default class SplatNet3Api {
return new this(
data.bullet_token.bulletToken,
data.version,
{},
data.queries ?? {},
getMapPersistedQueriesModeFromEnvironment(),
data.bullet_token.lang,
data.useragent,
@ -932,7 +932,7 @@ export default class SplatNet3Api {
return new this(
data.bullet_token,
data.version,
{},
data.queries ?? {},
getMapPersistedQueriesModeFromEnvironment(),
data.language,
SPLATNET3_WEBSERVICE_USERAGENT,
@ -1026,6 +1026,7 @@ export default class SplatNet3Api {
language,
country: user.country,
version,
queries: config.map_queries,
bullet_token,
created_at,
@ -1053,6 +1054,7 @@ export interface SplatNet3AuthData {
language: string;
country: string;
version: string;
queries?: Partial<Record<string, [/** new query ID */ string, /** unsafe */ boolean] | null>>;
bullet_token: BulletToken;
created_at: number;
@ -1070,6 +1072,7 @@ export interface SplatNet3CliTokenData {
expires_at: number;
language: string;
version: string;
queries?: Partial<Record<string, [/** new query ID */ string, /** unsafe */ boolean] | null>>;
}
export enum XRankingRegion {

View File

@ -41,6 +41,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
expires_at: data.expires_at,
language: data.bullet_token.lang,
version: data.version,
queries: data.queries,
};
console.log(JSON.stringify(result, null, argv.jsonPrettyPrint ? 4 : 0));

View File

@ -259,4 +259,5 @@ export interface SplatNet3RemoteConfig {
app_ver: string;
version: string;
revision: string;
map_queries?: Partial<Record<string, [/** new query ID */ string, /** unsafe */ boolean] | null>>;
}