mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-09-04 01:24:53 -05:00
Move authentication functions
app no longer imports from cli
This commit is contained in:
@@ -6,7 +6,6 @@ import { NintendoAccountUser } from './na.js';
|
||||
import { ErrorResponse } from './util.js';
|
||||
import ZncApi from './znc.js';
|
||||
import { ActiveFestivals, CoopResult, CoopResults, CoopSchedules, HeroRecords, NicknameAndIcons, PastFestivals, Records, Result, Results, Schedules, ShareResponse, ShopMerchandises, Stages, Timeline, WebServiceError, XPowerRankingSummary } from './splatnet2-types.js';
|
||||
import { updateIksmSessionLastUsed } from '../cli/splatnet2/util.js';
|
||||
|
||||
const debug = createDebug('nxapi:api:splatnet2');
|
||||
|
||||
@@ -19,6 +18,10 @@ const SPLATNET2_URL = SPLATNET2_WEBSERVICE_URL + 'api';
|
||||
const XPOWERRANKING_SEASON = /^(\d{2})(\d{2})01T00_(\d{2})(\d{2})01T00$/;
|
||||
const LEAGUE_ID = /^(\d{2})(\d{2})(\d{2})(\d{2})(T|P)$/;
|
||||
|
||||
export const updateIksmSessionLastUsed: {
|
||||
handler?: ((iksm_session: string) => void);
|
||||
} = {};
|
||||
|
||||
export default class SplatNet2Api {
|
||||
constructor(
|
||||
public iksm_session: string,
|
||||
@@ -46,7 +49,7 @@ export default class SplatNet2Api {
|
||||
throw new ErrorResponse('[splatnet2] Unknown error', response, await response.text());
|
||||
}
|
||||
|
||||
updateIksmSessionLastUsed(this.iksm_session);
|
||||
updateIksmSessionLastUsed.handler?.call(null, this.iksm_session);
|
||||
|
||||
const data = await response.json() as T | WebServiceError;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ErrorResponse } from './util.js';
|
||||
import ZncApi from './znc.js';
|
||||
import { version } from '../util.js';
|
||||
import { NintendoAccountUser } from './na.js';
|
||||
import { SavedToken } from '../cli/nso/util.js';
|
||||
import { SavedToken } from '../common/auth/nso.js';
|
||||
|
||||
const debug = createDebug('nxapi:api:znc-proxy');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user