diff --git a/server/.prettierignore b/server/.prettierignore new file mode 100644 index 00000000..1e7121ff --- /dev/null +++ b/server/.prettierignore @@ -0,0 +1 @@ +drop-base/ diff --git a/server/CONTRIBUTING.md b/server/CONTRIBUTING.md index f7a20b4e..3d883ae3 100644 --- a/server/CONTRIBUTING.md +++ b/server/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/server/SECURITY.md b/server/SECURITY.md index b11f4ee8..8fc42ef6 100644 --- a/server/SECURITY.md +++ b/server/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/server/assets/core.scss b/server/assets/core.scss index b2c2757a..3d79d4b1 100644 --- a/server/assets/core.scss +++ b/server/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/server/assets/tailwindcss.css b/server/assets/tailwindcss.css index c64f75c3..5c2596be 100644 --- a/server/assets/tailwindcss.css +++ b/server/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/server/changelog.md b/server/changelog.md index c3628589..309d6b67 100644 --- a/server/changelog.md +++ b/server/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/server/components/AccountSidebar.vue b/server/components/AccountSidebar.vue index 66fe6769..927988b0 100644 --- a/server/components/AccountSidebar.vue +++ b/server/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/server/components/DropLogo.vue b/server/components/DropLogo.vue index d7760057..8645c5be 100644 --- a/server/components/DropLogo.vue +++ b/server/components/DropLogo.vue @@ -1,7 +1,14 @@ \ No newline at end of file + + + + diff --git a/server/components/DropWordmark.vue b/server/components/DropWordmark.vue index 3389a519..783cc2a1 100644 --- a/server/components/DropWordmark.vue +++ b/server/components/DropWordmark.vue @@ -1,12 +1,18 @@ \ No newline at end of file +
+ + + Drop +
+ diff --git a/server/components/GameCarousel.vue b/server/components/GameCarousel.vue index ec0011c5..ef859fb0 100644 --- a/server/components/GameCarousel.vue +++ b/server/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/server/components/Icons/DiscordLogo.vue b/server/components/Icons/DiscordLogo.vue index 3c376aa1..0ae11f14 100644 --- a/server/components/Icons/DiscordLogo.vue +++ b/server/components/Icons/DiscordLogo.vue @@ -1,8 +1,9 @@ - \ No newline at end of file + diff --git a/server/components/Icons/GithubLogo.vue b/server/components/Icons/GithubLogo.vue index 3e7d6e8a..d3626f54 100644 --- a/server/components/Icons/GithubLogo.vue +++ b/server/components/Icons/GithubLogo.vue @@ -1,15 +1,29 @@ - \ No newline at end of file + diff --git a/server/components/Icons/LinuxLogo.vue b/server/components/Icons/LinuxLogo.vue index ceb68308..5d82fc0b 100644 --- a/server/components/Icons/LinuxLogo.vue +++ b/server/components/Icons/LinuxLogo.vue @@ -1,10 +1,10 @@ - + diff --git a/server/components/Icons/SimpleAuthenticationLogo.vue b/server/components/Icons/SimpleAuthenticationLogo.vue index 25c7f2e4..5dbda882 100644 --- a/server/components/Icons/SimpleAuthenticationLogo.vue +++ b/server/components/Icons/SimpleAuthenticationLogo.vue @@ -1,11 +1,11 @@ - + diff --git a/server/components/Icons/WindowsLogo.vue b/server/components/Icons/WindowsLogo.vue index 38a24995..4b608b25 100644 --- a/server/components/Icons/WindowsLogo.vue +++ b/server/components/Icons/WindowsLogo.vue @@ -1,12 +1,12 @@ - + diff --git a/server/components/NotificationItem.vue b/server/components/NotificationItem.vue index d84a4ffd..e02fa226 100644 --- a/server/components/NotificationItem.vue +++ b/server/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/server/components/PanelWidget.vue b/server/components/PanelWidget.vue index 5022563f..64da30d4 100644 --- a/server/components/PanelWidget.vue +++ b/server/components/PanelWidget.vue @@ -1,5 +1,5 @@ \ No newline at end of file +
+ +
+ diff --git a/server/components/UserHeader.vue b/server/components/UserHeader.vue index 30f3936f..c548fec8 100644 --- a/server/components/UserHeader.vue +++ b/server/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/server/composables/current-page-engine.ts b/server/composables/current-page-engine.ts index 6142949e..7b721cef 100644 --- a/server/composables/current-page-engine.ts +++ b/server/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/server/dev-tools/compose.yml b/server/dev-tools/compose.yml index a73ce86f..c2d81883 100644 --- a/server/dev-tools/compose.yml +++ b/server/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/server/pages/admin/index.vue b/server/pages/admin/index.vue index fd74e5f4..4e233b63 100644 --- a/server/pages/admin/index.vue +++ b/server/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/server/pages/client/[id]/callback.vue b/server/pages/client/[id]/callback.vue index 3c576c78..146073bd 100644 --- a/server/pages/client/[id]/callback.vue +++ b/server/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/server/api/v1/admin/auth/index.get.ts b/server/server/api/v1/admin/auth/index.get.ts index 2f1f8efc..0f8380b8 100644 --- a/server/server/api/v1/admin/auth/index.get.ts +++ b/server/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/server/api/v1/admin/game/image/index.post.ts b/server/server/api/v1/admin/game/image/index.post.ts index 8453b6fc..fb43241e 100644 --- a/server/server/api/v1/admin/game/image/index.post.ts +++ b/server/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/server/api/v1/admin/game/index.get.ts b/server/server/api/v1/admin/game/index.get.ts index 8878c805..5e3979df 100644 --- a/server/server/api/v1/admin/game/index.get.ts +++ b/server/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/server/api/v1/admin/game/index.patch.ts b/server/server/api/v1/admin/game/index.patch.ts index 578bf96e..238dc8e6 100644 --- a/server/server/api/v1/admin/game/index.patch.ts +++ b/server/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/server/api/v1/admin/game/metadata.post.ts b/server/server/api/v1/admin/game/metadata.post.ts index c55c28db..aab26f2d 100644 --- a/server/server/api/v1/admin/game/metadata.post.ts +++ b/server/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/server/api/v1/admin/game/version/index.delete.ts b/server/server/api/v1/admin/game/version/index.delete.ts index cf85c465..79aa04d5 100644 --- a/server/server/api/v1/admin/game/version/index.delete.ts +++ b/server/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/server/api/v1/admin/game/version/index.patch.ts b/server/server/api/v1/admin/game/version/index.patch.ts index 3771179d..7509cd55 100644 --- a/server/server/api/v1/admin/game/version/index.patch.ts +++ b/server/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/server/api/v1/admin/import/game/index.get.ts b/server/server/api/v1/admin/import/game/index.get.ts index b1b3c3d0..c913bdc9 100644 --- a/server/server/api/v1/admin/import/game/index.get.ts +++ b/server/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/server/api/v1/admin/import/game/index.post.ts b/server/server/api/v1/admin/import/game/index.post.ts index 10daeabd..7f39f525 100644 --- a/server/server/api/v1/admin/import/game/index.post.ts +++ b/server/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/server/api/v1/admin/import/game/search.get.ts b/server/server/api/v1/admin/import/game/search.get.ts index 723de480..5b337ab3 100644 --- a/server/server/api/v1/admin/import/game/search.get.ts +++ b/server/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/server/api/v1/admin/import/version/index.get.ts b/server/server/api/v1/admin/import/version/index.get.ts index 8d60a05b..8687b94a 100644 --- a/server/server/api/v1/admin/import/version/index.get.ts +++ b/server/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/server/api/v1/admin/import/version/index.post.ts b/server/server/api/v1/admin/import/version/index.post.ts index 3460b20e..6ec7b3e6 100644 --- a/server/server/api/v1/admin/import/version/index.post.ts +++ b/server/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/server/api/v1/admin/import/version/preload.get.ts b/server/server/api/v1/admin/import/version/preload.get.ts index b8429b34..d83b9363 100644 --- a/server/server/api/v1/admin/import/version/preload.get.ts +++ b/server/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/server/api/v1/admin/news/[id]/index.delete.ts b/server/server/api/v1/admin/news/[id]/index.delete.ts index 2af1f27e..30c49132 100644 --- a/server/server/api/v1/admin/news/[id]/index.delete.ts +++ b/server/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/server/api/v1/admin/news/index.get.ts b/server/server/api/v1/admin/news/index.get.ts index df11a96d..392f4b7b 100644 --- a/server/server/api/v1/admin/news/index.get.ts +++ b/server/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/server/api/v1/admin/users/index.get.ts b/server/server/api/v1/admin/users/index.get.ts index 6efc549b..43a90fe7 100644 --- a/server/server/api/v1/admin/users/index.get.ts +++ b/server/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/server/api/v1/client/auth/handshake.post.ts b/server/server/api/v1/client/auth/handshake.post.ts index 62785f50..c154c8c0 100644 --- a/server/server/api/v1/client/auth/handshake.post.ts +++ b/server/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/server/api/v1/client/capability/index.post.ts b/server/server/api/v1/client/capability/index.post.ts index 31547cbe..0123860a 100644 --- a/server/server/api/v1/client/capability/index.post.ts +++ b/server/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/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts b/server/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts index 14ae41ea..7a72aa74 100644 --- a/server/server/api/v1/client/saves/[gameid]/[slotindex]/index.delete.ts +++ b/server/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/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts b/server/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts index 33634baf..4d20a45f 100644 --- a/server/server/api/v1/client/saves/[gameid]/[slotindex]/index.get.ts +++ b/server/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/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts b/server/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts index 1f4552f4..f7ac2eb9 100644 --- a/server/server/api/v1/client/saves/[gameid]/[slotindex]/push.post.ts +++ b/server/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/server/api/v1/client/saves/[gameid]/index.get.ts b/server/server/api/v1/client/saves/[gameid]/index.get.ts index 717cc363..ced1bba5 100644 --- a/server/server/api/v1/client/saves/[gameid]/index.get.ts +++ b/server/server/api/v1/client/saves/[gameid]/index.get.ts @@ -33,5 +33,5 @@ export default defineClientEventHandler( }); return saves; - } + }, ); diff --git a/server/server/api/v1/client/saves/[gameid]/index.post.ts b/server/server/api/v1/client/saves/[gameid]/index.post.ts index 8bbe175d..edd35beb 100644 --- a/server/server/api/v1/client/saves/[gameid]/index.post.ts +++ b/server/server/api/v1/client/saves/[gameid]/index.post.ts @@ -58,5 +58,5 @@ export default defineClientEventHandler( }); return newSlot; - } + }, ); diff --git a/server/server/api/v1/client/saves/index.get.ts b/server/server/api/v1/client/saves/index.get.ts index fb475849..83a8616b 100644 --- a/server/server/api/v1/client/saves/index.get.ts +++ b/server/server/api/v1/client/saves/index.get.ts @@ -19,5 +19,5 @@ export default defineClientEventHandler( }); return saves; - } + }, ); diff --git a/server/server/api/v1/client/user/webtoken.post.ts b/server/server/api/v1/client/user/webtoken.post.ts index f95246b7..09f2d57b 100644 --- a/server/server/api/v1/client/user/webtoken.post.ts +++ b/server/server/api/v1/client/user/webtoken.post.ts @@ -27,5 +27,5 @@ export default defineClientEventHandler( }); return token.token; - } + }, ); diff --git a/server/server/api/v1/collection/[id]/entry.delete.ts b/server/server/api/v1/collection/[id]/entry.delete.ts index 575ae3c0..d0a4faff 100644 --- a/server/server/api/v1/collection/[id]/entry.delete.ts +++ b/server/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/server/api/v1/collection/index.get.ts b/server/server/api/v1/collection/index.get.ts index e912e966..2fbe41b7 100644 --- a/server/server/api/v1/collection/index.get.ts +++ b/server/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/server/api/v1/news/[id]/index.get.ts b/server/server/api/v1/news/[id]/index.get.ts index f83047fa..2499779b 100644 --- a/server/server/api/v1/news/[id]/index.get.ts +++ b/server/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/server/api/v1/notifications/readall.post.ts b/server/server/api/v1/notifications/readall.post.ts index 9c3c7996..2ee47733 100644 --- a/server/server/api/v1/notifications/readall.post.ts +++ b/server/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/server/api/v1/object/[id]/index.get.ts b/server/server/api/v1/object/[id]/index.get.ts index 1b93c9ce..6a7ec849 100644 --- a/server/server/api/v1/object/[id]/index.get.ts +++ b/server/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/server/api/v1/object/[id]/index.post.ts b/server/server/api/v1/object/[id]/index.post.ts index 7b08d2fb..ef58453a 100644 --- a/server/server/api/v1/object/[id]/index.post.ts +++ b/server/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/server/internal/P2P.md b/server/server/internal/P2P.md index 341e3453..9da9a822 100644 --- a/server/server/internal/P2P.md +++ b/server/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/server/internal/acls/descriptions.ts b/server/server/internal/acls/descriptions.ts index a8634603..d5ac10af 100644 --- a/server/server/internal/acls/descriptions.ts +++ b/server/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/server/internal/config/application-configuration.ts b/server/server/internal/config/application-configuration.ts index ebf45578..0bd73fc4 100644 --- a/server/server/internal/config/application-configuration.ts +++ b/server/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/server/internal/db/database.ts b/server/server/internal/db/database.ts index 34cbd220..9b36dd52 100644 --- a/server/server/internal/db/database.ts +++ b/server/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/server/internal/library/README.md b/server/server/internal/library/README.md index e33b8add..dea2db78 100644 --- a/server/server/internal/library/README.md +++ b/server/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/server/internal/metadata/giantbomb.ts b/server/server/internal/metadata/giantbomb.ts index bb104732..81282c07 100644 --- a/server/server/internal/metadata/giantbomb.ts +++ b/server/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/server/internal/metadata/igdb.ts b/server/server/internal/metadata/igdb.ts index ef87fb51..f98724c4 100644 --- a/server/server/internal/metadata/igdb.ts +++ b/server/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/server/internal/utils/handlefileupload.ts b/server/server/internal/utils/handlefileupload.ts index 954b9269..e5fe80ce 100644 --- a/server/server/internal/utils/handlefileupload.ts +++ b/server/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();