mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-04-25 23:37:43 -05:00
Support running data updaters without all region tokens
This commit is contained in:
parent
7689ef7bdc
commit
0e4812079f
|
|
@ -34,7 +34,7 @@ export default class ImageProcessor
|
|||
}
|
||||
|
||||
publicUrl(file) {
|
||||
return `${this.siteUrl}/${this.outputDirectory}/${file}`;
|
||||
return `${this.siteUrl ?? ''}/${this.outputDirectory}/${file}`;
|
||||
}
|
||||
|
||||
async exists(file) {
|
||||
|
|
|
|||
|
|
@ -3,21 +3,24 @@ import StageScheduleUpdater from "./updaters/StageScheduleUpdater.mjs";
|
|||
import CoopUpdater from "./updaters/CoopUpdater.mjs";
|
||||
import FestivalUpdater from "./updaters/FestivalUpdater.mjs";
|
||||
import CurrentFestivalUpdater from "./updaters/CurrentFestivalUpdater.mjs";
|
||||
import { regionTokens } from "../splatnet/NsoClient.mjs";
|
||||
|
||||
function updaters() {
|
||||
const tokens = regionTokens();
|
||||
|
||||
return [
|
||||
new StageScheduleUpdater,
|
||||
new GearUpdater,
|
||||
new CoopUpdater,
|
||||
new FestivalUpdater('US'),
|
||||
new FestivalUpdater('EU'),
|
||||
new FestivalUpdater('JP'),
|
||||
new FestivalUpdater('AP'),
|
||||
new CurrentFestivalUpdater('US'),
|
||||
new CurrentFestivalUpdater('EU'),
|
||||
new CurrentFestivalUpdater('JP'),
|
||||
new CurrentFestivalUpdater('AP'),
|
||||
];
|
||||
tokens.US && new FestivalUpdater('US'),
|
||||
tokens.EU && new FestivalUpdater('EU'),
|
||||
tokens.JP && new FestivalUpdater('JP'),
|
||||
tokens.AP && new FestivalUpdater('AP'),
|
||||
tokens.US && new CurrentFestivalUpdater('US'),
|
||||
tokens.EU && new CurrentFestivalUpdater('EU'),
|
||||
tokens.JP && new CurrentFestivalUpdater('JP'),
|
||||
tokens.AP && new CurrentFestivalUpdater('AP'),
|
||||
].filter(u => u);
|
||||
}
|
||||
|
||||
export async function updateAll() {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,14 @@ export function regionTokens() {
|
|||
};
|
||||
}
|
||||
|
||||
function getDefaultRegion() {
|
||||
for (const [region, token] of Object.entries(regionTokens())) {
|
||||
if (token) return region;
|
||||
}
|
||||
|
||||
throw new Error('Session token not set for any region');
|
||||
}
|
||||
|
||||
export default class NsoClient
|
||||
{
|
||||
constructor(region, nintendoToken) {
|
||||
|
|
@ -33,7 +41,7 @@ export default class NsoClient
|
|||
}
|
||||
|
||||
static make(region = null) {
|
||||
region ??= 'US';
|
||||
region ??= getDefaultRegion();
|
||||
let tokens = regionTokens();
|
||||
|
||||
if (!Object.keys(tokens).includes(region)) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,12 @@ import SplatNet3Client, { SPLATNET3_WEB_SERVICE_ID } from "./SplatNet3Client.mjs
|
|||
export async function warmCaches() {
|
||||
console.info('Warming caches...');
|
||||
|
||||
for (let region of Object.keys(regionTokens())) {
|
||||
for (let [region, token] of Object.entries(regionTokens())) {
|
||||
if (!token) {
|
||||
console.warn('Session token not set for region %s', region);
|
||||
continue;
|
||||
}
|
||||
|
||||
await warmCache(region);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user