From c03152f299c80d3e19281a0ec34bf563be8fe065 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Sun, 30 Nov 2025 23:01:52 +1100 Subject: [PATCH] Internal server error fixes, 7z fixes, OIDC fixes (#289) * fix: add no-prisma-delete lint * fix: typescript for lint * fix: bump droplet * fix: oidc scopes override * fix: type errors * feat: delete all notifications * fix: lint * fix: light mode style fixes --- components/NotificationItem.vue | 5 +- .../UserHeader/NotificationWidgetPanel.vue | 5 +- composables/notifications.ts | 8 +- eslint.config.mjs | 5 ++ i18n/locales/en_us.json | 1 + package.json | 2 +- pages/account/notifications.vue | 71 +++++++++------ pages/admin/settings.vue | 10 +-- pnpm-lock.yaml | 90 +++++++++---------- rules/no-prisma-delete.mts | 34 +++++++ .../v1/admin/auth/invitation/index.delete.ts | 6 +- server/api/v1/admin/game/[id]/index.delete.ts | 2 +- .../v1/admin/library/sources/index.delete.ts | 4 +- .../api/v1/admin/token/[id]/index.delete.ts | 4 +- .../api/v1/admin/users/[id]/index.delete.ts | 1 + server/api/v1/auth/signup/simple.post.ts | 2 +- .../[gameid]/[slotindex]/index.delete.ts | 12 ++- .../api/v1/notifications/[id]/index.delete.ts | 4 +- server/api/v1/notifications/clear.post.ts | 25 ++++++ server/api/v1/user/token/[id]/index.delete.ts | 4 +- server/internal/auth/oidc/index.ts | 5 +- server/internal/clients/handler.ts | 4 + server/internal/library/index.ts | 12 ++- server/internal/news/index.ts | 5 +- server/internal/objects/fsBackend.ts | 16 ++-- server/internal/screenshots/index.ts | 8 +- server/internal/session/db.ts | 4 +- server/internal/userlibrary/index.ts | 26 +++--- tsconfig.json | 3 +- 29 files changed, 238 insertions(+), 140 deletions(-) create mode 100644 rules/no-prisma-delete.mts create mode 100644 server/api/v1/notifications/clear.post.ts diff --git a/components/NotificationItem.vue b/components/NotificationItem.vue index 243f4da..b81ee30 100644 --- a/components/NotificationItem.vue +++ b/components/NotificationItem.vue @@ -44,9 +44,12 @@ diff --git a/composables/notifications.ts b/composables/notifications.ts index ede125b..637fe7e 100644 --- a/composables/notifications.ts +++ b/composables/notifications.ts @@ -1,12 +1,16 @@ +import type { SerializeObject } from "nitropack"; import type { NotificationModel } from "~/prisma/client/models"; const ws = new WebSocketHandler("/api/v1/notifications/ws"); export const useNotifications = () => - useState>("notifications", () => []); + useState>>( + "notifications", + () => [], + ); ws.listen((e) => { - const notification = JSON.parse(e) as NotificationModel; + const notification = JSON.parse(e) as SerializeObject; const notifications = useNotifications(); notifications.value.push(notification); }); diff --git a/eslint.config.mjs b/eslint.config.mjs index 0576c43..a287ae9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -2,6 +2,7 @@ import withNuxt from "./.nuxt/eslint.config.mjs"; import eslintConfigPrettier from "eslint-config-prettier/flat"; import vueI18n from "@intlify/eslint-plugin-vue-i18n"; +import noPrismaDelete from "./rules/no-prisma-delete.mts"; export default withNuxt([ eslintConfigPrettier, @@ -19,6 +20,7 @@ export default withNuxt([ }, ], "@intlify/vue-i18n/no-missing-keys": "error", + "drop/no-prisma-delete": "error", }, settings: { "vue-i18n": { @@ -29,5 +31,8 @@ export default withNuxt([ messageSyntaxVersion: "^11.0.0", }, }, + plugins: { + drop: { rules: { "no-prisma-delete": noPrismaDelete } }, + }, }, ]); diff --git a/i18n/locales/en_us.json b/i18n/locales/en_us.json index 02ff541..d167034 100644 --- a/i18n/locales/en_us.json +++ b/i18n/locales/en_us.json @@ -13,6 +13,7 @@ "all": "View all {arrow}", "desc": "View and manage your notifications.", "markAllAsRead": "Mark all as read", + "clear": "Clear notifications", "markAsRead": "Mark as read", "none": "No notifications", "notifications": "Notifications", diff --git a/package.json b/package.json index 3e632df..bc18b7b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@discordapp/twemoji": "^16.0.1", - "@drop-oss/droplet": "3.4.0", + "@drop-oss/droplet": "3.5.0", "@headlessui/vue": "^1.7.23", "@heroicons/vue": "^2.1.5", "@lobomfz/prismark": "0.0.3", diff --git a/pages/account/notifications.vue b/pages/account/notifications.vue index f625ab4..04b83f1 100644 --- a/pages/account/notifications.vue +++ b/pages/account/notifications.vue @@ -1,20 +1,32 @@