mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
Fix for downloads and removing of library source (#136)
* fix: downloads and removing library source * fix: linting
This commit is contained in:
@ -217,8 +217,6 @@ const searchQuery = ref("");
|
|||||||
|
|
||||||
const libraryState = await $dropFetch("/api/v1/admin/library");
|
const libraryState = await $dropFetch("/api/v1/admin/library");
|
||||||
|
|
||||||
console.log(Object.values(libraryState.unimportedGames));
|
|
||||||
|
|
||||||
const toImport = ref(
|
const toImport = ref(
|
||||||
Object.values(libraryState.unimportedGames).flat().length > 0,
|
Object.values(libraryState.unimportedGames).flat().length > 0,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { type } from "arktype";
|
|||||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
import libraryManager from "~/server/internal/library";
|
||||||
|
|
||||||
const DeleteLibrarySource = type({
|
const DeleteLibrarySource = type({
|
||||||
id: "string",
|
id: "string",
|
||||||
@ -16,10 +17,12 @@ export default defineEventHandler<{ body: typeof DeleteLibrarySource.infer }>(
|
|||||||
|
|
||||||
const body = await readDropValidatedBody(h3, DeleteLibrarySource);
|
const body = await readDropValidatedBody(h3, DeleteLibrarySource);
|
||||||
|
|
||||||
return await prisma.library.delete({
|
await prisma.library.delete({
|
||||||
where: {
|
where: {
|
||||||
id: body.id,
|
id: body.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
libraryManager.removeLibrary(body.id);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -71,8 +71,8 @@ export default defineClientEventHandler(async (h3) => {
|
|||||||
game.libraryPath,
|
game.libraryPath,
|
||||||
versionName,
|
versionName,
|
||||||
filename,
|
filename,
|
||||||
{ start, end: end - 1 },
|
{ start, end },
|
||||||
); // end needs to be offset by 1
|
);
|
||||||
if (!gameReadStream)
|
if (!gameReadStream)
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
|
|||||||
Reference in New Issue
Block a user