mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 04:11:32 +10:00
fix: various fixes
This commit is contained in:
+3
-7
@@ -2,17 +2,13 @@ import tailwindcss from "@tailwindcss/vite";
|
|||||||
import { execSync } from "node:child_process";
|
import { execSync } from "node:child_process";
|
||||||
|
|
||||||
// get drop version
|
// get drop version
|
||||||
const dropVersion =
|
const dropVersion = process.env.BUILD_DROP_VERSION ?? "v0.3.0-alpha.1";
|
||||||
process.env.BUILD_DROP_VERSION === undefined
|
|
||||||
? "v0.3.0-alpha.1"
|
|
||||||
: process.env.BUILD_DROP_VERSION;
|
|
||||||
// example nightly: "v0.3.0-nightly.2025.05.28"
|
// example nightly: "v0.3.0-nightly.2025.05.28"
|
||||||
|
|
||||||
// get git ref or supply during build
|
// get git ref or supply during build
|
||||||
const commitHash =
|
const commitHash =
|
||||||
process.env.BUILD_GIT_REF === undefined
|
process.env.BUILD_GIT_REF ??
|
||||||
? execSync("git rev-parse --short HEAD").toString().trim()
|
execSync("git rev-parse --short HEAD").toString().trim();
|
||||||
: process.env.BUILD_GIT_REF;
|
|
||||||
|
|
||||||
console.log(`Building Drop ${dropVersion} #${commitHash}`);
|
console.log(`Building Drop ${dropVersion} #${commitHash}`);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
class="flex flex-col lg:flex-row lg:justify-between items-start lg:items-center gap-2"
|
class="flex flex-col lg:flex-row lg:justify-between items-start lg:items-center gap-2"
|
||||||
>
|
>
|
||||||
<div class="inline-flex items-center gap-4">
|
<div class="inline-flex items-center gap-4">
|
||||||
<!-- cover image -->
|
<!-- icon image -->
|
||||||
<img :src="coreMetadataIconUrl" class="size-20" />
|
<img :src="coreMetadataIconUrl" class="size-20" />
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-5xl font-bold font-display text-zinc-100">
|
<h1 class="text-5xl font-bold font-display text-zinc-100">
|
||||||
|
|||||||
@@ -28,24 +28,32 @@ export default defineEventHandler(async (h3) => {
|
|||||||
const description = options.description;
|
const description = options.description;
|
||||||
const gameId = options.id;
|
const gameId = options.id;
|
||||||
|
|
||||||
const changes: Prisma.GameUpdateInput = {
|
const updateModel: Prisma.GameUpdateInput = {
|
||||||
mName: name,
|
mName: name,
|
||||||
mShortDescription: description,
|
mShortDescription: description,
|
||||||
};
|
};
|
||||||
|
|
||||||
// handle if user uploaded new icon
|
// handle if user uploaded new icon
|
||||||
if (id) {
|
if (id) {
|
||||||
changes.mIconObjectId = id;
|
updateModel.mIconObjectId = id;
|
||||||
await pull();
|
await pull();
|
||||||
} else {
|
} else {
|
||||||
dump();
|
dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the API call doesn't provide values, don't set them
|
||||||
|
for (const [key, value] of Object.entries(updateModel)) {
|
||||||
|
if (value === undefined) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||||
|
delete updateModel[key as keyof typeof updateModel];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const newObject = await prisma.game.update({
|
const newObject = await prisma.game.update({
|
||||||
where: {
|
where: {
|
||||||
id: gameId,
|
id: gameId,
|
||||||
},
|
},
|
||||||
data: changes,
|
data: updateModel,
|
||||||
});
|
});
|
||||||
|
|
||||||
return newObject;
|
return newObject;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default defineEventHandler(async (h3) => {
|
|||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
});
|
});
|
||||||
else if (result.userId !== userId)
|
if (result.userId !== userId)
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default defineEventHandler(async (h3) => {
|
|||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
});
|
});
|
||||||
else if (result.userId !== userId)
|
if (result.userId !== userId)
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -234,7 +234,6 @@ export class MetadataHandler {
|
|||||||
libraryBasePath,
|
libraryBasePath,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// relate companies to game
|
|
||||||
|
|
||||||
await pullObjects();
|
await pullObjects();
|
||||||
|
|
||||||
|
|||||||
@@ -53,11 +53,12 @@ class ScreenshotManager {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
async delete(id: string) {
|
async delete(id: string) {
|
||||||
await prisma.screenshot.delete({
|
const deletedScreenshot = await prisma.screenshot.delete({
|
||||||
where: {
|
where: {
|
||||||
id,
|
id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
await objectHandler.deleteAsSystem(deletedScreenshot.objectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +75,7 @@ class ScreenshotManager {
|
|||||||
// TODO: set createAt to the time screenshot was taken
|
// TODO: set createAt to the time screenshot was taken
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
[`${userId}:read`, `${userId}:delete`],
|
[`${userId}:read`], // This is a system tracked object, so we don't want users to have direct write access to it
|
||||||
);
|
);
|
||||||
if (!saveStream)
|
if (!saveStream)
|
||||||
throw createError({
|
throw createError({
|
||||||
|
|||||||
Reference in New Issue
Block a user