From 3cdf3616f6c79f5f53d52c8b63d7fa26e35aacb7 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 18 Jul 2025 22:30:31 +1000 Subject: [PATCH 1/8] fix: save task as Json rather than string --- server/internal/tasks/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/internal/tasks/index.ts b/server/internal/tasks/index.ts index 0a644998..99f1a113 100644 --- a/server/internal/tasks/index.ts +++ b/server/internal/tasks/index.ts @@ -268,7 +268,7 @@ class TaskHandler { acls: taskEntry.acls, ...(taskEntry.error - ? { error: JSON.stringify(taskEntry.error) } + ? { error: taskEntry.error } : undefined), }, }); From c55682ed74ae4f5c3dcc99d841cbf8fcdd67f951 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 18 Jul 2025 22:30:56 +1000 Subject: [PATCH 2/8] fix: pull objects before creating game in database --- server/internal/metadata/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/internal/metadata/index.ts b/server/internal/metadata/index.ts index 1bb3b1d5..dfe77cee 100644 --- a/server/internal/metadata/index.ts +++ b/server/internal/metadata/index.ts @@ -197,8 +197,8 @@ export class MetadataHandler { {}, ["internal:read"], wrapTaskContext(context, { - min: 63, - max: 100, + min: 60, + max: 95, prefix: "[object import] ", }), ); @@ -227,6 +227,14 @@ 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, @@ -262,12 +270,6 @@ export class MetadataHandler { }, }); - progress(63); - logger.info(`Successfully fetched all metadata.`); - logger.info(`Importing objects...`); - - await pullObjects(); - logger.info(`Finished game import.`); }, }); From 553aabcbeb9bebc0ed8a8bc23216110e33349c38 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 18 Jul 2025 22:46:19 +1000 Subject: [PATCH 3/8] fix: strips relative dirs from version information --- server/internal/library/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/internal/library/index.ts b/server/internal/library/index.ts index d9e563ad..75a1140f 100644 --- a/server/internal/library/index.ts +++ b/server/internal/library/index.ts @@ -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, From 183e35c266c934b8c37f1a35ca5e8eef5649a848 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 18 Jul 2025 23:53:05 +1000 Subject: [PATCH 4/8] fix: #132 --- server/internal/tasks/index.ts | 42 ++-------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/server/internal/tasks/index.ts b/server/internal/tasks/index.ts index 99f1a113..f5f29e4f 100644 --- a/server/internal/tasks/index.ts +++ b/server/internal/tasks/index.ts @@ -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; @@ -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, @@ -227,7 +189,7 @@ class TaskHandler { endTime: undefined, }); - updateAllClients(true); + await updateAllClients(true); droplet.callAltThreadFunc(async () => { const taskEntry = this.taskPool.get(task.id); From b8a633b9daa9fb2e4f353f27b55bae692a7ab50b Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 18 Jul 2025 23:56:38 +1000 Subject: [PATCH 5/8] fix: lint --- server/internal/metadata/index.ts | 1 - server/internal/tasks/index.ts | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/server/internal/metadata/index.ts b/server/internal/metadata/index.ts index dfe77cee..2dbffe48 100644 --- a/server/internal/metadata/index.ts +++ b/server/internal/metadata/index.ts @@ -227,7 +227,6 @@ export class MetadataHandler { context?.progress(60); - logger.info(`Successfully fetched all metadata.`); logger.info(`Importing objects...`); diff --git a/server/internal/tasks/index.ts b/server/internal/tasks/index.ts index f5f29e4f..44d8ef41 100644 --- a/server/internal/tasks/index.ts +++ b/server/internal/tasks/index.ts @@ -229,9 +229,7 @@ class TaskHandler { acls: taskEntry.acls, - ...(taskEntry.error - ? { error: taskEntry.error } - : undefined), + ...(taskEntry.error ? { error: taskEntry.error } : undefined), }, }); From 7e89e5030c3e171fab3b5f473e82528188195e0c Mon Sep 17 00:00:00 2001 From: DecDuck Date: Sun, 20 Jul 2025 13:35:31 +1000 Subject: [PATCH 6/8] fix: news object ids and small tweaks --- components/NewsDirectory.vue | 2 +- pages/news.vue | 2 +- pages/news/[id]/index.vue | 14 ++++---------- pages/news/index.vue | 7 +++---- public/wallpapers/news-placeholder.jpg | Bin 0 -> 2008762 bytes server/api/v1/admin/news/index.post.ts | 4 ++-- server/internal/news/index.ts | 4 ++-- 7 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 public/wallpapers/news-placeholder.jpg diff --git a/components/NewsDirectory.vue b/components/NewsDirectory.vue index 6c0ea5a9..6ac68bf8 100644 --- a/components/NewsDirectory.vue +++ b/components/NewsDirectory.vue @@ -92,7 +92,7 @@ class="absolute blur-sm inset-0 w-full h-full object-cover transition-all duration-200 group-hover:scale-110" />
diff --git a/pages/news.vue b/pages/news.vue index 4f47c30f..110ea65b 100644 --- a/pages/news.vue +++ b/pages/news.vue @@ -86,7 +86,7 @@
- +
diff --git a/pages/news/[id]/index.vue b/pages/news/[id]/index.vue index 37559ce3..ec8bf608 100644 --- a/pages/news/[id]/index.vue +++ b/pages/news/[id]/index.vue @@ -1,12 +1,12 @@