feat: Implemented download page for downloading roms from various sources using plugins. Added support for internet archive external plugin. feat: Added tasks page to track running tasks/downloads feat: Added tanstack caching feat: Added quick play action Fixes #6 feat: Added quick emulator launch action fix: Made task queue only support 1 task per group and task ID should now be unique
49 lines
No EOL
1.9 KiB
TypeScript
49 lines
No EOL
1.9 KiB
TypeScript
import { AsyncSeriesBailHook } from "tapable";
|
|
import AuthHooks from "./auth";
|
|
import EmulatorHooks from "./emulators";
|
|
import GameHooks from "./games";
|
|
import StoreHooks from "./store";
|
|
import { DownloadFileEntry, ProgressStats } from "../shared";
|
|
|
|
export class GameflowHooks
|
|
{
|
|
games = new GameHooks();
|
|
emulators = new EmulatorHooks();
|
|
auth = new AuthHooks();
|
|
store = new StoreHooks();
|
|
/** Download the given files and return their final paths. */
|
|
downloadFiles = new AsyncSeriesBailHook<[ctx: {
|
|
/** Unique ID of the download */
|
|
id: string,
|
|
/** The root download path. Each file has it's own download sub path */
|
|
downloadPath: string,
|
|
abortSignal?: AbortSignal,
|
|
/** Authentication needed for download. Should be put in the headers. */
|
|
auth?: string,
|
|
/** The files to download */
|
|
files: DownloadFileEntry[];
|
|
/** Call it to update progress in the UI */
|
|
updateProgress: (stats: ProgressStats) => void;
|
|
|
|
}], {
|
|
/** What downloaded the files. Will be passed to {@link postDownloadFiles} files hook. */
|
|
source: string,
|
|
/** The file paths ot the downloaded files. */
|
|
files: string[];
|
|
} | undefined>(['ctx']);
|
|
/** Called after {@link downloadFiles} has finished downloading.
|
|
* @returns The modified file paths.
|
|
*/
|
|
postDownloadFiles = new AsyncSeriesBailHook<[ctx: {
|
|
/** Who downloaded the files. Passed from the {@link downloadFiles} hook. */
|
|
source: string;
|
|
/** Can be directories or files */
|
|
files: string[];
|
|
/** The root downloads folder. */
|
|
downloadPath: string,
|
|
/** The sub path where the archive should be extracted to. This will be a sub path of `path_fs` */
|
|
extract_path?: string;
|
|
/** This is the parent path for the extracted files. */
|
|
path_fs?: string;
|
|
}], string[] | undefined>(['ctx']);
|
|
} |