diff --git a/src/app.ts b/src/app.ts index 4d5e9e6..4e709be 100644 --- a/src/app.ts +++ b/src/app.ts @@ -9,6 +9,7 @@ import { FileExporter } from "./exporters/file.ts"; import { delay, showError } from "./utils.ts"; import { GameFetcher } from "./GameFetcher.ts"; import { DEFAULT_ENV, Env } from "./env.ts"; +import { SplashcatExporter } from "./exporters/splashcat.ts"; export type Opts = { profilePath: string; @@ -220,6 +221,29 @@ export class App { out.push(new FileExporter(state.fileExportPath)); } + if (exporters.includes("splashcat")) { + if (!state.splashcatApiKey) { + const key = (await this.env.prompts.prompt( + "Splashcat API key is not set. Please enter below.", + )).trim(); + if (!key) { + this.env.logger.error("API key is required."); + Deno.exit(1); + } + await this.profile.writeState({ + ...state, + splashcatApiKey: key, + }); + } + out.push( + new SplashcatExporter({ + splashcatApiKey: this.profile.state.splashcatApiKey!, + uploadMode: this.opts.monitor ? "Monitoring" : "Manual", + env: this.env, + }), + ); + } + return out; } exporterProgress(title: string) { diff --git a/src/state.ts b/src/state.ts index 7ddeb6f..cf9a213 100644 --- a/src/state.ts +++ b/src/state.ts @@ -30,6 +30,7 @@ export type State = { statInkApiKey?: string; fileExportPath: string; monitorInterval: number; + splashcatApiKey?: string; }; export const DEFAULT_STATE: State = {