Rename most instances of znc to coral

This commit is contained in:
Samuel Elliott
2022-06-28 19:21:33 +01:00
parent a2f3abaebd
commit a6a69b1799
37 changed files with 197 additions and 165 deletions

View File

@@ -10,7 +10,7 @@ import bodyParser from 'body-parser';
import mkdirp from 'mkdirp';
import type { Arguments as ParentArguments } from '../cli.js';
import { NintendoAccountIdTokenJwtPayload } from '../api/na.js';
import { ZNCA_CLIENT_ID, ZncJwtPayload } from '../api/znc.js';
import { CoralJwtPayload, ZNCA_CLIENT_ID } from '../api/coral.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../util/yargs.js';
import { initStorage, paths } from '../util/storage.js';
import { getJwks, Jwt } from '../util/jwt.js';
@@ -139,7 +139,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
}
try {
const [jwt, sig] = Jwt.decode<NintendoAccountIdTokenJwtPayload | ZncJwtPayload>(data.token);
const [jwt, sig] = Jwt.decode<NintendoAccountIdTokenJwtPayload | CoralJwtPayload>(data.token);
const check_signature = jwt.payload.iss === 'https://accounts.nintendo.com';

View File

@@ -5,7 +5,7 @@ import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
import { initStorage } from '../../util/storage.js';
import { getToken } from '../../common/auth/nso.js';
import { getNintendoAccountSessionToken } from '../../api/na.js';
import { ZNCA_CLIENT_ID } from '../../api/znc.js';
import { ZNCA_CLIENT_ID } from '../../api/coral.js';
import prompt from '../util/prompt.js';
const debug = createDebug('cli:nso:auth');

View File

@@ -1,6 +1,6 @@
import createDebug from 'debug';
import Table from '../util/table.js';
import { PresenceState } from '../../api/znc-types.js';
import { PresenceState } from '../../api/coral-types.js';
import type { Arguments as ParentArguments } from '../nso.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
import { initStorage } from '../../util/storage.js';

View File

@@ -4,8 +4,8 @@ import * as persist from 'node-persist';
import express, { Request, Response } from 'express';
import bodyParser from 'body-parser';
import { v4 as uuidgen } from 'uuid';
import { Announcement, CurrentUser, Friend, GetActiveEventResult, Presence, WebService } from '../../api/znc-types.js';
import ZncApi from '../../api/znc.js';
import { Announcement, CurrentUser, Friend, GetActiveEventResult, Presence, WebService } from '../../api/coral-types.js';
import CoralApi from '../../api/coral.js';
import type { Arguments as ParentArguments } from '../nso.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
import { initStorage } from '../../util/storage.js';
@@ -18,7 +18,7 @@ import { AuthPolicy, AuthToken, ZncPresenceEventStreamEvent } from '../../api/zn
declare global {
namespace Express {
interface Request {
znc?: ZncApi;
znc?: CoralApi;
zncAuth?: SavedToken;
zncAuthPolicy?: AuthPolicy;
@@ -126,7 +126,7 @@ function createApp(
}));
}
const znc_auth_promise = new Map</** session token */ string, Promise<{nso: ZncApi, data: SavedToken;}>>();
const znc_auth_promise = new Map</** session token */ string, Promise<{nso: CoralApi, data: SavedToken;}>>();
const znc_auth_timeout = new Map</** session token */ string, NodeJS.Timeout>();
const nsoAuth: express.RequestHandler = async (req, res, next) => {

View File

@@ -7,7 +7,7 @@ import { initStorage } from '../../util/storage.js';
import { getToken } from '../../common/auth/nso.js';
import { getIksmToken } from '../../common/auth/splatnet2.js';
import { EmbeddedSplatNet2Monitor, NotificationManager, ZncNotifications } from '../../common/notify.js';
import { CurrentUser, Friend, Game } from '../../api/znc-types.js';
import { CurrentUser, Friend, Game } from '../../api/coral-types.js';
const debug = createDebug('cli:nso:notify');

View File

@@ -1,5 +1,5 @@
import createDebug from 'debug';
import { PresencePermissions } from '../../api/znc-types.js';
import { PresencePermissions } from '../../api/coral-types.js';
import type { Arguments as ParentArguments } from '../nso.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
import { initStorage } from '../../util/storage.js';

View File

@@ -2,7 +2,7 @@ import process from 'node:process';
import createDebug from 'debug';
import fetch from 'node-fetch';
import { getPresenceFromUrl } from '../../api/znc-proxy.js';
import { ActiveEvent, CurrentUser, Friend, Game, Presence, PresenceState } from '../../api/znc-types.js';
import { ActiveEvent, CurrentUser, Friend, Game, Presence, PresenceState } from '../../api/coral-types.js';
import type { Arguments as ParentArguments } from '../util.js';
import { DiscordPresenceContext, DiscordPresencePlayTime, getDiscordPresence, getInactiveDiscordPresence } from '../../discord/util.js';
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
@@ -84,7 +84,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
const [presence, user, friendcode, activeevent] =
argv.presenceJson ? await getPresenceFromJson(argv.presenceJson) :
argv.presenceUrl ? await getPresenceFromUrl(argv.presenceUrl) :
await getPresenceFromZnc(argv);
await getPresenceFromCoral(argv);
const discordpresence = getActivityFromPresence(argv, presence, user, friendcode, activeevent);
const application = argv.showDiscordApplication ?
@@ -137,7 +137,7 @@ async function getPresenceFromJson(json: string) {
return [presence] as const;
}
async function getPresenceFromZnc(argv: ArgumentsCamelCase<Arguments>) {
async function getPresenceFromCoral(argv: ArgumentsCamelCase<Arguments>) {
const storage = await initStorage(argv.dataPath);
const usernsid = argv.user ?? await storage.getItem('SelectedUser');