Merge branch 'main' into i18n

This commit is contained in:
Samuel Elliott 2023-02-28 14:43:37 +00:00
commit 41f29328d9
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
10 changed files with 93 additions and 101 deletions

48
package-lock.json generated
View File

@ -23,7 +23,7 @@
"node-notifier": "^10.0.1",
"node-persist": "^3.1.0",
"read": "^1.0.7",
"splatnet3-types": "^0.2.20230125112953",
"splatnet3-types": "^0.2.20230227204004",
"supports-color": "^8.1.1",
"tslib": "^2.4.1",
"uuid": "^8.3.2",
@ -39,7 +39,6 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-replace": "^4.0.0",
"@rollup/plugin-typescript": "^8.5.0",
"@types/body-parser": "^1.19.2",
"@types/cli-table": "^0.3.1",
"@types/debug": "^4.1.7",
@ -362,29 +361,6 @@
"rollup": "^1.20.0 || ^2.0.0"
}
},
"node_modules/@rollup/plugin-typescript": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.5.0.tgz",
"integrity": "sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^3.1.0",
"resolve": "^1.17.0"
},
"engines": {
"node": ">=8.0.0"
},
"peerDependencies": {
"rollup": "^2.14.0",
"tslib": "*",
"typescript": ">=3.7.0"
},
"peerDependenciesMeta": {
"tslib": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
@ -4139,9 +4115,9 @@
"dev": true
},
"node_modules/splatnet3-types": {
"version": "0.2.20230125112953",
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230125112953.tgz",
"integrity": "sha512-ZoyYHjRlq0ZIg8ZWVnQ6MYWSjEv7nVMgSImyDqho9taZS31yxrSj/xZer6teTSrCTGIabYDvx+MPEhAHg8Jbpw=="
"version": "0.2.20230227204004",
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230227204004.tgz",
"integrity": "sha512-FAY6pbUcrp5O8c49BNXSKxoyM3UlCrRx2AtA9Y3qlvqOLdHqwxtzcdzbk1b1hRam8ZcrxRzE/ii6ESRiPIAnZw=="
},
"node_modules/sprintf-js": {
"version": "1.1.2",
@ -4942,16 +4918,6 @@
"magic-string": "^0.25.7"
}
},
"@rollup/plugin-typescript": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.5.0.tgz",
"integrity": "sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^3.1.0",
"resolve": "^1.17.0"
}
},
"@rollup/pluginutils": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
@ -7895,9 +7861,9 @@
"dev": true
},
"splatnet3-types": {
"version": "0.2.20230125112953",
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230125112953.tgz",
"integrity": "sha512-ZoyYHjRlq0ZIg8ZWVnQ6MYWSjEv7nVMgSImyDqho9taZS31yxrSj/xZer6teTSrCTGIabYDvx+MPEhAHg8Jbpw=="
"version": "0.2.20230227204004",
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230227204004.tgz",
"integrity": "sha512-FAY6pbUcrp5O8c49BNXSKxoyM3UlCrRx2AtA9Y3qlvqOLdHqwxtzcdzbk1b1hRam8ZcrxRzE/ii6ESRiPIAnZw=="
},
"sprintf-js": {
"version": "1.1.2",

View File

@ -49,7 +49,7 @@
"node-notifier": "^10.0.1",
"node-persist": "^3.1.0",
"read": "^1.0.7",
"splatnet3-types": "^0.2.20230125112953",
"splatnet3-types": "^0.2.20230227204004",
"supports-color": "^8.1.1",
"tslib": "^2.4.1",
"uuid": "^8.3.2",
@ -62,7 +62,6 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-replace": "^4.0.0",
"@rollup/plugin-typescript": "^8.5.0",
"@types/body-parser": "^1.19.2",
"@types/cli-table": "^0.3.1",
"@types/debug": "^4.1.7",

View File

@ -17,8 +17,8 @@
"blanco_version": "2.1.1"
},
"coral_gws_splatnet3": {
"app_ver": "2.0.0-bd36a652",
"version": "2.0.0",
"revision": "bd36a652913aa26b132b84df921e07b20f4a414d"
"app_ver": "3.0.0-2857bc50",
"version": "3.0.0",
"revision": "2857bc50653d316cb69f017b2eef24d2ae56a1b7"
}
}

View File

