From 87215c4a1e061180ff7241d9c344e4a549981289 Mon Sep 17 00:00:00 2001 From: Huskydog9988 <39809509+Huskydog9988@users.noreply.github.com> Date: Tue, 15 Apr 2025 21:46:34 -0400 Subject: [PATCH] chore: prettier pass --- .prettierignore | 1 + CONTRIBUTING.md | 27 +++++++----- SECURITY.md | 1 + assets/core.scss | 4 +- assets/tailwindcss.css | 2 +- changelog.md | 18 ++++---- components/AccountSidebar.vue | 2 +- components/DropLogo.vue | 19 +++++--- components/DropWordmark.vue | 28 +++++++----- components/GameCarousel.vue | 2 +- components/Icons/DiscordLogo.vue | 17 +++---- components/Icons/GithubLogo.vue | 44 ++++++++++++------- components/Icons/LinuxLogo.vue | 20 ++++----- components/Icons/SimpleAuthenticationLogo.vue | 22 +++++----- components/Icons/WindowsLogo.vue | 24 +++++----- components/NotificationItem.vue | 4 +- components/PanelWidget.vue | 8 ++-- components/UserHeader.vue | 2 +- composables/current-page-engine.ts | 4 +- dev-tools/compose.yml | 2 +- pages/admin/index.vue | 2 +- pages/auth/register.vue | 20 ++++----- pages/client/[id]/callback.vue | 12 ++--- server/api/v1/admin/auth/index.get.ts | 2 +- server/api/v1/admin/game/image/index.post.ts | 4 +- server/api/v1/admin/game/index.get.ts | 4 +- server/api/v1/admin/game/index.patch.ts | 4 +- server/api/v1/admin/game/metadata.post.ts | 4 +- .../api/v1/admin/game/version/index.delete.ts | 4 +- .../api/v1/admin/game/version/index.patch.ts | 18 ++++---- server/api/v1/admin/import/game/index.get.ts | 4 +- server/api/v1/admin/import/game/index.post.ts | 5 +-- server/api/v1/admin/import/game/search.get.ts | 4 +- .../api/v1/admin/import/version/index.get.ts | 9 ++-- .../api/v1/admin/import/version/index.post.ts | 4 +- .../v1/admin/import/version/preload.get.ts | 6 +-- server/api/v1/admin/news/[id]/index.delete.ts | 2 +- server/api/v1/admin/news/index.get.ts | 3 +- server/api/v1/admin/users/index.get.ts | 6 +-- server/api/v1/client/auth/handshake.post.ts | 2 +- server/api/v1/client/capability/index.post.ts | 9 ++-- .../[gameid]/[slotindex]/index.delete.ts | 2 +- .../saves/[gameid]/[slotindex]/index.get.ts | 2 +- .../saves/[gameid]/[slotindex]/push.post.ts | 4 +- .../api/v1/client/saves/[gameid]/index.get.ts | 2 +- .../v1/client/saves/[gameid]/index.post.ts | 2 +- server/api/v1/client/saves/index.get.ts | 2 +- server/api/v1/client/user/webtoken.post.ts | 2 +- server/api/v1/collection/[id]/entry.delete.ts | 2 +- server/api/v1/collection/index.get.ts | 2 +- server/api/v1/news/[id]/index.get.ts | 2 - server/api/v1/notifications/readall.post.ts | 2 +- server/api/v1/object/[id]/index.get.ts | 2 +- server/api/v1/object/[id]/index.post.ts | 2 +- server/internal/P2P.md | 3 +- server/internal/acls/descriptions.ts | 7 +-- .../config/application-configuration.ts | 10 +++-- server/internal/db/database.ts | 12 ++--- server/internal/library/README.md | 2 +- server/internal/metadata/giantbomb.ts | 14 +++--- server/internal/metadata/igdb.ts | 22 +++++----- server/internal/utils/handlefileupload.ts | 6 ++- 62 files changed, 247 insertions(+), 236 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1e7121f --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +drop-base/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7a20b4..3d883ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,8 @@ TODO: Add Troubleshooting If not, look at the [Troubleshooting](https://github.com/Drop-OSS/docs/Troubleshooting) page for instructions on how to gather data to better debug your problem. --> -If you cannot find an existing issue, you can go ahead and create an issue with as much + +If you cannot find an existing issue, you can go ahead and create an issue with as much detail as you can provide. It should include the data gathered as indicated above, along with the following: @@ -69,7 +70,8 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ### Getting started You should be familiar with the basics of -[contributing on GitHub](https://help.github.com/articles/using-pull-requests) +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) + @@ -95,8 +97,8 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ### You have an addition -We are absolutely accepting more contributions or features to drop, but please, make sure -that it is reasonable. Contributions that only cover a very small niche are likely to not +We are absolutely accepting more contributions or features to drop, but please, make sure +that it is reasonable. Contributions that only cover a very small niche are likely to not be added. Please be so kind as to [search](#use-the-search-luke) for any pending, merged or rejected Pull Requests @@ -109,7 +111,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa For any extensive change, such as API changes, you will have to find testers to +1 your PR. ----- +--- ## Use the Search, Luke @@ -126,7 +128,7 @@ to be sure your contribution has not already come up. If all fails, your thing has probably not been reported yet, so you can go ahead and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests). ----- +--- ## Commit Guidelines @@ -161,11 +163,13 @@ type(scope)!: subject Examples: - Commit that changes the `git` plugin: + ``` feat(git): add alias for `git commit` ``` - Commit that changes many plugins: + ``` style: fix inline declaration of arrays ``` @@ -203,6 +207,7 @@ type(scope)!: subject Formatting tricks: the commit subject may contain: - Links to related issues or PRs by writing `#issue`. This will be highlighted by the changelog tool: + ``` feat(archlinux): add support for aura AUR helper (#9467) ``` @@ -219,7 +224,7 @@ Try to keep the first commit line short. It's harder to do using this commit sty concise, and if you need more space, you can use the commit body. Try to make sure that the commit subject is clear and precise enough that users will know what changed by just looking at the changelog. ----- +--- + ## Reference -This contributing guide is adapted from the -[oh-my-zsh contribution guide](https://github.com/ohmyzsh/ohmyzsh/blob/master/CONTRIBUTING.md). -If there are any issues with this, please email admin@deepcore.dev. \ No newline at end of file + +This contributing guide is adapted from the +[oh-my-zsh contribution guide](https://github.com/ohmyzsh/ohmyzsh/blob/master/CONTRIBUTING.md). +If there are any issues with this, please email admin@deepcore.dev. diff --git a/SECURITY.md b/SECURITY.md index b11f4ee..8fc42ef 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,4 +1,5 @@ # Security + To report a vulnerability, please DO NOT create an issue for it as this may lead to the vulnerability being exploited before it can be fixed. Instead, please email [security@deepcore.dev](mailto:security@deepcore.dev) diff --git a/assets/core.scss b/assets/core.scss index b2c2757..3d79d4b 100644 --- a/assets/core.scss +++ b/assets/core.scss @@ -73,5 +73,5 @@ button { } html { - background-color: oklch(.21 .006 285.885); -} \ No newline at end of file + background-color: oklch(0.21 0.006 285.885); +} diff --git a/assets/tailwindcss.css b/assets/tailwindcss.css index c64f75c..5c2596b 100644 --- a/assets/tailwindcss.css +++ b/assets/tailwindcss.css @@ -1,4 +1,4 @@ @import "tailwindcss"; @plugin "@tailwindcss/typography"; @plugin "@tailwindcss/forms"; -@config "../tailwind.config.js"; \ No newline at end of file +@config "../tailwind.config.js"; diff --git a/changelog.md b/changelog.md index c362858..309d6b6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,7 @@ - - ## Release 0.2.0-beta ### Fixes + - fix recursive dirs util #02d6346 - Fix username length requirement #0a5a649 - remove dynamic imports #0f10626 @@ -33,8 +32,8 @@ - fix FATAL: "root"... message #dbb315a - only show versions that are directories #ef8f3ae - ### Features + - update prisma & delete games #089c3e0 - manual handshake #12e3125 - fetch game endpoint #1f4d075 @@ -81,9 +80,9 @@ - add support for overriding UMU id #fd4a7d1 - add .sh for linux #fe9373a - ### Other Changes -- quexeky + +- quexeky - fixed manifest generation #03a37f7 - manual ci/cd #03b0b0c - ability to fetch client certs for p2p #0a715fe @@ -189,12 +188,12 @@ - better server side signin redirects #ef13b68 - patch signin #f3672f8 - _changelog generated by_ [go-conventional-commits](https://github.com/joselitofilho/go-conventional-commits) ## Release 0.1.0-beta ### Fixes + - remove dynamic imports #0f10626 - fix for missing developers or publishers #25fc957 - split prisma schemas #2859005 @@ -214,8 +213,8 @@ _changelog generated by_ [go-conventional-commits](https://github.com/joselitofi - moved icons and created PlatformClient so we can use the enum on the frontend #cada630 - only show versions that are directories #ef8f3ae - ### Features + - update prisma & delete games #089c3e0 - fetch game endpoint #1f4d075 - under the hood organisation and consolidation #26a31f6 @@ -245,9 +244,9 @@ _changelog generated by_ [go-conventional-commits](https://github.com/joselitofi - cleanup and raw accessors #f7d767d - add support for overriding UMU id #fd4a7d1 - ### Other Changes -- quexeky + +- quexeky - fixed manifest generation #03a37f7 - manual ci/cd #03b0b0c - ability to fetch client certs for p2p #0a715fe @@ -350,5 +349,4 @@ _changelog generated by_ [go-conventional-commits](https://github.com/joselitofi - better server side signin redirects #ef13b68 - patch signin #f3672f8 - _changelog generated by_ [go-conventional-commits](https://github.com/joselitofilho/go-conventional-commits) diff --git a/components/AccountSidebar.vue b/components/AccountSidebar.vue index 66fe676..927988b 100644 --- a/components/AccountSidebar.vue +++ b/components/AccountSidebar.vue @@ -44,7 +44,7 @@ import { HomeIcon, LockClosedIcon, DevicePhoneMobileIcon, - WrenchScrewdriverIcon + WrenchScrewdriverIcon, } from "@heroicons/vue/24/outline"; import { UserIcon } from "@heroicons/vue/24/solid"; import type { Component } from "vue"; diff --git a/components/DropLogo.vue b/components/DropLogo.vue index d776005..8645c5b 100644 --- a/components/DropLogo.vue +++ b/components/DropLogo.vue @@ -1,7 +1,14 @@ \ No newline at end of file + + + + diff --git a/components/DropWordmark.vue b/components/DropWordmark.vue index 3389a51..783cc2a 100644 --- a/components/DropWordmark.vue +++ b/components/DropWordmark.vue @@ -1,12 +1,18 @@ \ No newline at end of file +
+ + + Drop +
+ diff --git a/components/GameCarousel.vue b/components/GameCarousel.vue index ec0011c..ef859fb 100644 --- a/components/GameCarousel.vue +++ b/components/GameCarousel.vue @@ -46,7 +46,7 @@ const min = computed(() => Math.max(props.min ?? 8, props.items.length)); const games: Ref | undefined>> = computed(() => Array(min.value) .fill(0) - .map((_, i) => props.items[i]) + .map((_, i) => props.items[i]), ); const singlePage = ref(2); diff --git a/components/Icons/DiscordLogo.vue b/components/Icons/DiscordLogo.vue index 3c376aa..0ae11f1 100644 --- a/components/Icons/DiscordLogo.vue +++ b/components/Icons/DiscordLogo.vue @@ -1,8 +1,9 @@ - \ No newline at end of file + diff --git a/components/Icons/GithubLogo.vue b/components/Icons/GithubLogo.vue index 3e7d6e8..d3626f5 100644 --- a/components/Icons/GithubLogo.vue +++ b/components/Icons/GithubLogo.vue @@ -1,15 +1,29 @@ - \ No newline at end of file + diff --git a/components/Icons/LinuxLogo.vue b/components/Icons/LinuxLogo.vue index ceb6830..5d82fc0 100644 --- a/components/Icons/LinuxLogo.vue +++ b/components/Icons/LinuxLogo.vue @@ -1,10 +1,10 @@ - + diff --git a/components/Icons/SimpleAuthenticationLogo.vue b/components/Icons/SimpleAuthenticationLogo.vue index 25c7f2e..5dbda88 100644 --- a/components/Icons/SimpleAuthenticationLogo.vue +++ b/components/Icons/SimpleAuthenticationLogo.vue @@ -1,11 +1,11 @@ - + diff --git a/components/Icons/WindowsLogo.vue b/components/Icons/WindowsLogo.vue index 38a2499..4b608b2 100644 --- a/components/Icons/WindowsLogo.vue +++ b/components/Icons/WindowsLogo.vue @@ -1,12 +1,12 @@ - + diff --git a/components/NotificationItem.vue b/components/NotificationItem.vue index d84a4ff..e02fa22 100644 --- a/components/NotificationItem.vue +++ b/components/NotificationItem.vue @@ -15,7 +15,7 @@ > e.id === props.notification.id + (e) => e.id === props.notification.id, ); // Delete me notifications.value.splice(indexOfMe, 1); diff --git a/components/PanelWidget.vue b/components/PanelWidget.vue index 5022563..64da30d 100644 --- a/components/PanelWidget.vue +++ b/components/PanelWidget.vue @@ -1,5 +1,5 @@ \ No newline at end of file +
+ +
+ diff --git a/components/UserHeader.vue b/components/UserHeader.vue index 30f3936..c548fec 100644 --- a/components/UserHeader.vue +++ b/components/UserHeader.vue @@ -223,7 +223,7 @@ const currentPageIndex = useCurrentNavigationIndex(navigation); const notifications = useNotifications(); const unreadNotifications = computed(() => - notifications.value.filter((e) => !e.read) + notifications.value.filter((e) => !e.read), ); const sidebarOpen = ref(false); diff --git a/composables/current-page-engine.ts b/composables/current-page-engine.ts index 6142949..7b721ce 100644 --- a/composables/current-page-engine.ts +++ b/composables/current-page-engine.ts @@ -1,7 +1,9 @@ import type { RouteLocationNormalized } from "vue-router"; import type { NavigationItem } from "./types"; -export const useCurrentNavigationIndex = (navigation: Array) => { +export const useCurrentNavigationIndex = ( + navigation: Array, +) => { const router = useRouter(); const route = useRoute(); diff --git a/dev-tools/compose.yml b/dev-tools/compose.yml index a73ce86..c2d8188 100644 --- a/dev-tools/compose.yml +++ b/dev-tools/compose.yml @@ -9,4 +9,4 @@ services: environment: - POSTGRES_PASSWORD=drop - POSTGRES_USER=drop - - POSTGRES_DB=drop \ No newline at end of file + - POSTGRES_DB=drop diff --git a/pages/admin/index.vue b/pages/admin/index.vue index fd74e5f..4e233b6 100644 --- a/pages/admin/index.vue +++ b/pages/admin/index.vue @@ -113,7 +113,7 @@ class="h-[min(152px,40cqw)] object-cover" src="https://tailwindcss.com/plus-assets/img/component-images/bento-03-security.png" alt="" - > + />
+ />
@@ -59,7 +59,7 @@ :disabled="!!invitation.data.value?.email" placeholder="me@example.com" class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" - > + /> @@ -90,7 +90,7 @@ :disabled="!!invitation.data.value?.username" placeholder="myUsername" class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" - > + /> @@ -119,7 +119,7 @@ autocomplete="password" required class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" - > + /> @@ -146,7 +146,7 @@ autocomplete="confirm-password" required class="block w-full rounded-md border-0 py-1.5 px-3 bg-zinc-800 disabled:bg-zinc-900/80 text-zinc-100 disabled:text-zinc-400 shadow-sm ring-1 ring-inset ring-zinc-700 disabled:ring-zinc-800 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" - > + /> @@ -200,7 +200,7 @@ if (!invitationId) }); const invitation = await useFetch( - `/api/v1/auth/signup/simple?id=${encodeURIComponent(invitationId)}` + `/api/v1/auth/signup/simple?id=${encodeURIComponent(invitationId)}`, ); const email = ref(invitation.data.value?.email); @@ -211,20 +211,20 @@ const confirmPassword = ref(undefined); const emailValidator = type("string.email"); const validEmail = computed( - () => !(emailValidator(email.value) instanceof type.errors) + () => !(emailValidator(email.value) instanceof type.errors), ); const usernameValidator = type("string.alphanumeric >= 5").to("string.lower"); const validUsername = computed( - () => !(usernameValidator(username.value) instanceof type.errors) + () => !(usernameValidator(username.value) instanceof type.errors), ); const passwordValidator = type("string >= 14"); const validPassword = computed( - () => !(passwordValidator(password.value) instanceof type.errors) + () => !(passwordValidator(password.value) instanceof type.errors), ); const validConfirmPassword = computed( - () => password.value == confirmPassword.value + () => password.value == confirmPassword.value, ); const loading = ref(false); diff --git a/pages/client/[id]/callback.vue b/pages/client/[id]/callback.vue index 3c576c7..146073b 100644 --- a/pages/client/[id]/callback.vue +++ b/pages/client/[id]/callback.vue @@ -58,15 +58,14 @@ Authorize client?

- "{{ clientData.name }}" has requested access to your Drop - account. + "{{ clientData.name }}" has requested access to your Drop account.

- +
@@ -149,7 +149,7 @@ const route = useRoute(); const clientId = route.params.id; const clientData = await $dropFetch( - `/api/v1/client/auth/callback?id=${clientId}` + `/api/v1/client/auth/callback?id=${clientId}`, ); const completed = ref(false); diff --git a/server/api/v1/admin/auth/index.get.ts b/server/api/v1/admin/auth/index.get.ts index 2f1f8ef..0f8380b 100644 --- a/server/api/v1/admin/auth/index.get.ts +++ b/server/api/v1/admin/auth/index.get.ts @@ -7,7 +7,7 @@ export default defineEventHandler(async (h3) => { if (!allowed) throw createError({ statusCode: 403 }); const enabledMechanisms: AuthMec[] = await applicationSettings.get( - "enabledAuthencationMechanisms" + "enabledAuthencationMechanisms", ); return enabledMechanisms; diff --git a/server/api/v1/admin/game/image/index.post.ts b/server/api/v1/admin/game/image/index.post.ts index 8453b6f..fb43241 100644 --- a/server/api/v1/admin/game/image/index.post.ts +++ b/server/api/v1/admin/game/image/index.post.ts @@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database"; import { handleFileUpload } from "~/server/internal/utils/handlefileupload"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:image:new", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:image:new"]); if (!allowed) throw createError({ statusCode: 403 }); const form = await readMultipartFormData(h3); diff --git a/server/api/v1/admin/game/index.get.ts b/server/api/v1/admin/game/index.get.ts index 8878c80..5e3979d 100644 --- a/server/api/v1/admin/game/index.get.ts +++ b/server/api/v1/admin/game/index.get.ts @@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database"; import libraryManager from "~/server/internal/library"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:read", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:read"]); if (!allowed) throw createError({ statusCode: 403 }); const query = getQuery(h3); diff --git a/server/api/v1/admin/game/index.patch.ts b/server/api/v1/admin/game/index.patch.ts index 578bf96..238dc8e 100644 --- a/server/api/v1/admin/game/index.patch.ts +++ b/server/api/v1/admin/game/index.patch.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import prisma from "~/server/internal/db/database"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:update", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:update"]); if (!allowed) throw createError({ statusCode: 403 }); const body = await readBody(h3); diff --git a/server/api/v1/admin/game/metadata.post.ts b/server/api/v1/admin/game/metadata.post.ts index c55c28d..aab26f2 100644 --- a/server/api/v1/admin/game/metadata.post.ts +++ b/server/api/v1/admin/game/metadata.post.ts @@ -3,9 +3,7 @@ import prisma from "~/server/internal/db/database"; import { handleFileUpload } from "~/server/internal/utils/handlefileupload"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:update", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:update"]); if (!allowed) throw createError({ statusCode: 403 }); const form = await readMultipartFormData(h3); diff --git a/server/api/v1/admin/game/version/index.delete.ts b/server/api/v1/admin/game/version/index.delete.ts index cf85c46..79aa04d 100644 --- a/server/api/v1/admin/game/version/index.delete.ts +++ b/server/api/v1/admin/game/version/index.delete.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import prisma from "~/server/internal/db/database"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:version:delete", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:version:delete"]); if (!allowed) throw createError({ statusCode: 403 }); const body = await readBody(h3); diff --git a/server/api/v1/admin/game/version/index.patch.ts b/server/api/v1/admin/game/version/index.patch.ts index 3771179..7509cd5 100644 --- a/server/api/v1/admin/game/version/index.patch.ts +++ b/server/api/v1/admin/game/version/index.patch.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import prisma from "~/server/internal/db/database"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "game:version:update", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["game:version:update"]); if (!allowed) throw createError({ statusCode: 403 }); const body = await readBody(h3); @@ -30,13 +28,13 @@ export default defineEventHandler(async (h3) => { versionIndex: versionIndex, }, select: { - versionIndex: true, - versionName: true, - platform: true, - delta: true, - } - }) - ) + versionIndex: true, + versionName: true, + platform: true, + delta: true, + }, + }), + ), ); return newVersions; diff --git a/server/api/v1/admin/import/game/index.get.ts b/server/api/v1/admin/import/game/index.get.ts index b1b3c3d..c913bdc 100644 --- a/server/api/v1/admin/import/game/index.get.ts +++ b/server/api/v1/admin/import/game/index.get.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import libraryManager from "~/server/internal/library"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:game:read", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:game:read"]); if (!allowed) throw createError({ statusCode: 403 }); const unimportedGames = await libraryManager.fetchAllUnimportedGames(); diff --git a/server/api/v1/admin/import/game/index.post.ts b/server/api/v1/admin/import/game/index.post.ts index 10daeab..7f39f52 100644 --- a/server/api/v1/admin/import/game/index.post.ts +++ b/server/api/v1/admin/import/game/index.post.ts @@ -7,9 +7,7 @@ import type { } from "~/server/internal/metadata/types"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:game:new", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:game:new"]); if (!allowed) throw createError({ statusCode: 403 }); const body = await readBody(h3); @@ -30,7 +28,6 @@ export default defineEventHandler(async (h3) => { statusMessage: "Invalid unimported game path", }); - if (!metadata || !metadata.id || !metadata.sourceId) { console.log(metadata); return await metadataHandler.createGameWithoutMetadata(path); diff --git a/server/api/v1/admin/import/game/search.get.ts b/server/api/v1/admin/import/game/search.get.ts index 723de48..5b337ab 100644 --- a/server/api/v1/admin/import/game/search.get.ts +++ b/server/api/v1/admin/import/game/search.get.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import metadataHandler from "~/server/internal/metadata"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:game:read", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:game:read"]); if (!allowed) throw createError({ statusCode: 403 }); const query = getQuery(h3); diff --git a/server/api/v1/admin/import/version/index.get.ts b/server/api/v1/admin/import/version/index.get.ts index 8d60a05..8687b94 100644 --- a/server/api/v1/admin/import/version/index.get.ts +++ b/server/api/v1/admin/import/version/index.get.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import libraryManager from "~/server/internal/library"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:version:read", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:version:read"]); if (!allowed) throw createError({ statusCode: 403 }); const query = await getQuery(h3); @@ -15,9 +13,8 @@ export default defineEventHandler(async (h3) => { statusMessage: "Missing id in request params", }); - const unimportedVersions = await libraryManager.fetchUnimportedVersions( - gameId - ); + const unimportedVersions = + await libraryManager.fetchUnimportedVersions(gameId); if (!unimportedVersions) throw createError({ statusCode: 400, statusMessage: "Invalid game ID" }); diff --git a/server/api/v1/admin/import/version/index.post.ts b/server/api/v1/admin/import/version/index.post.ts index 3460b20..6ec7b3e 100644 --- a/server/api/v1/admin/import/version/index.post.ts +++ b/server/api/v1/admin/import/version/index.post.ts @@ -4,9 +4,7 @@ import libraryManager from "~/server/internal/library"; import { parsePlatform } from "~/server/internal/utils/parseplatform"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:version:new", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:version:new"]); if (!allowed) throw createError({ statusCode: 403 }); const body = await readBody(h3); diff --git a/server/api/v1/admin/import/version/preload.get.ts b/server/api/v1/admin/import/version/preload.get.ts index b8429b3..d83b936 100644 --- a/server/api/v1/admin/import/version/preload.get.ts +++ b/server/api/v1/admin/import/version/preload.get.ts @@ -2,9 +2,7 @@ import aclManager from "~/server/internal/acls"; import libraryManager from "~/server/internal/library"; export default defineEventHandler(async (h3) => { - const allowed = await aclManager.allowSystemACL(h3, [ - "import:version:read", - ]); + const allowed = await aclManager.allowSystemACL(h3, ["import:version:read"]); if (!allowed) throw createError({ statusCode: 403 }); const query = await getQuery(h3); @@ -18,7 +16,7 @@ export default defineEventHandler(async (h3) => { const preload = await libraryManager.fetchUnimportedVersionInformation( gameId, - versionName + versionName, ); if (!preload) throw createError({ diff --git a/server/api/v1/admin/news/[id]/index.delete.ts b/server/api/v1/admin/news/[id]/index.delete.ts index 2af1f27..30c4913 100644 --- a/server/api/v1/admin/news/[id]/index.delete.ts +++ b/server/api/v1/admin/news/[id]/index.delete.ts @@ -19,4 +19,4 @@ export default defineEventHandler(async (h3) => { await newsManager.delete(id); return { success: true }; -}); +}); diff --git a/server/api/v1/admin/news/index.get.ts b/server/api/v1/admin/news/index.get.ts index df11a96..392f4b7 100644 --- a/server/api/v1/admin/news/index.get.ts +++ b/server/api/v1/admin/news/index.get.ts @@ -27,8 +27,7 @@ export default defineEventHandler(async (h3) => { take: parseInt(query.limit as string), skip: parseInt(query.skip as string), orderBy: orderBy, - ...(tags && { tags: tags - .map((e) => e.toString()) }), + ...(tags && { tags: tags.map((e) => e.toString()) }), search: query.search as string, }; diff --git a/server/api/v1/admin/users/index.get.ts b/server/api/v1/admin/users/index.get.ts index 6efc549..43a90fe 100644 --- a/server/api/v1/admin/users/index.get.ts +++ b/server/api/v1/admin/users/index.get.ts @@ -13,9 +13,9 @@ export default defineEventHandler(async (h3) => { authMecs: { select: { mec: true, - } - } - } + }, + }, + }, }); return users; diff --git a/server/api/v1/client/auth/handshake.post.ts b/server/api/v1/client/auth/handshake.post.ts index 62785f5..c154c8c 100644 --- a/server/api/v1/client/auth/handshake.post.ts +++ b/server/api/v1/client/auth/handshake.post.ts @@ -31,7 +31,7 @@ export default defineEventHandler(async (h3) => { const certificateAuthority = useCertificateAuthority(); const bundle = await certificateAuthority.generateClientCertificate( clientId, - metadata.data.name + metadata.data.name, ); const client = await clientHandler.finialiseClient(clientId); diff --git a/server/api/v1/client/capability/index.post.ts b/server/api/v1/client/capability/index.post.ts index 31547cb..0123860 100644 --- a/server/api/v1/client/capability/index.post.ts +++ b/server/api/v1/client/capability/index.post.ts @@ -1,5 +1,4 @@ -import type { - InternalClientCapability} from "~/server/internal/clients/capabilities"; +import type { InternalClientCapability } from "~/server/internal/clients/capabilities"; import capabilityManager, { validCapabilities, } from "~/server/internal/clients/capabilities"; @@ -34,7 +33,7 @@ export default defineClientEventHandler( const isValid = await capabilityManager.validateCapabilityConfiguration( capability, - configuration + configuration, ); if (!isValid) throw createError({ @@ -45,7 +44,7 @@ export default defineClientEventHandler( await capabilityManager.upsertClientCapability( capability, configuration, - clientId + clientId, ); const client = await fetchClient(); @@ -59,5 +58,5 @@ export default defineClientEventHandler( }); return {}; - } + }, ); diff --git a/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts b/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts index 14ae41e..7a72aa7 100644 --- a/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts +++ b/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts @@ -49,5 +49,5 @@ export default defineClientEventHandler( }); if (!save) throw createError({ statusCode: 404, statusMessage: "Save not found" }); - } + }, ); diff --git a/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts b/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts index 33634ba..4d20a45 100644 --- a/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts +++ b/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts @@ -51,5 +51,5 @@ export default defineClientEventHandler( throw createError({ statusCode: 404, statusMessage: "Save not found" }); return save; - } + }, ); diff --git a/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts b/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts index 1f4552f..f7ac2eb 100644 --- a/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts +++ b/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts @@ -44,9 +44,9 @@ export default defineClientEventHandler( user.id, slotIndex, h3.node.req, - client.id + client.id, ); return; - } + }, ); diff --git a/server/api/v1/client/saves/[gameid]/index.get.ts b/server/api/v1/client/saves/[gameid]/index.get.ts index 717cc36..ced1bba 100644 --- a/server/api/v1/client/saves/[gameid]/index.get.ts +++ b/server/api/v1/client/saves/[gameid]/index.get.ts @@ -33,5 +33,5 @@ export default defineClientEventHandler( }); return saves; - } + }, ); diff --git a/server/api/v1/client/saves/[gameid]/index.post.ts b/server/api/v1/client/saves/[gameid]/index.post.ts index 8bbe175..edd35be 100644 --- a/server/api/v1/client/saves/[gameid]/index.post.ts +++ b/server/api/v1/client/saves/[gameid]/index.post.ts @@ -58,5 +58,5 @@ export default defineClientEventHandler( }); return newSlot; - } + }, ); diff --git a/server/api/v1/client/saves/index.get.ts b/server/api/v1/client/saves/index.get.ts index fb47584..83a8616 100644 --- a/server/api/v1/client/saves/index.get.ts +++ b/server/api/v1/client/saves/index.get.ts @@ -19,5 +19,5 @@ export default defineClientEventHandler( }); return saves; - } + }, ); diff --git a/server/api/v1/client/user/webtoken.post.ts b/server/api/v1/client/user/webtoken.post.ts index f95246b..09f2d57 100644 --- a/server/api/v1/client/user/webtoken.post.ts +++ b/server/api/v1/client/user/webtoken.post.ts @@ -27,5 +27,5 @@ export default defineClientEventHandler( }); return token.token; - } + }, ); diff --git a/server/api/v1/collection/[id]/entry.delete.ts b/server/api/v1/collection/[id]/entry.delete.ts index 575ae3c..d0a4faf 100644 --- a/server/api/v1/collection/[id]/entry.delete.ts +++ b/server/api/v1/collection/[id]/entry.delete.ts @@ -23,7 +23,7 @@ export default defineEventHandler(async (h3) => { const successful = await userLibraryManager.collectionRemove( gameId, id, - userId + userId, ); if (!successful) throw createError({ diff --git a/server/api/v1/collection/index.get.ts b/server/api/v1/collection/index.get.ts index e912e96..2fbe41b 100644 --- a/server/api/v1/collection/index.get.ts +++ b/server/api/v1/collection/index.get.ts @@ -7,7 +7,7 @@ export default defineEventHandler(async (h3) => { throw createError({ statusCode: 403, }); - + const collections = await userLibraryManager.fetchCollections(userId); return collections; }); diff --git a/server/api/v1/news/[id]/index.get.ts b/server/api/v1/news/[id]/index.get.ts index f83047f..2499779 100644 --- a/server/api/v1/news/[id]/index.get.ts +++ b/server/api/v1/news/[id]/index.get.ts @@ -16,7 +16,6 @@ export default defineEventHandler(async (h3) => { statusCode: 400, message: "Missing news ID", }); - const news = await newsManager.fetchById(id); if (!news) @@ -25,6 +24,5 @@ export default defineEventHandler(async (h3) => { message: "News article not found", }); - return news; }); diff --git a/server/api/v1/notifications/readall.post.ts b/server/api/v1/notifications/readall.post.ts index 9c3c799..2ee4773 100644 --- a/server/api/v1/notifications/readall.post.ts +++ b/server/api/v1/notifications/readall.post.ts @@ -9,7 +9,7 @@ export default defineEventHandler(async (h3) => { const hasSystemPerms = await aclManager.allowSystemACL(h3, [ "notifications:mark", ]); - if(hasSystemPerms){ + if (hasSystemPerms) { userIds.push("system"); } diff --git a/server/api/v1/object/[id]/index.get.ts b/server/api/v1/object/[id]/index.get.ts index 1b93c9c..6a7ec84 100644 --- a/server/api/v1/object/[id]/index.get.ts +++ b/server/api/v1/object/[id]/index.get.ts @@ -30,7 +30,7 @@ export default defineEventHandler(async (h3) => { setHeader( h3, "Cache-Control", - "private, max-age=31536000, s-maxage=31536000, immutable" + "private, max-age=31536000, s-maxage=31536000, immutable", ); return object.data; }); diff --git a/server/api/v1/object/[id]/index.post.ts b/server/api/v1/object/[id]/index.post.ts index 7b08d2f..ef58453 100644 --- a/server/api/v1/object/[id]/index.post.ts +++ b/server/api/v1/object/[id]/index.post.ts @@ -18,7 +18,7 @@ export default defineEventHandler(async (h3) => { const result = await objectHandler.writeWithPermissions( id, async () => buffer, - userId + userId, ); return { success: result }; }); diff --git a/server/internal/P2P.md b/server/internal/P2P.md index 341e345..9da9a82 100644 --- a/server/internal/P2P.md +++ b/server/internal/P2P.md @@ -10,7 +10,6 @@ These use public HTTPS certificate, and while are authenticated, are 'public' in Drop clients use P2P mTLS aided by the P2P co-ordinator to transfer chunks between themselves. This happens over HTTP. - ## Private mTLS Wireguard tunnels -Drop clients can establish P2P Wireguard \ No newline at end of file +Drop clients can establish P2P Wireguard diff --git a/server/internal/acls/descriptions.ts b/server/internal/acls/descriptions.ts index a863460..d5ac10a 100644 --- a/server/internal/acls/descriptions.ts +++ b/server/internal/acls/descriptions.ts @@ -38,7 +38,8 @@ export const userACLDescriptions: ObjectFromList = { }; export const systemACLDescriptions: ObjectFromList = { - "auth:read": "Fetch the list of enabled authentication mechanisms configured.", + "auth:read": + "Fetch the list of enabled authentication mechanisms configured.", "auth:simple:invitation:read": "Fetch simple auth invitations.", "auth:simple:invitation:new": "Create new simple auth invitations.", "auth:simple:invitation:delete": "Delete a simple auth invitation.", @@ -66,8 +67,8 @@ export const systemACLDescriptions: ObjectFromList = { "import:game:new": "Import a game.", "user:read": "Fetch any user's information.", - + "news:read": "Read news articles.", "news:create": "Create a new news article.", - "news:delete": "Delete a news article." + "news:delete": "Delete a news article.", }; diff --git a/server/internal/config/application-configuration.ts b/server/internal/config/application-configuration.ts index ebf4557..0bd73fc 100644 --- a/server/internal/config/application-configuration.ts +++ b/server/internal/config/application-configuration.ts @@ -1,4 +1,4 @@ -import type { ApplicationSettings} from "@prisma/client"; +import type { ApplicationSettings } from "@prisma/client"; import { AuthMec } from "@prisma/client"; import prisma from "../db/database"; @@ -24,7 +24,7 @@ class ApplicationConfiguration { private async init() { if (this.currentApplicationSettings === undefined) { const applicationSettingsCount = await prisma.applicationSettings.count( - {} + {}, ); if (applicationSettingsCount > 0) { await applicationSettings.pullConfiguration(); @@ -60,7 +60,7 @@ class ApplicationConfiguration { async set( key: T, - value: ApplicationSettings[T] + value: ApplicationSettings[T], ) { await this.init(); if (!this.currentApplicationSettings) @@ -73,7 +73,9 @@ class ApplicationConfiguration { } } - async get(key: T): Promise { + async get( + key: T, + ): Promise { await this.init(); if (!this.currentApplicationSettings) throw new Error("Somehow, failed to initialise application settings"); diff --git a/server/internal/db/database.ts b/server/internal/db/database.ts index 34cbd22..9b36dd5 100644 --- a/server/internal/db/database.ts +++ b/server/internal/db/database.ts @@ -1,15 +1,15 @@ -import { PrismaClient } from '@prisma/client' +import { PrismaClient } from "@prisma/client"; const prismaClientSingleton = () => { - return new PrismaClient({}); -} + return new PrismaClient({}); +}; declare const globalThis: { - prismaGlobal: ReturnType; + prismaGlobal: ReturnType; } & typeof global; -const prisma = globalThis.prismaGlobal ?? prismaClientSingleton() +const prisma = globalThis.prismaGlobal ?? prismaClientSingleton(); export default prisma; -if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma \ No newline at end of file +if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma; diff --git a/server/internal/library/README.md b/server/internal/library/README.md index e33b8ad..dea2db7 100644 --- a/server/internal/library/README.md +++ b/server/internal/library/README.md @@ -8,4 +8,4 @@ The game name is only used for initial matching, and doesn't affect actual metad ## /{game name}/{version name} -The version name can be anything. Versions have to manually imported within the web UI. There, you can change the order of the updates and mark them as deltas. Delta updates apply files over the previous versions. \ No newline at end of file +The version name can be anything. Versions have to manually imported within the web UI. There, you can change the order of the updates and mark them as deltas. Delta updates apply files over the previous versions. diff --git a/server/internal/metadata/giantbomb.ts b/server/internal/metadata/giantbomb.ts index bb10473..81282c0 100644 --- a/server/internal/metadata/giantbomb.ts +++ b/server/internal/metadata/giantbomb.ts @@ -1,6 +1,6 @@ import type { Developer, Publisher } from "@prisma/client"; import { MetadataSource } from "@prisma/client"; -import type { MetadataProvider} from "."; +import type { MetadataProvider } from "."; import { MissingMetadataProviderConfig } from "."; import type { GameMetadataSearchResult, @@ -87,7 +87,7 @@ export class GiantBombProvider implements MetadataProvider { if (!apikey) throw new MissingMetadataProviderConfig( "GIANT_BOMB_API_KEY", - this.name() + this.name(), ); this.apikey = apikey; @@ -105,7 +105,7 @@ export class GiantBombProvider implements MetadataProvider { resource: string, url: string, query: { [key: string]: string }, - options?: AxiosRequestConfig + options?: AxiosRequestConfig, ) { const queryString = new URLSearchParams({ ...query, @@ -120,7 +120,7 @@ export class GiantBombProvider implements MetadataProvider { baseURL: "", }; const response = await axios.request>( - Object.assign({}, options, overlay) + Object.assign({}, options, overlay), ); return response; } @@ -198,7 +198,7 @@ export class GiantBombProvider implements MetadataProvider { : DateTime.fromISO( `${gameData.expected_release_year ?? new Date().getFullYear()}-${ gameData.expected_release_month ?? 1 - }-${gameData.expected_release_day ?? 1}` + }-${gameData.expected_release_day ?? 1}`, ).toJSDate(); const metadata: GameMetadata = { @@ -229,7 +229,7 @@ export class GiantBombProvider implements MetadataProvider { const results = await this.request>( "search", "", - { query, resources: "company" } + { query, resources: "company" }, ); // Find the right entry @@ -256,7 +256,7 @@ export class GiantBombProvider implements MetadataProvider { return metadata; } async fetchDeveloper( - params: _FetchDeveloperMetadataParams + params: _FetchDeveloperMetadataParams, ): Promise { return await this.fetchPublisher(params); } diff --git a/server/internal/metadata/igdb.ts b/server/internal/metadata/igdb.ts index ef87fb5..f98724c 100644 --- a/server/internal/metadata/igdb.ts +++ b/server/internal/metadata/igdb.ts @@ -1,6 +1,6 @@ import type { Developer, Publisher } from "@prisma/client"; import { MetadataSource } from "@prisma/client"; -import type { MetadataProvider} from "."; +import type { MetadataProvider } from "."; import { MissingMetadataProviderConfig } from "."; import type { GameMetadataSearchResult, @@ -144,7 +144,7 @@ export class IGDBProvider implements MetadataProvider { if (!client_secret) throw new MissingMetadataProviderConfig( "IGDB_CLIENT_SECRET", - this.name() + this.name(), ); this.clientId = client_id; @@ -188,14 +188,14 @@ export class IGDBProvider implements MetadataProvider { private async request( resource: string, body: string, - options?: AxiosRequestConfig + options?: AxiosRequestConfig, ) { await this.refreshCredentials(); // prevent calling api before auth is complete if (this.accessToken.length <= 0) throw new Error( - "IGDB either failed to authenticate, or has not done so yet" + "IGDB either failed to authenticate, or has not done so yet", ); const finalURL = `https://api.igdb.com/v4/${resource}`; @@ -213,7 +213,7 @@ export class IGDBProvider implements MetadataProvider { }, }; const response = await axios.request( - Object.assign({}, options, overlay) + Object.assign({}, options, overlay), ); if (response.status !== 200) { @@ -224,7 +224,7 @@ export class IGDBProvider implements MetadataProvider { }); throw new Error( - `Error in igdb \nStatus Code: ${response.status} \nCause: ${cause}` + `Error in igdb \nStatus Code: ${response.status} \nCause: ${cause}`, ); } @@ -323,7 +323,7 @@ export class IGDBProvider implements MetadataProvider { const involved_company_response = await this.request( "involved_companies", - `where id = ${involvedCompany}; fields *;` + `where id = ${involvedCompany}; fields *;`, ); for (const foundInvolved of involved_company_response) { // now we need to get the actual company so we can get the name @@ -348,7 +348,7 @@ export class IGDBProvider implements MetadataProvider { shortDescription: this.trimMessage(response[i].summary, 280), description: response[i].summary, released: DateTime.fromSeconds( - response[i].first_release_date + response[i].first_release_date, ).toJSDate(), reviewCount: response[i]?.total_rating_count ?? 0, @@ -372,7 +372,7 @@ export class IGDBProvider implements MetadataProvider { }: _FetchPublisherMetadataParams): Promise { const response = await this.request( "companies", - `where name = "${query}"; fields *; limit 1;` + `where name = "${query}"; fields *; limit 1;`, ); for (const company of response) { @@ -382,7 +382,7 @@ export class IGDBProvider implements MetadataProvider { for (const companySite of company.websites) { const companySiteRes = await this.request( "company_websites", - `where id = ${companySite}; fields *;` + `where id = ${companySite}; fields *;`, ); for (const site of companySiteRes) { @@ -406,7 +406,7 @@ export class IGDBProvider implements MetadataProvider { throw new Error("No results found"); } async fetchDeveloper( - params: _FetchDeveloperMetadataParams + params: _FetchDeveloperMetadataParams, ): Promise { return await this.fetchPublisher(params); } diff --git a/server/internal/utils/handlefileupload.ts b/server/internal/utils/handlefileupload.ts index 954b926..e5fe80c 100644 --- a/server/internal/utils/handlefileupload.ts +++ b/server/internal/utils/handlefileupload.ts @@ -5,8 +5,10 @@ import { ObjectTransactionalHandler } from "../objects/transactional"; export async function handleFileUpload( h3: H3Event, metadata: { [key: string]: string }, - permissions: Array -): Promise<[string | undefined, {[key: string]: string}, Pull, Dump] | undefined> { + permissions: Array, +): Promise< + [string | undefined, { [key: string]: string }, Pull, Dump] | undefined +> { const formData = await readMultipartFormData(h3); if (!formData) return undefined; const transactionalHandler = new ObjectTransactionalHandler();