mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
* First iteration on the new PieChart component * #128 Adds new admin home page * Fixes code after merging conflicts * Removes empty file * Uses real data for admin home page, and improves style * Reverts debugging code * Defines missing variable * Caches user stats data for admin home page * Typo * Styles improvements * Invalidates cache on signup/signin * Implements top 5 biggest games * Improves styling * Improves style * Using generateManifest to get the proper size * Reading data from cache * Removes unnecessary import * Improves caching mechanism for game sizes * Removes lint errors * Replaces piechart tooltip with colors in legend * Fixes caching * Fixes caching and slight improvement on pie chart colours * Fixes a few bugs related to caching * Fixes bug where app signin didn't refresh cache * feat: style improvements * fix: lint --------- Co-authored-by: DecDuck <declanahofmeyr@gmail.com>
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import type { LibraryBackend } from "~/prisma/client/enums";
|
|
|
|
export abstract class LibraryProvider<CFG> {
|
|
constructor(_config: CFG, _id: string) {
|
|
throw new Error("Library doesn't have a proper constructor");
|
|
}
|
|
|
|
/**
|
|
* @returns ID of the current library provider (fs, smb, s3, etc)
|
|
*/
|
|
abstract type(): LibraryBackend;
|
|
|
|
/**
|
|
* @returns the specific ID of this current provider
|
|
*/
|
|
abstract id(): string;
|
|
|
|
/**
|
|
* @returns list of (usually) top-level game folder names
|
|
*/
|
|
abstract listGames(): Promise<string[]>;
|
|
|
|
/**
|
|
* @param game folder name of the game to list versions for
|
|
* @returns list of version folder names
|
|
*/
|
|
abstract listVersions(game: string): Promise<string[]>;
|
|
|
|
/**
|
|
* @param game folder name of the game
|
|
* @param version folder name of the version
|
|
* @returns recursive list of all files in version, relative to the version folder (e.g. ./setup.exe)
|
|
*/
|
|
abstract versionReaddir(game: string, version: string): Promise<string[]>;
|
|
|
|
/**
|
|
* @param game folder name of the game
|
|
* @param version folder name of the version
|
|
* @returns string of JSON of the droplet manifest
|
|
*/
|
|
abstract generateDropletManifest(
|
|
game: string,
|
|
version: string,
|
|
progress: (err: Error | null, v: number) => void,
|
|
log: (err: Error | null, v: string) => void,
|
|
): Promise<string>;
|
|
|
|
abstract peekFile(
|
|
game: string,
|
|
version: string,
|
|
filename: string,
|
|
): Promise<{ size: number } | undefined>;
|
|
|
|
abstract readFile(
|
|
game: string,
|
|
version: string,
|
|
filename: string,
|
|
options?: { start?: number; end?: number },
|
|
): Promise<ReadableStream | undefined>;
|
|
|
|
abstract fsStats(): { freeSpace: number; totalSpace: number } | undefined;
|
|
}
|
|
|
|
export class GameNotFoundError extends Error {}
|
|
export class VersionNotFoundError extends Error {}
|