@ -2,8 +2,8 @@ import * as path from 'path';
import { fileURLToPath } from 'url';
import * as fs from 'fs';
import * as child_process from 'child_process';
import { Module } from 'module';
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import alias from '@rollup/plugin-alias';
import replace from '@rollup/plugin-replace';
@ -43,7 +43,7 @@ const release = process.env.NODE_ENV === 'production' ? process.env.CI_COMMIT_TA
* @type {import('@rollup/plugin-replace').RollupReplaceOptions}
*/
const replace_options = {
include: ['src/util/product.ts'],
include: ['dist/util/product.js'],
values: {
'globalThis.__NXAPI_BUNDLE_PKG__': JSON.stringify(pkg),
'globalThis.__NXAPI_BUNDLE_GIT__': JSON.stringify(git),
@ -58,14 +58,14 @@ const replace_options = {
* @type {import('rollup').RollupOptions['watch']}
*/
const watch = {
include: 'src/**',
include: 'dist/**',
};
/**
* @type {import('rollup').RollupOptions}
*/
const main = {
input: ['src/cli-entry.ts', 'src/app/main/index.ts'],
input: ['dist/cli-entry.js', 'dist/app/main/index.js'],
output: {
dir: 'dist/bundle',
format: 'es',
@ -79,19 +79,17 @@ const main = {
},
plugins: [
replace(replace_options),
typescript({
outDir: 'dist/bundle/ts',
noEmit: true,
declaration: false,
}),
commonjs({
// the ".ts" extension is required
extensions: ['.js', '.jsx', '.ts', '.tsx'],
esmExternals: true,
// events and stream modify module.exports
requireReturnsDefault: 'preferred',
}),
json(),
alias({
entries: [
...Module.builtinModules.map(m => ({find: m, replacement: 'node:' + m})),
],
}),
nodeResolve({
exportConditions: ['node'],
browser: false,
@ -110,29 +108,26 @@ const main = {
* @type {import('rollup').RollupOptions}
*/
const app_entry = {
input: 'src/app/app-entry.cts',
input: 'dist/app/app-entry.cjs',
output: {
file: 'dist/bundle/app-entry.cjs',
format: 'iife',
inlineDynamicImports: true,
sourcemap: true,
globals: {
'electron': 'require("electron")',
},
},
plugins: [
replace(replace_options),
replace({
include: ['src/app/app-entry.cts'],
include: ['dist/app/app-entry.cjs'],
values: {
'__NXAPI_BUNDLE_APP_MAIN__': JSON.stringify('./app-main-bundle.js'),
},
preventAssignment: true,
}),
typescript({
noEmit: true,
declaration: false,
}),
commonjs({
// the ".ts" extension is required
extensions: ['.js', '.jsx', '.ts', '.tsx'],
esmExternals: true,
// events and stream modify module.exports
requireReturnsDefault: 'preferred',
@ -146,7 +141,8 @@ const app_entry = {
],
external: [
'electron',
path.resolve(__dirname, 'src/app/app-main-bundle.js'),
path.resolve(__dirname, 'dist/app/app-main-bundle.js'),
path.resolve(__dirname, 'dist/app/main/index.js'),
],
watch,
};
@ -155,7 +151,7 @@ const app_entry = {
* @type {import('rollup').RollupOptions}
*/
const app_preload = {
input: 'src/app/preload/index.ts',
input: 'dist/app/preload/index.js',
output: {
file: 'dist/app/bundle/preload.cjs',
format: 'cjs',
@ -163,13 +159,7 @@ const app_preload = {
},
plugins: [
replace(replace_options),
typescript({
noEmit: true,
declaration: false,
}),
commonjs({
// the ".ts" extension is required
extensions: ['.js', '.jsx', '.ts', '.tsx'],
esmExternals: true,
}),
nodeResolve({
@ -187,20 +177,14 @@ const app_preload = {
* @type {import('rollup').RollupOptions}
*/
const app_preload_webservice = {
input: 'src/app/preload-webservice/index.ts',
input: 'dist/app/preload-webservice/index.js',
output: {
file: 'dist/app/bundle/preload-webservice.cjs',
format: 'cjs',
},
plugins: [
replace(replace_options),
typescript({
noEmit: true,
declaration: false,
}),
commonjs({
// the ".ts" extension is required
extensions: ['.js', '.jsx', '.ts', '.tsx'],
esmExternals: true,
}),
nodeResolve({
@ -218,7 +202,7 @@ const app_preload_webservice = {
* @type {import('rollup').RollupOptions}
*/
const app_browser = {
input: 'src/app/browser/index.ts',
input: 'dist/app/browser/index.js',
output: {
dir: 'dist/app/bundle',
format: 'es',
@ -238,14 +222,7 @@ const app_browser = {
title: 'nxapi',
}),
replace(replace_options),
typescript({
outDir: 'dist/app/bundle/ts',
noEmit: true,
declaration: false,
}),
commonjs({
// the ".ts" extension is required
extensions: ['.js', '.jsx', '.ts', '.tsx'],
esmExternals: true,
}),
nodePolyfill(),
@ -255,6 +232,7 @@ const app_browser = {
// used when resolving react-native-web. For some reason this causes both versions
// to be included in the bundle, so here we explicitly use the CommonJS build.
{find: 'react-native', replacement: path.resolve(__dirname, 'node_modules', 'react-native-web', 'dist', 'cjs', 'index.js')},
{find: 'react-native-web', replacement: path.resolve(__dirname, 'node_modules', 'react-native-web', 'dist', 'cjs', 'index.js')},
// rollup-plugin-polyfill-node doesn't support node: module identifiers
{find: /^node:(.+)/, replacement: '$1'},
@ -268,10 +246,12 @@ const app_browser = {
watch,
};
const skip = process.env.BUNDLE_SKIP?.split(',') ?? [];
export default [
main,
app_entry,
app_preload,
app_preload_webservice,
app_browser,
];
!skip?.includes('main') && main,
!skip?.includes('app-entry') && app_entry,
!skip?.includes('app-preload') && app_preload,
!skip?.includes('app-preload-webservice') && app_preload_webservice,
!skip?.includes('app-browser') && app_browser,
].filter(c => c);

View File

@ -85,6 +85,7 @@ export default class SplatNet3Api {
public version: string,
public map_queries: Partial<Record<string, [/** new query ID */ string, /** unsafe */ boolean] | null>>,
readonly map_queries_mode: MapQueriesMode,
readonly na_country: string,
public language: string,
public useragent: string,
) {}
@ -244,12 +245,16 @@ export default class SplatNet3Api {
/** / */
async getHome() {
return this.persistedQuery(RequestId.HomeQuery, {});
return this.persistedQuery(RequestId.HomeQuery, {
naCountry: this.na_country,
});
}
/** / -> /setting */
async getSettings() {
return this.persistedQuery(RequestId.SettingQuery, {});
return this.persistedQuery(RequestId.SettingQuery, {
naCountry: this.na_country,
});
}
/** / -> /photo_album */
@ -693,6 +698,14 @@ export default class SplatNet3Api {
});
}
/** / -> /my_outfits [-> /my_outfits/{id}] -> share */
async shareOutfit(index: number, timezone_offset_minutes = 0) {
return this.persistedQuery(RequestId.ShareMyOutfitQuery, {
myOutfitIndex: index,
timezoneOffset: timezone_offset_minutes, // (new Date()).getTimezoneOffset()
});
}
//
// Replays
//
@ -933,6 +946,7 @@ export default class SplatNet3Api {
data.version,
data.queries ?? {},
getMapPersistedQueriesModeFromEnvironment(),
data.country,
data.bullet_token.lang,
data.useragent,
);
@ -944,6 +958,7 @@ export default class SplatNet3Api {
data.version,
data.queries ?? {},
getMapPersistedQueriesModeFromEnvironment(),
data.country ?? 'GB',
data.language,
SPLATNET3_WEBSERVICE_USERAGENT,
);
@ -1081,6 +1096,7 @@ export interface SplatNet3CliTokenData {
bullet_token: string;
expires_at: number;
language: string;
country: string;
version: string;
queries?: Partial<Record<string, [/** new query ID */ string, /** unsafe */ boolean] | null>>;
}

View File

@ -40,6 +40,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
bullet_token: data.bullet_token.bulletToken,
expires_at: data.expires_at,
language: data.bullet_token.lang,
country: data.country,
version: data.version,
queries: data.queries,
};

View File

@ -1,7 +1,7 @@
import createDebug from 'debug';
import persist from 'node-persist';
import DiscordRPC from 'discord-rpc';
import { BankaraMatchMode, BankaraMatchSetting, CoopSchedule, CoopSchedule_schedule, CoopSetting, DetailVotingStatusResult, FestMatchSetting, FestState, FestTeamRole, FestTeam_schedule, FestTeam_votingStatus, Fest_schedule, FriendListResult, FriendOnlineState, GraphQLSuccessResponse, LeagueMatchSetting, RegularMatchSetting, StageScheduleResult, VsSchedule_bankara, VsSchedule_fest, VsSchedule_league, VsSchedule_regular, VsSchedule_xMatch, XMatchSetting } from 'splatnet3-types/splatnet3';
import { BankaraMatchMode, BankaraMatchSetting, CoopRule, CoopSchedule_schedule, CoopSetting_schedule, DetailVotingStatusResult, FestMatchSetting, FestTeam_schedule, FestTeam_votingStatus, Fest_schedule, FriendListResult, FriendOnlineState, GraphQLSuccessResponse, LeagueMatchSetting, RegularMatchSetting, StageScheduleResult, VsSchedule_bankara, VsSchedule_fest, VsSchedule_league, VsSchedule_regular, VsSchedule_xMatch, XMatchSetting } from 'splatnet3-types/splatnet3';
import { Game } from '../../api/coral-types.js';
import SplatNet3Api from '../../api/splatnet3.js';
import { DiscordPresenceExternalMonitorsConfiguration } from '../../app/common/types.js';
@ -35,6 +35,7 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
x_schedule: VsSchedule_xMatch | null = null;
coop_regular_schedule: CoopSchedule_schedule | null = null;
coop_big_run_schedule: CoopSchedule_schedule | null = null;
coop_team_contest_schedule: CoopSchedule_schedule | null = null;
fest: Fest_schedule | null = null;
fest_team_voting_status: FestTeam_votingStatus | null = null;
fest_team: FestTeam_schedule | null = null;
@ -135,6 +136,7 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
this.x_schedule = this.getSchedule(this.cached_schedules?.data.xSchedules.nodes ?? []);
this.coop_regular_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.regularSchedules.nodes ?? []);
this.coop_big_run_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.bigRunSchedules.nodes ?? []);
this.coop_team_contest_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.teamContestSchedules.nodes ?? []);
this.fest = this.cached_schedules?.data.currentFest ?? null;
// Identify the user by their icon as the vote list doesn't have friend IDs
@ -225,7 +227,7 @@ interface PresenceUrlResponse {
splatoon3_vs_setting?:
RegularMatchSetting | BankaraMatchSetting | FestMatchSetting |
LeagueMatchSetting | XMatchSetting | null;
splatoon3_coop_setting?: CoopSetting | null;
splatoon3_coop_setting?: CoopSetting_schedule | null;
splatoon3_fest?: Fest_schedule | null;
}
@ -339,9 +341,9 @@ export function callback(activity: DiscordRPC.Presence, game: Game, context?: Di
presence_proxy_data && 'splatoon3_coop_setting' in presence_proxy_data ?
presence_proxy_data.splatoon3_coop_setting :
monitor ?
friend.coopRule === 'BIG_RUN' ?
monitor.coop_big_run_schedule?.setting :
monitor.coop_regular_schedule?.setting :
friend.coopRule === CoopRule.BIG_RUN ? monitor.coop_big_run_schedule?.setting :
friend.coopRule === CoopRule.TEAM_CONTEST ? monitor.coop_team_contest_schedule?.setting :
monitor.coop_regular_schedule?.setting :
null;
if (coop_setting) {
@ -359,4 +361,8 @@ export function callback(activity: DiscordRPC.Presence, game: Game, context?: Di
}
}
}
if (friend.onlineState === FriendOnlineState.MINI_GAME_PLAYING) {
activity.details = 'Tableturf Battle';
}
}

View File

@ -2,3 +2,4 @@ export * as nintendo from './nintendo.js';
export * as mojang from './mojang.js';
export * as capcom from './capcom.js';
export * as the_pokemon_company from './the-pokémon-company.js';
export * as thatgamecompany from './thatgamecompany.js';

View File

@ -138,6 +138,18 @@ export const titles: Title[] = [
client: '950907272438104064',
largeImageText: 'SEGA Mega Drive',
},
{
// Game Boy - Nintendo Switch Online
id: '0100c62011050000',
client: '950907272438104064',
largeImageText: 'Game Boy',
},
{
// Game Boy Advance - Nintendo Switch Online
id: '010012f017576000',
client: '950907272438104064',
largeImageText: 'Game Boy Advance',
},
{
// Animal Crossing: New Horizons

View File

@ -0,0 +1,11 @@
import { Title } from '../types.js';
export const titles: Title[] = [
{
// Sky: Children of the Light
id: '0100c52011460000',
client: '1080136394288144465',
showPlayingOnline: true,
showActiveEvent: true,
},
];