Add UI for multi-library management #59 (#63)

* feat: add ui for library source management

* fix: lint
This commit is contained in:
DecDuck
2025-06-01 18:33:42 +10:00
committed by GitHub
parent 792eea9c1b
commit f8dc4d0578
12 changed files with 625 additions and 15 deletions
@@ -49,6 +49,11 @@ export const systemACLDescriptions: ObjectFromList<typeof systemACLs> = {
"auth:simple:invitation:delete": "Delete a simple auth invitation.",
"library:read": "Fetch a list of all games on this instance.",
"library:sources:read":
"Fetch a list of all library sources on this instance",
"library:sources:new": "Create a new library source.",
"library:sources:update": "Update existing library sources.",
"library:sources:delete": "Delete library sources.",
"notifications:read": "Read system notifications.",
"notifications:mark": "Mark system notifications as read.",
+5
View File
@@ -50,6 +50,11 @@ export const systemACLs = [
"notifications:delete",
"library:read",
"library:sources:read",
"library:sources:new",
"library:sources:update",
"library:sources:delete",
"game:read",
"game:update",
"game:delete",
+3 -1
View File
@@ -30,7 +30,9 @@ export class FilesystemProvider
this.myId = id;
this.config = config;
fs.mkdirSync(this.config.baseDir, { recursive: true });
if (!fs.existsSync(this.config.baseDir))
throw "Base directory does not exist.";
}
id(): string {
+13
View File
@@ -20,6 +20,19 @@ class LibraryManager {
this.libraries.set(library.id(), library);
}
removeLibrary(id: string) {
this.libraries.delete(id);
}
async fetchLibraries() {
const libraries = await prisma.library.findMany({});
const libraryWithMetadata = libraries.map((e) => ({
...e,
working: this.libraries.has(e.id),
}));
return libraryWithMetadata;
}
async fetchAllUnimportedGames() {
const unimportedGames: { [key: string]: string[] } = {};