mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Move CLI modules
This commit is contained in:
parent
ff3f8e1704
commit
3e0ba063f8
|
|
@ -1,7 +1,7 @@
|
|||
import process from 'node:process';
|
||||
import Yargs from 'yargs';
|
||||
import { setGlobalDispatcher } from 'undici';
|
||||
import * as commands from './cli/index.js';
|
||||
import * as commands from './cli/commands.js';
|
||||
import { checkUpdates } from './common/update.js';
|
||||
import createDebug from './util/debug.js';
|
||||
import { dev } from './util/product.js';
|
||||
|
|
|
|||
10
src/cli/commands.ts
Normal file
10
src/cli/commands.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export * as users from './users.js';
|
||||
export * as nso from './nso/index.js';
|
||||
export * as splatnet2 from './splatnet2/index.js';
|
||||
export * as nooklink from './nooklink/index.js';
|
||||
export * as splatnet3 from './splatnet3/index.js';
|
||||
export * as pctl from './pctl/index.js';
|
||||
export * as androidZncaApiServerFrida from './android-znca-api-server-frida.js';
|
||||
export * as presenceServer from './presence-server.js';
|
||||
export * as util from './util/index.js';
|
||||
export * as app from './app.js';
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
export * as users from './users.js';
|
||||
export * as nso from './nso.js';
|
||||
export * as splatnet2 from './splatnet2.js';
|
||||
export * as nooklink from './nooklink.js';
|
||||
export * as splatnet3 from './splatnet3.js';
|
||||
export * as pctl from './pctl.js';
|
||||
export * as androidZncaApiServerFrida from './android-znca-api-server-frida.js';
|
||||
export * as presenceServer from './presence-server.js';
|
||||
export * as util from './util.js';
|
||||
export * as app from './app.js';
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import * as commands from './nooklink/index.js';
|
||||
|
||||
const debug = createDebug('cli:nooklink');
|
||||
|
||||
export const command = 'nooklink <command>';
|
||||
export const desc = 'NookLink';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
describe: 'Automatically obtain and refresh the NookLink game web token and user token',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
10
src/cli/nooklink/commands.ts
Normal file
10
src/cli/nooklink/commands.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export * as users from './users.js';
|
||||
export * as user from './user.js';
|
||||
export * as island from './island.js';
|
||||
export * as newspapers from './newspapers.js';
|
||||
export * as newspaper from './newspaper.js';
|
||||
export * as dumpNewspapers from './dump-newspapers.js';
|
||||
export * as keyboard from './keyboard.js';
|
||||
export * as reactions from './reactions.js';
|
||||
export * as postReaction from './post-reaction.js';
|
||||
export * as userToken from './user-token.js';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import * as fs from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,10 +1,29 @@
|
|||
export * as users from './users.js';
|
||||
export * as user from './user.js';
|
||||
export * as island from './island.js';
|
||||
export * as newspapers from './newspapers.js';
|
||||
export * as newspaper from './newspaper.js';
|
||||
export * as dumpNewspapers from './dump-newspapers.js';
|
||||
export * as keyboard from './keyboard.js';
|
||||
export * as reactions from './reactions.js';
|
||||
export * as postReaction from './post-reaction.js';
|
||||
export * as userToken from './user-token.js';
|
||||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:nooklink');
|
||||
|
||||
export const command = 'nooklink <command>';
|
||||
export const desc = 'NookLink';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
describe: 'Automatically obtain and refresh the NookLink game web token and user token',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { read } from 'read';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import * as commands from './nso/index.js';
|
||||
|
||||
const debug = createDebug('cli:nso');
|
||||
|
||||
export const command = 'nso <command>';
|
||||
export const desc = 'Nintendo Switch Online';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { read } from 'read';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
16
src/cli/nso/commands.ts
Normal file
16
src/cli/nso/commands.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export * as token from './token.js';
|
||||
export * as auth from './auth.js';
|
||||
export * as user from './user.js';
|
||||
export * as permissions from './permissions.js';
|
||||
export * as announcements from './announcements.js';
|
||||
export * as webservices from './webservices.js';
|
||||
export * as webservicetoken from './webservicetoken.js';
|
||||
export * as friends from './friends.js';
|
||||
export * as activeEvent from './active-event.js';
|
||||
export * as presence from './presence.js';
|
||||
export * as notify from './notify.js';
|
||||
export * as httpServer from './http-server.js';
|
||||
export * as zncProxyTokens from './znc-proxy-tokens.js';
|
||||
export * as friendcode from './friendcode.js';
|
||||
export * as lookup from './lookup.js';
|
||||
export * as addFriend from './add-friend.js';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import Table from '../util/table.js';
|
||||
import Table from '../../util/table.js';
|
||||
import { PresenceState } from '../../api/coral-types.js';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
|
|||
import * as persist from 'node-persist';
|
||||
import express, { Request, RequestHandler, Response } from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import CoralApi, { CoralApiInterface, CoralErrorResponse } from '../../api/coral.js';
|
||||
import { Announcement, CoralStatus, CurrentUser, Friend, FriendCodeUrl, FriendCodeUser, Presence } from '../../api/coral-types.js';
|
||||
import { AuthPolicy, AuthToken, ZncPresenceEventStreamEvent } from '../../api/znc-proxy.js';
|
||||
|
|
@ -14,7 +14,7 @@ import { initStorage } from '../../util/storage.js';
|
|||
import { product } from '../../util/product.js';
|
||||
import { parseListenAddress } from '../../util/net.js';
|
||||
import { addCliFeatureUserAgent } from '../../util/useragent.js';
|
||||
import { EventStreamResponse, HttpServer, ResponseError } from '../util/http-server.js';
|
||||
import { EventStreamResponse, HttpServer, ResponseError } from '../../util/http-server.js';
|
||||
import { SavedToken } from '../../common/auth/coral.js';
|
||||
import { NotificationManager, PresenceEvent, ZncNotifications } from '../../common/notify.js';
|
||||
import Users, { CoralUser } from '../../common/users.js';
|
||||
|
|
|
|||
|
|
@ -1,16 +1,25 @@
|
|||
export * as token from './token.js';
|
||||
export * as auth from './auth.js';
|
||||
export * as user from './user.js';
|
||||
export * as permissions from './permissions.js';
|
||||
export * as announcements from './announcements.js';
|
||||
export * as webservices from './webservices.js';
|
||||
export * as webservicetoken from './webservicetoken.js';
|
||||
export * as friends from './friends.js';
|
||||
export * as activeEvent from './active-event.js';
|
||||
export * as presence from './presence.js';
|
||||
export * as notify from './notify.js';
|
||||
export * as httpServer from './http-server.js';
|
||||
export * as zncProxyTokens from './znc-proxy-tokens.js';
|
||||
export * as friendcode from './friendcode.js';
|
||||
export * as lookup from './lookup.js';
|
||||
export * as addFriend from './add-friend.js';
|
||||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:nso');
|
||||
|
||||
export const command = 'nso <command>';
|
||||
export const desc = 'Nintendo Switch Online';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import persist from 'node-persist';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PresencePermissions } from '../../api/coral-types.js';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { read } from 'read';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { fetch } from 'undici';
|
||||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../nso.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import { getToken } from '../../common/auth/coral.js';
|
||||
import { AuthPolicy, AuthToken } from '../../api/znc-proxy.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import * as commands from './pctl/index.js';
|
||||
|
||||
const debug = createDebug('cli:pctl');
|
||||
|
||||
export const command = 'pctl <command>';
|
||||
export const desc = 'Nintendo Switch Parental Controls';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs;
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { read } from 'read';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
8
src/cli/pctl/commands.ts
Normal file
8
src/cli/pctl/commands.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export * as token from './token.js';
|
||||
export * as auth from './auth.js';
|
||||
export * as devices from './devices.js';
|
||||
export * as dailySummaries from './daily-summaries.js';
|
||||
export * as monthlySummaries from './monthly-summaries.js';
|
||||
export * as monthlySummary from './monthly-summary.js';
|
||||
export * as settings from './settings.js';
|
||||
export * as dumpSummaries from './dump-summaries.js';
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
export * as token from './token.js';
|
||||
export * as auth from './auth.js';
|
||||
export * as devices from './devices.js';
|
||||
export * as dailySummaries from './daily-summaries.js';
|
||||
export * as monthlySummaries from './monthly-summaries.js';
|
||||
export * as monthlySummary from './monthly-summary.js';
|
||||
export * as settings from './settings.js';
|
||||
export * as dumpSummaries from './dump-summaries.js';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:pctl');
|
||||
|
||||
export const command = 'pctl <command>';
|
||||
export const desc = 'Nintendo Switch Parental Controls';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs;
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { read } from 'read';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import { getPctlToken } from '../../common/auth/moon.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ import createDebug from '../util/debug.js';
|
|||
import { initStorage } from '../util/storage.js';
|
||||
import { addCliFeatureUserAgent, getUserAgent } from '../util/useragent.js';
|
||||
import { parseListenAddress } from '../util/net.js';
|
||||
import { EventStreamResponse, HttpServer, ResponseError } from './util/http-server.js';
|
||||
import { EventStreamResponse, HttpServer, ResponseError } from '../util/http-server.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../util/yargs.js';
|
||||
import { getTitleIdFromEcUrl } from '../util/misc.js';
|
||||
import { getSettingForCoopRule, getSettingForVsMode } from '../discord/monitor/splatoon3.js';
|
||||
import { CoralApiInterface } from '../api/coral.js';
|
||||
import { PresenceEmbedFormat, getUserEmbedOptionsFromRequest, renderUserEmbedImage, renderUserEmbedSvg } from './util/presence-embed.js';
|
||||
import { PresenceEmbedFormat, getUserEmbedOptionsFromRequest, renderUserEmbedImage, renderUserEmbedSvg } from '../common/presence-embed.js';
|
||||
|
||||
const debug = createDebug('cli:presence-server');
|
||||
const debugSplatnet3Proxy = createDebug('cli:presence-server:splatnet3-proxy');
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import * as commands from './splatnet2/index.js';
|
||||
|
||||
const debug = createDebug('cli:splatnet2');
|
||||
|
||||
export const command = 'splatnet2 <command>';
|
||||
export const desc = 'SplatNet 2';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
alias: ['auto-update-iksm-session'],
|
||||
describe: 'Automatically obtain and refresh the iksm_session cookie',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
12
src/cli/splatnet2/commands.ts
Normal file
12
src/cli/splatnet2/commands.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export * as user from './user.js';
|
||||
export * as token from './token.js';
|
||||
export * as stages from './stages.js';
|
||||
export * as challenges from './challenges.js';
|
||||
export * as weapons from './weapons.js';
|
||||
export * as hero from './hero.js';
|
||||
export * as battles from './battles.js';
|
||||
export * as schedule from './schedule.js';
|
||||
export * as dumpResults from './dump-results.js';
|
||||
export * as dumpRecords from './dump-records.js';
|
||||
export * as monitor from './monitor.js';
|
||||
export * as xRankSeasons from './x-rank-seasons.js';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,30 @@
|
|||
export * as user from './user.js';
|
||||
export * as token from './token.js';
|
||||
export * as stages from './stages.js';
|
||||
export * as challenges from './challenges.js';
|
||||
export * as weapons from './weapons.js';
|
||||
export * as hero from './hero.js';
|
||||
export * as battles from './battles.js';
|
||||
export * as schedule from './schedule.js';
|
||||
export * as dumpResults from './dump-results.js';
|
||||
export * as dumpRecords from './dump-records.js';
|
||||
export * as monitor from './monitor.js';
|
||||
export * as xRankSeasons from './x-rank-seasons.js';
|
||||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:splatnet2');
|
||||
|
||||
export const command = 'splatnet2 <command>';
|
||||
export const desc = 'SplatNet 2';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
alias: ['auto-update-iksm-session'],
|
||||
describe: 'Automatically obtain and refresh the iksm_session cookie',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { getIksmToken } from '../../common/auth/splatnet2.js';
|
|||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
import { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import { Arguments as ParentArguments } from './index.js';
|
||||
import { SplatNet2RecordsMonitor } from '../../common/splatnet2/monitor.js';
|
||||
|
||||
const debug = createDebug('cli:splatnet2:monitor');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { getAllSeasons } from '../../api/splatnet2-xrank.js';
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import * as commands from './splatnet3/index.js';
|
||||
|
||||
const debug = createDebug('cli:splatnet3');
|
||||
|
||||
export const command = 'splatnet3 <command>';
|
||||
export const desc = 'SplatNet 3';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
describe: 'Automatically obtain and refresh the SplatNet 3 access token',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { Judgement } from 'splatnet3-types/splatnet3';
|
||||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
12
src/cli/splatnet3/commands.ts
Normal file
12
src/cli/splatnet3/commands.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export * as user from './user.js';
|
||||
export * as token from './token.js';
|
||||
export * as friends from './friends.js';
|
||||
export * as schedule from './schedule.js';
|
||||
export * as festivals from './festivals.js';
|
||||
export * as festival from './festival.js';
|
||||
export * as battles from './battles.js';
|
||||
export * as dumpRecords from './dump-records.js';
|
||||
export * as dumpFests from './dump-fests.js';
|
||||
export * as dumpAlbum from './dump-album.js';
|
||||
export * as dumpResults from './dump-results.js';
|
||||
export * as monitor from './monitor.js';
|
||||
|
|
@ -2,7 +2,7 @@ import * as path from 'node:path';
|
|||
import * as fs from 'node:fs/promises';
|
||||
import { fetch } from 'undici';
|
||||
import { PhotoAlbumResult } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import { FestState, Fest_detail, RequestId } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import { BankaraBattleHistoriesRefetchResult, CoopHistoryResult, LatestBattleHistoriesRefetchResult, LatestBattleHistoriesResult, PrivateBattleHistoriesRefetchResult, RefetchableCoopHistory_CoopResultResult, RegularBattleHistoriesRefetchResult, RequestId, XBattleHistoriesRefetchResult } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { FestState } from 'splatnet3-types/splatnet3';
|
||||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { FriendOnlineState, Friend_friendList } from 'splatnet3-types/splatnet3';
|
||||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,29 @@
|
|||
export * as user from './user.js';
|
||||
export * as token from './token.js';
|
||||
export * as friends from './friends.js';
|
||||
export * as schedule from './schedule.js';
|
||||
export * as festivals from './festivals.js';
|
||||
export * as festival from './festival.js';
|
||||
export * as battles from './battles.js';
|
||||
export * as dumpRecords from './dump-records.js';
|
||||
export * as dumpFests from './dump-fests.js';
|
||||
export * as dumpAlbum from './dump-album.js';
|
||||
export * as dumpResults from './dump-results.js';
|
||||
export * as monitor from './monitor.js';
|
||||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:splatnet3');
|
||||
|
||||
export const command = 'splatnet3 <command>';
|
||||
export const desc = 'SplatNet 3';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs.option('znc-proxy-url', {
|
||||
describe: 'URL of Nintendo Switch Online app API proxy server to use',
|
||||
type: 'string',
|
||||
default: process.env.ZNC_PROXY_URL,
|
||||
}).option('auto-update-session', {
|
||||
describe: 'Automatically obtain and refresh the SplatNet 3 access token',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
});
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import Table from '../../util/table.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { initStorage } from '../../util/storage.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as persist from 'node-persist';
|
||||
import Table from './util/table.js';
|
||||
import Table from '../util/table.js';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv } from '../util/yargs.js';
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../util/yargs.js';
|
||||
import { dev } from '../util/product.js';
|
||||
import * as commands from './util/index.js';
|
||||
|
||||
const debug = createDebug('cli:util');
|
||||
|
||||
export const command = 'util <command>';
|
||||
export const desc = 'Utilities';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
if (command.command === 'validate-discord-titles' && !dev) continue;
|
||||
if (command.command === 'export-discord-titles' && !dev) continue;
|
||||
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs;
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import * as crypto from 'node:crypto';
|
||||
import { Buffer } from 'node:buffer';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv } from '../../util/yargs.js';
|
||||
|
||||
|
|
|
|||
9
src/cli/util/commands.ts
Normal file
9
src/cli/util/commands.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export * as captureid from './captureid.js';
|
||||
export * as validateDiscordTitles from './validate-discord-titles.js';
|
||||
export * as exportDiscordTitles from './export-discord-titles.js';
|
||||
export * as discordActivity from './discord-activity.js';
|
||||
export * as discordRpc from './discord-rpc.js';
|
||||
export * as remoteConfig from './remote-config.js';
|
||||
export * as storage from './storage.js';
|
||||
export * as presenceEmbedRender from './presence-embed-render.js';
|
||||
export * as presenceEmbedServer from './presence-embed-server.js';
|
||||
|
|
@ -2,7 +2,7 @@ import process from 'node:process';
|
|||
import { fetch } from 'undici';
|
||||
import { getPresenceFromUrl } from '../../api/znc-proxy.js';
|
||||
import { ActiveEvent, CurrentUser, Friend, Game, Presence, PresenceState } from '../../api/coral-types.js';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import { getDiscordPresence, getInactiveDiscordPresence } from '../../discord/util.js';
|
||||
import { DiscordPresenceContext, DiscordPresencePlayTime } from '../../discord/types.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import { DiscordRpcClient, getAllIpcSockets } from '../../discord/rpc.js';
|
||||
import { defaultTitle } from '../../discord/titles.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { fetch } from 'undici';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { titles as unsorted_titles } from '../../discord/titles.js';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,24 @@
|
|||
export * as captureid from './captureid.js';
|
||||
export * as validateDiscordTitles from './validate-discord-titles.js';
|
||||
export * as exportDiscordTitles from './export-discord-titles.js';
|
||||
export * as discordActivity from './discord-activity.js';
|
||||
export * as discordRpc from './discord-rpc.js';
|
||||
export * as remoteConfig from './remote-config.js';
|
||||
export * as storage from './storage.js';
|
||||
export * as presenceEmbedRender from './presence-embed-render.js';
|
||||
export * as presenceEmbedServer from './presence-embed-server.js';
|
||||
import type { Arguments as ParentArguments } from '../../cli.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { dev } from '../../util/product.js';
|
||||
import * as commands from './commands.js';
|
||||
|
||||
const debug = createDebug('cli:util');
|
||||
|
||||
export const command = 'util <command>';
|
||||
export const desc = 'Utilities';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
for (const command of Object.values(commands)) {
|
||||
if (command.command === 'validate-discord-titles' && !dev) continue;
|
||||
if (command.command === 'export-discord-titles' && !dev) continue;
|
||||
|
||||
// @ts-expect-error
|
||||
yargs.command(command);
|
||||
}
|
||||
|
||||
return yargs;
|
||||
}
|
||||
|
||||
export type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import mimetypes from 'mime-types';
|
||||
import { FestVoteState } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { getPresenceFromUrl } from '../../api/znc-proxy.js';
|
||||
import { PresenceResponse } from '../presence-server.js';
|
||||
import { PresenceEmbedFormat, PresenceEmbedTheme, renderUserEmbedImage, renderUserEmbedSvg } from './presence-embed.js';
|
||||
import { PresenceEmbedFormat, PresenceEmbedTheme, renderUserEmbedImage, renderUserEmbedSvg } from '../../common/presence-embed.js';
|
||||
|
||||
const debug = createDebug('cli:util:render-presence-embed');
|
||||
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@ import express, { Request, Response } from 'express';
|
|||
import { createHash } from 'node:crypto';
|
||||
import mimetypes from 'mime-types';
|
||||
import { FestVoteState } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
import { getPresenceFromUrl } from '../../api/znc-proxy.js';
|
||||
import { PresenceResponse } from '../presence-server.js';
|
||||
import { addCliFeatureUserAgent } from '../../util/useragent.js';
|
||||
import { HttpServer, ResponseError } from './http-server.js';
|
||||
import { HttpServer, ResponseError } from '../../util/http-server.js';
|
||||
import { git, product, version } from '../../util/product.js';
|
||||
import { parseListenAddress } from '../../util/net.js';
|
||||
import { RawValueSymbol, htmlentities } from '../../util/misc.js';
|
||||
import { PresenceEmbedFormat, PresenceEmbedTheme, getUserEmbedOptionsFromRequest, renderUserEmbedImage, renderUserEmbedSvg } from './presence-embed.js';
|
||||
import { PresenceEmbedFormat, PresenceEmbedTheme, getUserEmbedOptionsFromRequest, renderUserEmbedImage, renderUserEmbedSvg } from '../../common/presence-embed.js';
|
||||
|
||||
const debug = createDebug('cli:util:presence-embed-server');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import * as util from 'node:util';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Argv } from '../../util/yargs.js';
|
||||
import { initStorage, iterateLocalStorage } from '../../util/storage.js';
|
||||
import Table from './table.js';
|
||||
import Table from '../../util/table.js';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { Storage } from '../../client/storage/index.js';
|
||||
import { LocalStorageProvider } from '../../client/storage/local.js';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import process from 'node:process';
|
||||
import type { Arguments as ParentArguments } from '../util.js';
|
||||
import type { Arguments as ParentArguments } from './index.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase } from '../../util/yargs.js';
|
||||
import * as publishers from '../../discord/titles/index.js';
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import * as path from 'node:path';
|
|||
import { Request } from 'express';
|
||||
import sharp from 'sharp';
|
||||
import { CoopRule, FestVoteState, FriendOnlineState, StageScheduleResult } from 'splatnet3-types/splatnet3';
|
||||
import { dir } from '../../util/product.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { Game, PresenceState } from '../../api/coral-types.js';
|
||||
import { RawValueSymbol, htmlentities } from '../../util/misc.js';
|
||||
import { PresenceResponse } from '../presence-server.js';
|
||||
import { dir } from '../util/product.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { Game, PresenceState } from '../api/coral-types.js';
|
||||
import { RawValueSymbol, htmlentities } from '../util/misc.js';
|
||||
import { PresenceResponse } from '../cli/presence-server.js';
|
||||
|
||||
const debug = createDebug('cli:util:presence-embed');
|
||||
const debug = createDebug('nxapi:common:presence-embed');
|
||||
|
||||
type VsSchedule_event = StageScheduleResult['eventSchedules']['nodes'][0];
|
||||
type LeagueMatchSetting_schedule = VsSchedule_event['leagueMatchSetting'];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { NextFunction, Request, RequestHandler, Response } from 'express';
|
||||
import { ErrorResponse } from '../../api/util.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { temporary_http_errors, temporary_system_errors } from '../../util/errors.js';
|
||||
import { ErrorResponse } from '../api/util.js';
|
||||
import createDebug from './debug.js';
|
||||
import { temporary_http_errors, temporary_system_errors } from './errors.js';
|
||||
|
||||
const debug = createDebug('cli:util:http-server');
|
||||
const debug = createDebug('nxapi:util:http-server');
|
||||
|
||||
export class HttpServer {
|
||||
retry_after = 60;
|
||||
Loading…
Reference in New Issue
Block a user