Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/AccountSidebar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="flex grow flex-col gap-y-5 overflow-y-auto px-6 py-4">
<span class="inline-flex items-center gap-x-2 font-semibold text-zinc-100">
<UserIcon class="size-5" /> {{ $t("account.settings") }}
<UserIcon class="size-5" /> {{ $t("account.title") }}
</span>
<nav class="flex flex-1 flex-col">
<ul role="list" class="flex flex-1 flex-col gap-y-7">
Expand Down Expand Up @@ -74,7 +74,7 @@ const navigation: (NavigationItem & { icon: Component; count?: number })[] = [
count: notifications.value.length,
},
{
label: t("settings"),
label: t("account.settings"),
route: "/account/settings",
prefix: "/account/settings",
icon: WrenchScrewdriverIcon,
Expand Down
4 changes: 1 addition & 3 deletions components/NewsDirectory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@
:src="useObject(article.imageObjectId)"
class="absolute blur-sm inset-0 w-full h-full object-cover transition-all duration-200 group-hover:scale-110"
/>
<div
class="absolute inset-0 bg-gradient-to-b from-transparent to-zinc-800 transition-all duration-200"
/>
<div class="absolute inset-0 bg-zinc-900/50" />
</div>

<h3 class="relative text-sm font-medium text-zinc-100">
Expand Down
4 changes: 2 additions & 2 deletions components/RelativeTime.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="relative inline-block group">
<div class="relative inline-block group/relative-time">
<!-- Visible relative time -->
<time :datetime="isoDate" class="text-sm text-muted-foreground">
{{ DateTime.fromJSDate(date).toRelative({ locale: $i18n.locale }) }}
Expand All @@ -8,7 +8,7 @@
<!-- Custom tooltip that shows on hover -->
<div
role="tooltip"
class="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 rounded bg-zinc-900 text-white text-xs whitespace-nowrap shadow z-10 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"
class="absolute bottom-full left-1/2 -translate-x-1/2 mb-1 px-2 py-1 rounded bg-zinc-900 text-white text-xs whitespace-nowrap shadow z-10 opacity-0 group-hover/relative-time:opacity-100 transition-opacity pointer-events-none"
aria-hidden="true"
>
{{ $d(date, "long") }}
Expand Down
4 changes: 2 additions & 2 deletions i18n/locales/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"title": "Notifications",
"unread": "Unread Notifications"
},
"settings": "Account Settings",
"title": "Account"
"settings": "Settings",
"title": "Account Settings"
},
"actions": "Actions",
"adminTitle": "Admin Dashboard | Drop",
Expand Down
18 changes: 10 additions & 8 deletions pages/account/notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@
{{ notification.description }}
</p>
<div class="mt-4 flex flex-wrap gap-2">
<a
v-for="action in notification.actions"
:key="action"
:href="action.split('|')[1]"
<NuxtLink
v-for="[name, href] in notification.actions.map((v) =>
v.split('|'),
)"
:key="href"
:href="href"
class="inline-flex items-center rounded-md bg-blue-400/10 px-2 py-1 text-xs font-medium text-blue-400 ring-1 ring-inset ring-blue-400/20 transition-all duration-200 hover:bg-blue-400/20 hover:scale-105 active:scale-95"
>
{{ action.split("|")[0] }}
</a>
{{ name }}
</NuxtLink>
</div>
</div>
<div class="ml-4 flex flex-shrink-0 items-center gap-x-2">
Expand All @@ -57,15 +59,15 @@
<button
v-if="!notification.read"
type="button"
class="inline-flex items-center rounded-md bg-zinc-400/10 px-2 py-1 text-xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-400/20 transition-all duration-200 hover:bg-zinc-400/20 hover:scale-105 active:scale-95"
class="inline-flex gap-x-1 items-center rounded-md bg-zinc-400/10 px-2 py-1 text-xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-400/20 transition-all duration-200 hover:bg-zinc-400/20 hover:scale-105 active:scale-95"
@click="markAsRead(notification.id)"
>
<CheckIcon class="size-3" />
{{ $t("account.notifications.markAsRead") }}
</button>
<button
type="button"
class="inline-flex items-center rounded-md bg-red-400/10 px-2 py-1 text-xs font-medium text-red-400 ring-1 ring-inset ring-red-400/20 transition-all duration-200 hover:bg-red-400/20 hover:scale-105 active:scale-95"
class="inline-flex gap-x-1 items-center rounded-md bg-red-400/10 px-2 py-1 text-xs font-medium text-red-400 ring-1 ring-inset ring-red-400/20 transition-all duration-200 hover:bg-red-400/20 hover:scale-105 active:scale-95"
@click="deleteNotification(notification.id)"
>
<TrashIcon class="size-3" />
Expand Down
2 changes: 1 addition & 1 deletion pages/news.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>

