feat: import redists

This commit is contained in:
DecDuck
2025-08-22 13:48:47 +10:00
parent 322af0b4ca
commit f1957a418c
22 changed files with 715 additions and 806 deletions

View File

@ -84,6 +84,8 @@ export const systemACLDescriptions: ObjectFromList<typeof systemACLs> = {
"import:game:read":
"Fetch games to be imported, and search the metadata for games.",
"import:game:new": "Import a game.",
"import:redist:read": "Fetch redists to be imported.",
"import:redist:new": "Import a redist.",
"tags:read": "Fetch all tags",
"tags:create": "Create a tag",

View File

@ -74,9 +74,10 @@ export const systemACLs = [
"import:version:read",
"import:version:new",
"import:game:read",
"import:game:new",
"import:redist:read",
"import:redist:new",
"user:read",
"user:delete",

View File

@ -336,7 +336,7 @@ class LibraryManager {
nonce: `version-create-${gameId}-${versionPath}`,
title: `'${game.mName}' ('${versionPath}') finished importing.`,
description: `Drop finished importing version ${versionPath} for ${game.mName}.`,
actions: [`View|/admin/library/${gameId}`],
actions: [`View|/admin/library/g/${gameId}`],
acls: ["system:import:version:read"],
});

View File

@ -1,5 +1,5 @@
import type { EventHandlerRequest, H3Event } from "h3";
import type { Dump, Pull } from "../objects/transactional";
import type { Dump, Pull, Register } from "../objects/transactional";
import { ObjectTransactionalHandler } from "../objects/transactional";
export async function handleFileUpload(
@ -7,7 +7,7 @@ export async function handleFileUpload(
metadata: { [key: string]: string },
permissions: Array<string>,
max = -1,
): Promise<[string[], { [key: string]: string }, Pull, Dump] | undefined> {
): Promise<[string[], { [key: string]: string }, Pull, Dump, Register] | undefined> {
const formData = await readMultipartFormData(h3);
if (!formData) return undefined;
const transactionalHandler = new ObjectTransactionalHandler();
@ -28,5 +28,5 @@ export async function handleFileUpload(
options[entry.name] = entry.data.toString("utf-8");
}
return [ids, options, pull, dump];
return [ids, options, pull, dump, add];
}