<div class="px-4 py-10 sm:px-6 lg:px-8 lg:py-6 grow">
<NuxtPage />
<NuxtPage :articles="news" />
</div>
</div>
</template>
Expand Down
18 changes: 8 additions & 10 deletions pages/news/[id]/index.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div>
<div v-if="article" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div v-if="article" class="px-4 sm:px-6 lg:px-8">
<!-- Banner header with blurred background -->
<div class="relative w-full h-[300px] mb-8 rounded-lg overflow-hidden">
<div v-if="article.imageObjectId" class="absolute inset-0">
<div class="absolute inset-0">
<img
:src="useObject(article.imageObjectId)"
:src="
article.imageObjectId
? useObject(article.imageObjectId)
: '/wallpapers/news-placeholder.jpg'
"
alt=""
class="w-full h-full object-cover blur-sm scale-110"
/>
<div
class="absolute inset-0 bg-gradient-to-b from-transparent to-zinc-950"
/>
</div>
<div v-else>
<!-- Fallback gradient background when no image -->
<div
class="absolute inset-0 bg-gradient-to-b from-zinc-800 to-zinc-900"
/>
</div>

<div class="relative h-full flex flex-col justify-end p-8">
<div class="flex items-center gap-x-3 mb-6">
Expand Down Expand Up @@ -73,7 +71,7 @@

<!-- Article content - markdown -->
<div
class="mx-auto prose prose-invert prose-lg"
class="mx-auto prose prose-blue prose-invert prose-lg"
v-html="renderedContent"
/>
</div>
Expand Down
15 changes: 11 additions & 4 deletions pages/news/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="flex flex-col max-w-4xl mx-auto">
<div class="flex flex-col px-8">
<div class="mb-8">
<div class="flex flex-col gap-y-4">
<div>
Expand All @@ -14,7 +14,11 @@
</div>

<!-- Articles list -->
<TransitionGroup name="article-list" tag="div" class="space-y-6">
<TransitionGroup
name="article-list"
tag="div"
class="gap-6 grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5"
>
<NuxtLink
v-for="article in articles"
:key="article.id"
Expand All @@ -26,8 +30,11 @@
>
<div class="relative h-48 w-full overflow-hidden">
<img
v-if="article.imageObjectId"
:src="useObject(article.imageObjectId)"
:src="
article.imageObjectId
? useObject(article.imageObjectId)
: '/wallpapers/news-placeholder.jpg'
"
alt=""
class="h-full w-full object-cover object-center transition-all duration-500 group-hover:scale-110 scale-105"
/>
Expand Down
Binary file added public/wallpapers/news-placeholder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion server/api/v1/admin/news/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default defineEventHandler(async (h3) => {

tags: parsedTags,

...(imageId && { image: imageId }),
...(imageId && { imageObjectId: imageId }),
authorId: "system",
});

Expand Down
10 changes: 5 additions & 5 deletions server/internal/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ class LibraryManager {
}> = [];

const files = await library.versionReaddir(game.libraryPath, versionName);
for (const file of files) {
const filename = path.basename(file);
const dotLocation = file.lastIndexOf(".");
const ext = dotLocation == -1 ? "" : file.slice(dotLocation);
for (const filename of files) {
const basename = path.basename(filename);
const dotLocation = filename.lastIndexOf(".");
const ext = dotLocation == -1 ? "" : filename.slice(dotLocation);
for (const [platform, checkExts] of Object.entries(fileExts)) {
for (const checkExt of checkExts) {
if (checkExt != ext) continue;
const fuzzyValue = fuzzy(filename, game.mName);
const fuzzyValue = fuzzy(basename, game.mName);
options.push({
filename,
platform,
Expand Down
17 changes: 9 additions & 8 deletions server/internal/metadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export class MetadataHandler {
{},
["internal:read"],
wrapTaskContext(context, {
min: 63,
max: 100,
min: 60,
max: 95,
prefix: "[object import] ",
}),
);
Expand Down Expand Up @@ -227,6 +227,13 @@ export class MetadataHandler {

context?.progress(60);

logger.info(`Successfully fetched all metadata.`);
logger.info(`Importing objects...`);

await pullObjects();

progress(95);

await prisma.game.create({
data: {
id: gameId,
Expand Down Expand Up @@ -262,12 +269,6 @@ export class MetadataHandler {
},
});

progress(63);
logger.info(`Successfully fetched all metadata.`);
logger.info(`Importing objects...`);

await pullObjects();

logger.info(`Finished game import.`);
},
});
Expand Down
4 changes: 2 additions & 2 deletions server/internal/news/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class NewsManager {
description: string;
tags: string[];
authorId: string;
image?: string;
imageObjectId?: string;
}) {
return await prisma.article.create({
data: {
Expand All @@ -23,7 +23,7 @@ class NewsManager {
})),
},

...(data.image && { image: data.image }),
...(data.imageObjectId && { imageObjectId: data.imageObjectId }),
author: {
connect: {
id: data.authorId,
Expand Down
46 changes: 3 additions & 43 deletions server/internal/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TaskHandler {
this.taskCreators.set(task.taskGroup, task.build);
}

create(task: Task) {
async create(task: Task) {
let updateCollectTimeout: NodeJS.Timeout | undefined;
let updateCollectResolves: Array<(value: unknown) => void> = [];
let logOffset: number = 0;
Expand Down Expand Up @@ -131,44 +131,6 @@ class TaskHandler {

const taskPool = this.taskPool;

// Create a pino transport that replicates the old log function behavior
// const taskLogger = pino({
// hooks: {
// logMethod(args, method) {
// // Combine all arguments into a single string message
// const message = args.map(String).join(" ");
// const now = new Date();

// const pad = (n: number, width = 2) =>
// n.toString().padStart(width, "0");

// const year = now.getUTCFullYear();
// const month = pad(now.getUTCMonth() + 1);
// const day = pad(now.getUTCDate());

// const hours = pad(now.getUTCHours());
// const minutes = pad(now.getUTCMinutes());
// const seconds = pad(now.getUTCSeconds());
// const milliseconds = pad(now.getUTCMilliseconds(), 3);

// const logObj = {
// timestamp: `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds} UTC`,
// message,
// };

// // Push the formatted log string to the task's log array
// const taskEntry = taskPool.get(task.id);
// if (taskEntry) {
// taskEntry.log.push(JSON.stringify(logObj));
// updateAllClients();
// }

// // Optionally, still call the original method if you want logs elsewhere
// method.apply(this, args);
// },
// },
// });

// Custom writable stream to capture logs
const logStream = new Writable({
objectMode: true,
Expand Down Expand Up @@ -227,7 +189,7 @@ class TaskHandler {
endTime: undefined,
});

updateAllClients(true);
await updateAllClients(true);

droplet.callAltThreadFunc(async () => {
const taskEntry = this.taskPool.get(task.id);
Expand Down Expand Up @@ -267,9 +229,7 @@ class TaskHandler {

acls: taskEntry.acls,

...(taskEntry.error
? { error: JSON.stringify(taskEntry.error) }
: undefined),
...(taskEntry.error ? { error: taskEntry.error } : undefined),
},
});

Expand Down