mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
Update Prisma to 6.11 (#133)
* chore: update prisma to 6.11 more prisma future proofing due to experimental features * chore: update dependencies twemoji - new unicode update argon2 - bux fixes vue3-carousel - improve mobile experiance vue-tsc - more stable * fix: incorrect prisma version in docker Also remove default value for BUILD_DROP_VERSION, that is now handled in nuxt config * fix: no logging in prod * chore: optimize docker builds even more * fix: revert adoption of prisma driverAdapters see: https://github.com/prisma/prisma/issues/27486 * chore: optimize dockerignore some more * Fix `pino-pretty` not being included in build (#135) * Remove `pino` from frontend * Fix for downloads and removing of library source (#136) * fix: downloads and removing library source * fix: linting * Fix max file size of 4GB (update droplet) (#137) * Fix manual metadata import (#138) * chore(deps): bump vue-i18n from 10.0.7 to 10.0.8 (#140) Bumps [vue-i18n](https://github.com/intlify/vue-i18n/tree/HEAD/packages/vue-i18n) from 10.0.7 to 10.0.8. - [Release notes](https://github.com/intlify/vue-i18n/releases) - [Changelog](https://github.com/intlify/vue-i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/intlify/vue-i18n/commits/v10.0.8/packages/vue-i18n) --- updated-dependencies: - dependency-name: vue-i18n dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump @intlify/core from 10.0.7 to 10.0.8 (#139) --- updated-dependencies: - dependency-name: "@intlify/core" dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Small fixes (#141) * fix: save task as Json rather than string * fix: pull objects before creating game in database * fix: strips relative dirs from version information * fix: #132 * fix: lint * fix: news object ids and small tweaks * fix: notification styling errors * fix: lint * fix: build issues by regenerating lockfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: DecDuck <declanahofmeyr@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Dockerfile
|
||||||
|
.github
|
||||||
|
.vscode
|
||||||
|
*.md
|
||||||
|
|
||||||
|
#### gitignore below
|
||||||
# Nuxt dev/build outputs
|
# Nuxt dev/build outputs
|
||||||
.output
|
.output
|
||||||
.data
|
.data
|
||||||
@ -24,8 +30,14 @@ logs
|
|||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
|
||||||
# deploy template
|
# deploy template
|
||||||
deploy-template/
|
deploy-template/*
|
||||||
|
|
||||||
|
!deploy-template/compose.yml
|
||||||
|
|
||||||
# generated prisma client
|
# generated prisma client
|
||||||
/prisma/client
|
/prisma/client
|
||||||
|
/prisma/validate
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@ -4,7 +4,7 @@
|
|||||||
FROM node:lts-alpine AS deps
|
FROM node:lts-alpine AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock ./
|
||||||
RUN yarn install --network-timeout 1000000 --ignore-scripts
|
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --network-timeout 1000000 --ignore-scripts
|
||||||
|
|
||||||
# Build for app
|
# Build for app
|
||||||
FROM node:lts-alpine AS build-system
|
FROM node:lts-alpine AS build-system
|
||||||
@ -13,6 +13,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NUXT_TELEMETRY_DISABLED=1
|
ENV NUXT_TELEMETRY_DISABLED=1
|
||||||
|
ENV YARN_CACHE_FOLDER=/root/.yarn
|
||||||
|
|
||||||
# add git so drop can determine its git ref at build
|
# add git so drop can determine its git ref at build
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
@ -21,12 +22,12 @@ RUN apk add --no-cache git
|
|||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ARG BUILD_DROP_VERSION="v0.0.0-unknown.1"
|
ARG BUILD_DROP_VERSION
|
||||||
ARG BUILD_GIT_REF
|
ARG BUILD_GIT_REF
|
||||||
|
|
||||||
# build
|
# build
|
||||||
RUN yarn postinstall
|
RUN --mount=type=cache,target=/root/.yarn yarn postinstall && \
|
||||||
RUN yarn build
|
yarn build
|
||||||
|
|
||||||
# create run environment for Drop
|
# create run environment for Drop
|
||||||
FROM node:lts-alpine AS run-system
|
FROM node:lts-alpine AS run-system
|
||||||
@ -35,7 +36,7 @@ WORKDIR /app
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NUXT_TELEMETRY_DISABLED=1
|
ENV NUXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN yarn add --network-timeout 1000000 --no-lockfile prisma@6.7.0
|
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn add --network-timeout 1000000 --no-lockfile --ignore-scripts prisma@6.11.1
|
||||||
|
|
||||||
COPY --from=build-system /app/package.json ./
|
COPY --from=build-system /app/package.json ./
|
||||||
COPY --from=build-system /app/.output ./app
|
COPY --from=build-system /app/.output ./app
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { XCircleIcon } from "@heroicons/vue/20/solid";
|
import { XCircleIcon } from "@heroicons/vue/20/solid";
|
||||||
import type { User } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const username = ref("");
|
const username = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
@ -124,6 +124,6 @@ async function signin() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const user = useUser();
|
const user = useUser();
|
||||||
user.value = await $dropFetch<User | null>("/api/v1/user");
|
user.value = await $dropFetch<UserModel | null>("/api/v1/user");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { DialogTitle } from "@headlessui/vue";
|
import { DialogTitle } from "@headlessui/vue";
|
||||||
import type { CollectionEntry, Game } from "~/prisma/client";
|
import type { CollectionEntryModel, GameModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@ -79,7 +79,7 @@ async function createCollection() {
|
|||||||
// Add the game if provided
|
// Add the game if provided
|
||||||
if (props.gameId) {
|
if (props.gameId) {
|
||||||
const entry = await $dropFetch<
|
const entry = await $dropFetch<
|
||||||
CollectionEntry & { game: SerializeObject<Game> }
|
CollectionEntryModel & { game: SerializeObject<GameModel> }
|
||||||
>(`/api/v1/collection/${response.id}/entry`, {
|
>(`/api/v1/collection/${response.id}/entry`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: { id: props.gameId },
|
body: { id: props.gameId },
|
||||||
|
|||||||
@ -35,10 +35,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Collection } from "~/prisma/client";
|
import type { CollectionModel } from "~/prisma/client/models";
|
||||||
import { DialogTitle } from "@headlessui/vue";
|
import { DialogTitle } from "@headlessui/vue";
|
||||||
|
|
||||||
const collection = defineModel<Collection | undefined>();
|
const collection = defineModel<CollectionModel | undefined>();
|
||||||
const deleteLoading = ref(false);
|
const deleteLoading = ref(false);
|
||||||
|
|
||||||
const collections = await useCollections();
|
const collections = await useCollections();
|
||||||
|
|||||||
@ -36,9 +36,9 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DialogTitle } from "@headlessui/vue";
|
import { DialogTitle } from "@headlessui/vue";
|
||||||
import type { User } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const user = defineModel<User | undefined>();
|
const user = defineModel<UserModel | undefined>();
|
||||||
const deleteLoading = ref(false);
|
const deleteLoading = ref(false);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|||||||
@ -35,11 +35,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Game } from "~/prisma/client";
|
import type { GameModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
items: Array<SerializeObject<Game>>;
|
items: Array<SerializeObject<GameModel>>;
|
||||||
min?: number;
|
min?: number;
|
||||||
width?: number;
|
width?: number;
|
||||||
}>();
|
}>();
|
||||||
@ -51,7 +51,7 @@ const { showGamePanelTextDecoration } = await $dropFetch(
|
|||||||
const currentComponent = ref<HTMLDivElement>();
|
const currentComponent = ref<HTMLDivElement>();
|
||||||
|
|
||||||
const min = computed(() => Math.max(props.min ?? 8, props.items.length));
|
const min = computed(() => Math.max(props.min ?? 8, props.items.length));
|
||||||
const games: Ref<Array<SerializeObject<Game> | undefined>> = computed(() =>
|
const games: Ref<Array<SerializeObject<GameModel> | undefined>> = computed(() =>
|
||||||
Array(min.value)
|
Array(min.value)
|
||||||
.fill(0)
|
.fill(0)
|
||||||
.map((_, i) => props.items[i]),
|
.map((_, i) => props.items[i]),
|
||||||
|
|||||||
@ -274,7 +274,7 @@
|
|||||||
accept="image/*"
|
accept="image/*"
|
||||||
endpoint="/api/v1/admin/game/image"
|
endpoint="/api/v1/admin/game/image"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
@upload="(result: Game) => uploadAfterImageUpload(result)"
|
@upload="(result: GameModel) => uploadAfterImageUpload(result)"
|
||||||
/>
|
/>
|
||||||
<ModalTemplate v-model="showAddCarouselModal">
|
<ModalTemplate v-model="showAddCarouselModal">
|
||||||
<template #default>
|
<template #default>
|
||||||
@ -440,7 +440,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Game } from "~/prisma/client";
|
import type { GameModel } from "~/prisma/client/models";
|
||||||
import { micromark } from "micromark";
|
import { micromark } from "micromark";
|
||||||
import {
|
import {
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
@ -461,7 +461,9 @@ const showAddImageDescriptionModal = ref(false);
|
|||||||
const showEditCoreMetadata = ref(false);
|
const showEditCoreMetadata = ref(false);
|
||||||
const mobileShowFinalDescription = ref(true);
|
const mobileShowFinalDescription = ref(true);
|
||||||
|
|
||||||
const game = defineModel<SerializeObject<Game>>() as Ref<SerializeObject<Game>>;
|
const game = defineModel<SerializeObject<GameModel>>() as Ref<
|
||||||
|
SerializeObject<GameModel>
|
||||||
|
>;
|
||||||
if (!game.value)
|
if (!game.value)
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 500,
|
statusCode: 500,
|
||||||
@ -563,7 +565,7 @@ const descriptionSaving = ref<DescriptionSavingState>(
|
|||||||
|
|
||||||
let savingTimeout: undefined | NodeJS.Timeout;
|
let savingTimeout: undefined | NodeJS.Timeout;
|
||||||
|
|
||||||
type PatchGameBody = Partial<Game>;
|
type PatchGameBody = Partial<GameModel>;
|
||||||
|
|
||||||
watch(descriptionHTML, (_v) => {
|
watch(descriptionHTML, (_v) => {
|
||||||
descriptionSaving.value = DescriptionSavingState.Waiting;
|
descriptionSaving.value = DescriptionSavingState.Waiting;
|
||||||
@ -693,7 +695,7 @@ async function deleteImage(id: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadAfterImageUpload(result: Game) {
|
async function uploadAfterImageUpload(result: GameModel) {
|
||||||
if (!game.value) return;
|
if (!game.value) return;
|
||||||
game.value.mImageLibraryObjectIds = result.mImageLibraryObjectIds;
|
game.value.mImageLibraryObjectIds = result.mImageLibraryObjectIds;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,9 @@
|
|||||||
class="mt-2 space-y-4"
|
class="mt-2 space-y-4"
|
||||||
@update="() => updateVersionOrder()"
|
@update="() => updateVersionOrder()"
|
||||||
>
|
>
|
||||||
<template #item="{ element: item }: { element: GameVersion }">
|
<template
|
||||||
|
#item="{ element: item }: { element: GameVersionModel }"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between"
|
class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between"
|
||||||
>
|
>
|
||||||
@ -97,7 +99,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Game, GameVersion } from "~/prisma/client";
|
import type { GameModel, GameVersionModel } from "~/prisma/client/models";
|
||||||
import { Bars3Icon, TrashIcon } from "@heroicons/vue/24/solid";
|
import { Bars3Icon, TrashIcon } from "@heroicons/vue/24/solid";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
import type { H3Error } from "h3";
|
import type { H3Error } from "h3";
|
||||||
@ -112,7 +114,7 @@ defineProps<{ unimportedVersions: string[] }>();
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
type GameAndVersions = Game & { versions: GameVersion[] };
|
type GameAndVersions = GameModel & { versions: GameVersionModel[] };
|
||||||
const game = defineModel<SerializeObject<GameAndVersions>>() as Ref<
|
const game = defineModel<SerializeObject<GameAndVersions>>() as Ref<
|
||||||
SerializeObject<GameAndVersions>
|
SerializeObject<GameAndVersions>
|
||||||
>;
|
>;
|
||||||
|
|||||||
@ -44,9 +44,9 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { XMarkIcon } from "@heroicons/vue/24/solid";
|
import { XMarkIcon } from "@heroicons/vue/24/solid";
|
||||||
import type { Notification } from "~/prisma/client";
|
import type { NotificationModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const props = defineProps<{ notification: Notification }>();
|
const props = defineProps<{ notification: NotificationModel }>();
|
||||||
|
|
||||||
async function deleteMe() {
|
async function deleteMe() {
|
||||||
await $dropFetch(`/api/v1/notifications/${props.notification.id}`, {
|
await $dropFetch(`/api/v1/notifications/${props.notification.id}`, {
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Notification } from "~/prisma/client";
|
import type { NotificationModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const props = defineProps<{ notifications: Array<Notification> }>();
|
const props = defineProps<{ notifications: Array<NotificationModel> }>();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
import type { Collection, CollectionEntry, Game } from "~/prisma/client";
|
import type {
|
||||||
|
CollectionModel,
|
||||||
|
CollectionEntryModel,
|
||||||
|
GameModel,
|
||||||
|
} from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
|
|
||||||
type FullCollection = Collection & {
|
type FullCollection = CollectionModel & {
|
||||||
entries: Array<CollectionEntry & { game: SerializeObject<Game> }>;
|
entries: Array<CollectionEntryModel & { game: SerializeObject<GameModel> }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useCollections = async () => {
|
export const useCollections = async () => {
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import type { Article } from "~/prisma/client";
|
import type { ArticleModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
|
|
||||||
export const useNews = () =>
|
export const useNews = () =>
|
||||||
useState<
|
useState<
|
||||||
| Array<
|
| Array<
|
||||||
SerializeObject<
|
SerializeObject<
|
||||||
Article & {
|
ArticleModel & {
|
||||||
tags: Array<{ id: string; name: string }>;
|
tags: Array<{ id: string; name: string }>;
|
||||||
author: { displayName: string; id: string } | null;
|
author: { displayName: string; id: string } | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import type { Notification } from "~/prisma/client";
|
import type { NotificationModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const ws = new WebSocketHandler("/api/v1/notifications/ws");
|
const ws = new WebSocketHandler("/api/v1/notifications/ws");
|
||||||
|
|
||||||
export const useNotifications = () =>
|
export const useNotifications = () =>
|
||||||
useState<Array<Notification>>("notifications", () => []);
|
useState<Array<NotificationModel>>("notifications", () => []);
|
||||||
|
|
||||||
ws.listen((e) => {
|
ws.listen((e) => {
|
||||||
const notification = JSON.parse(e) as Notification;
|
const notification = JSON.parse(e) as NotificationModel;
|
||||||
const notifications = useNotifications();
|
const notifications = useNotifications();
|
||||||
notifications.value.push(notification);
|
notifications.value.push(notification);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import type { User } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
// undefined = haven't check
|
// undefined = haven't check
|
||||||
// null = check, no user
|
// null = check, no user
|
||||||
// {} = check, user
|
// {} = check, user
|
||||||
|
|
||||||
export const useUser = () => useState<User | undefined | null>(undefined);
|
export const useUser = () => useState<UserModel | undefined | null>(undefined);
|
||||||
export const updateUser = async () => {
|
export const updateUser = async () => {
|
||||||
const user = useUser();
|
const user = useUser();
|
||||||
if (user.value === null) return;
|
if (user.value === null) return;
|
||||||
|
|
||||||
user.value = await $dropFetch<User | null>("/api/v1/user");
|
user.value = await $dropFetch<UserModel | null>("/api/v1/user");
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
import type { User, AuthMec } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
|
import type { AuthMec } from "~/prisma/client/enums";
|
||||||
|
|
||||||
export const useUsers = () =>
|
export const useUsers = () =>
|
||||||
useState<
|
useState<
|
||||||
| Array<
|
| Array<
|
||||||
SerializeObject<
|
SerializeObject<
|
||||||
User & {
|
UserModel & {
|
||||||
authMecs?: Array<{ id: string; mec: AuthMec }>;
|
authMecs?: Array<{ id: string; mec: AuthMec }>;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -280,7 +280,7 @@ function getDropVersion(): string {
|
|||||||
path.dirname(import.meta.url.replace("file://", "")),
|
path.dirname(import.meta.url.replace("file://", "")),
|
||||||
"package.json",
|
"package.json",
|
||||||
);
|
);
|
||||||
console.log(`Reading package.json from ${packageJsonPath}`);
|
|
||||||
if (!existsSync(packageJsonPath)) {
|
if (!existsSync(packageJsonPath)) {
|
||||||
console.error("Could not find package.json, using default version.");
|
console.error("Could not find package.json, using default version.");
|
||||||
return defaultVersion;
|
return defaultVersion;
|
||||||
|
|||||||
15
package.json
15
package.json
@ -17,7 +17,7 @@
|
|||||||
"lint:fix": "eslint . --fix && prettier --write --list-different ."
|
"lint:fix": "eslint . --fix && prettier --write --list-different ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordapp/twemoji": "^15.1.0",
|
"@discordapp/twemoji": "^16.0.1",
|
||||||
"@drop-oss/droplet": "1.6.0",
|
"@drop-oss/droplet": "1.6.0",
|
||||||
"@headlessui/vue": "^1.7.23",
|
"@headlessui/vue": "^1.7.23",
|
||||||
"@heroicons/vue": "^2.1.5",
|
"@heroicons/vue": "^2.1.5",
|
||||||
@ -25,9 +25,9 @@
|
|||||||
"@nuxt/fonts": "^0.11.0",
|
"@nuxt/fonts": "^0.11.0",
|
||||||
"@nuxt/image": "^1.10.0",
|
"@nuxt/image": "^1.10.0",
|
||||||
"@nuxtjs/i18n": "^9.5.5",
|
"@nuxtjs/i18n": "^9.5.5",
|
||||||
"@prisma/client": "^6.7.0",
|
"@prisma/client": "^6.11.1",
|
||||||
"@tailwindcss/vite": "^4.0.6",
|
"@tailwindcss/vite": "^4.0.6",
|
||||||
"argon2": "^0.41.1",
|
"argon2": "^0.43.0",
|
||||||
"arktype": "^2.1.10",
|
"arktype": "^2.1.10",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"bcryptjs": "^3.0.2",
|
"bcryptjs": "^3.0.2",
|
||||||
@ -43,7 +43,7 @@
|
|||||||
"nuxt-security": "2.2.0",
|
"nuxt-security": "2.2.0",
|
||||||
"pino": "^9.7.0",
|
"pino": "^9.7.0",
|
||||||
"pino-pretty": "^13.0.0",
|
"pino-pretty": "^13.0.0",
|
||||||
"prisma": "^6.7.0",
|
"prisma": "^6.11.1",
|
||||||
"sanitize-filename": "^1.6.3",
|
"sanitize-filename": "^1.6.3",
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"stream-mime-type": "^2.0.0",
|
"stream-mime-type": "^2.0.0",
|
||||||
@ -52,7 +52,7 @@
|
|||||||
"vite-plugin-static-copy": "^3.0.0",
|
"vite-plugin-static-copy": "^3.0.0",
|
||||||
"vue": "latest",
|
"vue": "latest",
|
||||||
"vue-router": "latest",
|
"vue-router": "latest",
|
||||||
"vue3-carousel": "^0.15.0",
|
"vue3-carousel": "^0.16.0",
|
||||||
"vue3-carousel-nuxt": "^1.1.5",
|
"vue3-carousel-nuxt": "^1.1.5",
|
||||||
"vuedraggable": "^4.1.0"
|
"vuedraggable": "^4.1.0"
|
||||||
},
|
},
|
||||||
@ -72,17 +72,16 @@
|
|||||||
"h3": "^1.15.3",
|
"h3": "^1.15.3",
|
||||||
"nitropack": "^2.11.12",
|
"nitropack": "^2.11.12",
|
||||||
"ofetch": "^1.4.1",
|
"ofetch": "^1.4.1",
|
||||||
"postcss": "^8.4.47",
|
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"sass": "^1.79.4",
|
"sass": "^1.79.4",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vue-tsc": "^2.2.8"
|
"vue-tsc": "^3.0.1"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"vue3-carousel-nuxt": {
|
"vue3-carousel-nuxt": {
|
||||||
"vue3-carousel": "^0.15.0"
|
"vue3-carousel": "^0.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prisma": {
|
"prisma": {
|
||||||
|
|||||||
@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { CheckIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
import { CheckIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
import type { Notification } from "~/prisma/client";
|
import type { NotificationModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
@ -106,7 +106,7 @@ useHead({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Fetch notifications
|
// Fetch notifications
|
||||||
const notifications = ref<SerializeObject<Notification>[]>([]);
|
const notifications = ref<SerializeObject<NotificationModel>[]>([]);
|
||||||
|
|
||||||
async function fetchNotifications() {
|
async function fetchNotifications() {
|
||||||
const { data } = await useFetch("/api/v1/notifications");
|
const { data } = await useFetch("/api/v1/notifications");
|
||||||
@ -120,7 +120,7 @@ await fetchNotifications();
|
|||||||
async function markAsRead(id: string) {
|
async function markAsRead(id: string) {
|
||||||
await $dropFetch(`/api/v1/notifications/${id}/read`, { method: "POST" });
|
await $dropFetch(`/api/v1/notifications/${id}/read`, { method: "POST" });
|
||||||
const notification = notifications.value.find(
|
const notification = notifications.value.find(
|
||||||
(n: SerializeObject<Notification>) => n.id === id,
|
(n: SerializeObject<NotificationModel>) => n.id === id,
|
||||||
);
|
);
|
||||||
if (notification) {
|
if (notification) {
|
||||||
notification.read = true;
|
notification.read = true;
|
||||||
@ -130,16 +130,18 @@ async function markAsRead(id: string) {
|
|||||||
// Mark all notifications as read
|
// Mark all notifications as read
|
||||||
async function markAllAsRead() {
|
async function markAllAsRead() {
|
||||||
await $dropFetch("/api/v1/notifications/readall", { method: "POST" });
|
await $dropFetch("/api/v1/notifications/readall", { method: "POST" });
|
||||||
notifications.value.forEach((notification: SerializeObject<Notification>) => {
|
notifications.value.forEach(
|
||||||
notification.read = true;
|
(notification: SerializeObject<NotificationModel>) => {
|
||||||
});
|
notification.read = true;
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a notification
|
// Delete a notification
|
||||||
async function deleteNotification(id: string) {
|
async function deleteNotification(id: string) {
|
||||||
await $dropFetch(`/api/v1/notifications/${id}`, { method: "DELETE" });
|
await $dropFetch(`/api/v1/notifications/${id}`, { method: "DELETE" });
|
||||||
const index = notifications.value.findIndex(
|
const index = notifications.value.findIndex(
|
||||||
(n: SerializeObject<Notification>) => n.id === id,
|
(n: SerializeObject<NotificationModel>) => n.id === id,
|
||||||
);
|
);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
notifications.value.splice(index, 1);
|
notifications.value.splice(index, 1);
|
||||||
|
|||||||
@ -272,7 +272,7 @@ import { XCircleIcon } from "@heroicons/vue/20/solid";
|
|||||||
import { CheckIcon, DocumentIcon, XMarkIcon } from "@heroicons/vue/24/outline";
|
import { CheckIcon, DocumentIcon, XMarkIcon } from "@heroicons/vue/24/outline";
|
||||||
import { FetchError } from "ofetch";
|
import { FetchError } from "ofetch";
|
||||||
import type { Component } from "vue";
|
import type { Component } from "vue";
|
||||||
import type { LibraryBackend } from "~/prisma/client";
|
import type { LibraryBackend } from "~/prisma/client/enums";
|
||||||
import type { WorkingLibrarySource } from "~/server/api/v1/admin/library/sources/index.get";
|
import type { WorkingLibrarySource } from "~/server/api/v1/admin/library/sources/index.get";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
|
|||||||
@ -116,7 +116,7 @@ import { IconsSimpleAuthenticationLogo, IconsSSOLogo } from "#components";
|
|||||||
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
||||||
import { EllipsisHorizontalIcon } from "@heroicons/vue/20/solid";
|
import { EllipsisHorizontalIcon } from "@heroicons/vue/20/solid";
|
||||||
import { CheckIcon, XMarkIcon } from "@heroicons/vue/24/solid";
|
import { CheckIcon, XMarkIcon } from "@heroicons/vue/24/solid";
|
||||||
import type { AuthMec } from "~/prisma/client";
|
import type { AuthMec } from "~/prisma/client/enums";
|
||||||
import type { Component } from "vue";
|
import type { Component } from "vue";
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
|
|||||||
@ -394,7 +394,7 @@ import {
|
|||||||
} from "@headlessui/vue";
|
} from "@headlessui/vue";
|
||||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||||
import { TrashIcon, XCircleIcon } from "@heroicons/vue/24/solid";
|
import { TrashIcon, XCircleIcon } from "@heroicons/vue/24/solid";
|
||||||
import type { Invitation } from "~/prisma/client";
|
import type { InvitationModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack";
|
import type { SerializeObject } from "nitropack";
|
||||||
import type { DurationLike } from "luxon";
|
import type { DurationLike } from "luxon";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
@ -410,7 +410,7 @@ useHead({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const data = await $dropFetch<
|
const data = await $dropFetch<
|
||||||
Array<SerializeObject<Invitation & { inviteUrl: string }>>
|
Array<SerializeObject<InvitationModel & { inviteUrl: string }>>
|
||||||
>("/api/v1/admin/auth/invitation");
|
>("/api/v1/admin/auth/invitation");
|
||||||
const invitations = ref(data ?? []);
|
const invitations = ref(data ?? []);
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useUsers } from "~/composables/users";
|
import { useUsers } from "~/composables/users";
|
||||||
import type { User } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: "Users",
|
title: "Users",
|
||||||
@ -163,5 +163,5 @@ if (!users.value) {
|
|||||||
|
|
||||||
const userToDelete = ref();
|
const userToDelete = ref();
|
||||||
|
|
||||||
const setUserToDelete = (user: User) => (userToDelete.value = user);
|
const setUserToDelete = (user: UserModel) => (userToDelete.value = user);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AuthMec } from "~/prisma/client";
|
import type { AuthMec } from "~/prisma/client/enums";
|
||||||
import DropLogo from "~/components/DropLogo.vue";
|
import DropLogo from "~/components/DropLogo.vue";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|||||||
@ -95,12 +95,12 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TrashIcon, PlusIcon } from "@heroicons/vue/20/solid";
|
import { TrashIcon, PlusIcon } from "@heroicons/vue/20/solid";
|
||||||
import type { Collection } from "~/prisma/client";
|
import type { CollectionModel } from "~/prisma/client/models";
|
||||||
|
|
||||||
const collections = await useCollections();
|
const collections = await useCollections();
|
||||||
const collectionCreateOpen = ref(false);
|
const collectionCreateOpen = ref(false);
|
||||||
|
|
||||||
const currentlyDeleting = ref<Collection | undefined>();
|
const currentlyDeleting = ref<CollectionModel | undefined>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const library = await useLibrary();
|
const library = await useLibrary();
|
||||||
|
|||||||
@ -90,14 +90,14 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DocumentIcon } from "@heroicons/vue/24/outline";
|
import { DocumentIcon } from "@heroicons/vue/24/outline";
|
||||||
import type { Article } from "~/prisma/client";
|
import type { ArticleModel } from "~/prisma/client/models";
|
||||||
import type { SerializeObject } from "nitropack/types";
|
import type { SerializeObject } from "nitropack/types";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const { articles } = defineProps<{
|
const { articles } = defineProps<{
|
||||||
articles: SerializeObject<
|
articles: SerializeObject<
|
||||||
Article & {
|
ArticleModel & {
|
||||||
tags: Array<{ name: string; id: string }>;
|
tags: Array<{ name: string; id: string }>;
|
||||||
author: { displayName: string };
|
author: { displayName: string };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
// This is your Prisma schema file,
|
// This is your Prisma schema file,
|
||||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||||
|
|
||||||
|
// see https://github.com/prisma/prisma/issues/27486 why driverAdapters can't be used
|
||||||
|
// TLDR: vite removes it during bundling it or something like that
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client"
|
provider = "prisma-client"
|
||||||
output = "client"
|
output = "client"
|
||||||
moduleFormat = "esm"
|
previewFeatures = ["fullTextSearchPostgres", "relationJoins"]
|
||||||
previewFeatures = ["fullTextSearchPostgres"]
|
|
||||||
binaryTargets = ["native", "debian-openssl-3.0.x"]
|
binaryTargets = ["native", "debian-openssl-3.0.x"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { AuthMec } from "~/prisma/client";
|
import { AuthMec } from "~/prisma/client/enums";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import authManager from "~/server/internal/auth";
|
import authManager from "~/server/internal/auth";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Prisma } from "~/prisma/client";
|
import type { Prisma } from "~/prisma/client/client";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
import { handleFileUpload } from "~/server/internal/utils/handlefileupload";
|
import { handleFileUpload } from "~/server/internal/utils/handlefileupload";
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import type { Library } from "~/prisma/client";
|
import type { LibraryModel } from "~/prisma/client/models";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import libraryManager from "~/server/internal/library";
|
import libraryManager from "~/server/internal/library";
|
||||||
|
|
||||||
export type WorkingLibrarySource = Library & { working: boolean };
|
export type WorkingLibrarySource = LibraryModel & { working: boolean };
|
||||||
|
|
||||||
export default defineEventHandler(async (h3) => {
|
export default defineEventHandler(async (h3) => {
|
||||||
const allowed = await aclManager.allowSystemACL(h3, ["library:sources:read"]);
|
const allowed = await aclManager.allowSystemACL(h3, ["library:sources:read"]);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
import { LibraryBackend } from "~/prisma/client";
|
import { LibraryBackend } from "~/prisma/client/enums";
|
||||||
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { AuthMec } from "~/prisma/client";
|
import { AuthMec } from "~/prisma/client/enums";
|
||||||
import type { JsonArray } from "@prisma/client/runtime/library";
|
import type { JsonArray } from "@prisma/client/runtime/library";
|
||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { AuthMec } from "~/prisma/client";
|
import { AuthMec } from "~/prisma/client/enums";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
import authManager, { createHashArgon2 } from "~/server/internal/auth";
|
import authManager, { createHashArgon2 } from "~/server/internal/auth";
|
||||||
import * as jdenticon from "jdenticon";
|
import * as jdenticon from "jdenticon";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
import saveManager from "~/server/internal/saves";
|
import saveManager from "~/server/internal/saves";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import { applicationSettings } from "~/server/internal/config/application-configuration";
|
import { applicationSettings } from "~/server/internal/config/application-configuration";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
import { applicationSettings } from "~/server/internal/config/application-configuration";
|
import { applicationSettings } from "~/server/internal/config/application-configuration";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { APITokenMode } from "~/prisma/client";
|
import { APITokenMode } from "~/prisma/client/enums";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import type { UserACL } from "~/server/internal/acls";
|
import type { UserACL } from "~/server/internal/acls";
|
||||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { APITokenMode } from "~/prisma/client";
|
import { APITokenMode } from "~/prisma/client/enums";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { APITokenMode } from "~/prisma/client";
|
import { APITokenMode } from "~/prisma/client/enums";
|
||||||
import aclManager from "~/server/internal/acls";
|
import aclManager from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { APITokenMode } from "~/prisma/client";
|
import { APITokenMode } from "~/prisma/client/enums";
|
||||||
import aclManager, { userACLs } from "~/server/internal/acls";
|
import aclManager, { userACLs } from "~/server/internal/acls";
|
||||||
import prisma from "~/server/internal/db/database";
|
import prisma from "~/server/internal/db/database";
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { APITokenMode } from "~/prisma/client";
|
import { APITokenMode } from "~/prisma/client/enums";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
import sessionHandler from "../session";
|
import sessionHandler from "../session";
|
||||||
import type { MinimumRequestObject } from "~/server/h3";
|
import type { MinimumRequestObject } from "~/server/h3";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { AuthMec } from "~/prisma/client";
|
import { AuthMec } from "~/prisma/client/enums";
|
||||||
import { OIDCManager } from "./oidc";
|
import { OIDCManager } from "./oidc";
|
||||||
import { logger } from "~/server/internal/logging";
|
import { logger } from "~/server/internal/logging";
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { randomUUID } from "crypto";
|
import { randomUUID } from "crypto";
|
||||||
import prisma from "../../db/database";
|
import prisma from "../../db/database";
|
||||||
import type { User } from "~/prisma/client";
|
import type { UserModel } from "~/prisma/client/models";
|
||||||
import { AuthMec } from "~/prisma/client";
|
import { AuthMec } from "~/prisma/client/enums";
|
||||||
import objectHandler from "../../objects";
|
import objectHandler from "../../objects";
|
||||||
import type { Readable } from "stream";
|
import type { Readable } from "stream";
|
||||||
import * as jdenticon from "jdenticon";
|
import * as jdenticon from "jdenticon";
|
||||||
@ -165,7 +165,7 @@ export class OIDCManager {
|
|||||||
async authorize(
|
async authorize(
|
||||||
code: string,
|
code: string,
|
||||||
state: string,
|
state: string,
|
||||||
): Promise<{ user: User; options: OIDCAuthSessionOptions } | string> {
|
): Promise<{ user: UserModel; options: OIDCAuthSessionOptions } | string> {
|
||||||
const session = this.signinStateTable[state];
|
const session = this.signinStateTable[state];
|
||||||
if (!session) return "Invalid state parameter";
|
if (!session) return "Invalid state parameter";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { EnumDictionary } from "../utils/types";
|
import type { EnumDictionary } from "../utils/types";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
import { ClientCapabilities } from "~/prisma/client";
|
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||||
|
|
||||||
// These values are technically mapped to the database,
|
// These values are technically mapped to the database,
|
||||||
// but Typescript/Prisma doesn't let me link them
|
// but Typescript/Prisma doesn't let me link them
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Client, User } from "~/prisma/client";
|
import type { ClientModel, UserModel } from "~/prisma/client/models";
|
||||||
import type { EventHandlerRequest, H3Event } from "h3";
|
import type { EventHandlerRequest, H3Event } from "h3";
|
||||||
import droplet from "@drop-oss/droplet";
|
import droplet from "@drop-oss/droplet";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
@ -11,8 +11,8 @@ export type EventHandlerFunction<T> = (
|
|||||||
|
|
||||||
type ClientUtils = {
|
type ClientUtils = {
|
||||||
clientId: string;
|
clientId: string;
|
||||||
fetchClient: () => Promise<Client>;
|
fetchClient: () => Promise<ClientModel>;
|
||||||
fetchUser: () => Promise<User>;
|
fetchUser: () => Promise<UserModel>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const NONCE_LENIENCE = 30_000;
|
const NONCE_LENIENCE = 30_000;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
import type { Platform } from "~/prisma/client";
|
import type { Platform } from "~/prisma/client/enums";
|
||||||
import { useCertificateAuthority } from "~/server/plugins/ca";
|
import { useCertificateAuthority } from "~/server/plugins/ca";
|
||||||
import type {
|
import type {
|
||||||
CapabilityConfiguration,
|
CapabilityConfiguration,
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import type { ApplicationSettings } from "~/prisma/client";
|
import type { ApplicationSettingsModel } from "~/prisma/client/models";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
|
|
||||||
class ApplicationConfiguration {
|
class ApplicationConfiguration {
|
||||||
// Reference to the currently selected application configuration
|
// Reference to the currently selected application configuration
|
||||||
private currentApplicationSettings: ApplicationSettings | undefined =
|
private currentApplicationSettings: ApplicationSettingsModel | undefined =
|
||||||
undefined;
|
undefined;
|
||||||
|
|
||||||
private async save() {
|
private async save() {
|
||||||
await this.init();
|
await this.init();
|
||||||
|
|
||||||
const deepAppConfigCopy: Omit<ApplicationSettings, "timestamp"> & {
|
const deepAppConfigCopy: Omit<ApplicationSettingsModel, "timestamp"> & {
|
||||||
timestamp?: Date;
|
timestamp?: Date;
|
||||||
} = JSON.parse(JSON.stringify(this.currentApplicationSettings));
|
} = JSON.parse(JSON.stringify(this.currentApplicationSettings));
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ class ApplicationConfiguration {
|
|||||||
this.currentApplicationSettings = latestState;
|
this.currentApplicationSettings = latestState;
|
||||||
}
|
}
|
||||||
|
|
||||||
async set<T extends keyof ApplicationSettings>(
|
async set<T extends keyof ApplicationSettingsModel>(
|
||||||
key: T,
|
key: T,
|
||||||
value: ApplicationSettings[T],
|
value: ApplicationSettingsModel[T],
|
||||||
) {
|
) {
|
||||||
await this.init();
|
await this.init();
|
||||||
if (!this.currentApplicationSettings)
|
if (!this.currentApplicationSettings)
|
||||||
@ -71,9 +71,9 @@ class ApplicationConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async get<T extends keyof ApplicationSettings>(
|
async get<T extends keyof ApplicationSettingsModel>(
|
||||||
key: T,
|
key: T,
|
||||||
): Promise<ApplicationSettings[T]> {
|
): Promise<ApplicationSettingsModel[T]> {
|
||||||
await this.init();
|
await this.init();
|
||||||
if (!this.currentApplicationSettings)
|
if (!this.currentApplicationSettings)
|
||||||
throw new Error("Somehow, failed to initialise application settings");
|
throw new Error("Somehow, failed to initialise application settings");
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
import { PrismaClient } from "~/prisma/client";
|
import { PrismaClient } from "~/prisma/client/client";
|
||||||
|
// import { PrismaPg } from "@prisma/adapter-pg";
|
||||||
|
|
||||||
const prismaClientSingleton = () => {
|
const prismaClientSingleton = () => {
|
||||||
return new PrismaClient({});
|
// const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
|
||||||
|
// const prisma = new PrismaClient({ adapter });
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
return prisma;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare const globalThis: {
|
declare const globalThis: {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { GameVersion } from "~/prisma/client";
|
import type { GameVersionModel } from "~/prisma/client/models";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
|
|
||||||
export type DropChunk = {
|
export type DropChunk = {
|
||||||
@ -54,7 +54,7 @@ class ManifestGenerator {
|
|||||||
|
|
||||||
// Local function because eventual caching
|
// Local function because eventual caching
|
||||||
async generateManifest(gameId: string, versionName: string) {
|
async generateManifest(gameId: string, versionName: string) {
|
||||||
const versions: GameVersion[] = [];
|
const versions: GameVersionModel[] = [];
|
||||||
|
|
||||||
const baseVersion = await prisma.gameVersion.findUnique({
|
const baseVersion = await prisma.gameVersion.findUnique({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { LibraryBackend } from "~/prisma/client";
|
import type { LibraryBackend } from "~/prisma/client/enums";
|
||||||
|
|
||||||
export abstract class LibraryProvider<CFG> {
|
export abstract class LibraryProvider<CFG> {
|
||||||
constructor(_config: CFG, _id: string) {
|
constructor(_config: CFG, _id: string) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
VersionNotFoundError,
|
VersionNotFoundError,
|
||||||
type LibraryProvider,
|
type LibraryProvider,
|
||||||
} from "../provider";
|
} from "../provider";
|
||||||
import { LibraryBackend } from "~/prisma/client";
|
import { LibraryBackend } from "~/prisma/client/enums";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import droplet from "@drop-oss/droplet";
|
import droplet from "@drop-oss/droplet";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ArkErrors, type } from "arktype";
|
import { ArkErrors, type } from "arktype";
|
||||||
import type { LibraryProvider } from "../provider";
|
import type { LibraryProvider } from "../provider";
|
||||||
import { VersionNotFoundError } from "../provider";
|
import { VersionNotFoundError } from "../provider";
|
||||||
import { LibraryBackend } from "~/prisma/client";
|
import { LibraryBackend } from "~/prisma/client/enums";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import droplet from "@drop-oss/droplet";
|
import droplet from "@drop-oss/droplet";
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import pino from "pino";
|
import pino from "pino";
|
||||||
import "pino-pretty";
|
import pinoPretty from "pino-pretty";
|
||||||
|
|
||||||
|
// call pino pretty so that it isn't excluded from the build
|
||||||
|
pinoPretty();
|
||||||
|
|
||||||
export const logger = pino({
|
export const logger = pino({
|
||||||
transport: {
|
transport: {
|
||||||
@ -9,5 +12,3 @@ export const logger = pino({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.child({});
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { MetadataSource, type Company } from "~/prisma/client";
|
import type { CompanyModel } from "~/prisma/client/models";
|
||||||
|
import { MetadataSource } from "~/prisma/client/enums";
|
||||||
import type { MetadataProvider } from ".";
|
import type { MetadataProvider } from ".";
|
||||||
import { MissingMetadataProviderConfig } from ".";
|
import { MissingMetadataProviderConfig } from ".";
|
||||||
import type {
|
import type {
|
||||||
@ -178,7 +179,7 @@ export class GiantBombProvider implements MetadataProvider {
|
|||||||
? this.turndown.turndown(gameData.description)
|
? this.turndown.turndown(gameData.description)
|
||||||
: gameData.deck;
|
: gameData.deck;
|
||||||
|
|
||||||
const publishers: Company[] = [];
|
const publishers: CompanyModel[] = [];
|
||||||
if (gameData.publishers) {
|
if (gameData.publishers) {
|
||||||
for (const pub of gameData.publishers) {
|
for (const pub of gameData.publishers) {
|
||||||
context?.logger.info(`Importing publisher "${pub.name}"`);
|
context?.logger.info(`Importing publisher "${pub.name}"`);
|
||||||
@ -195,7 +196,7 @@ export class GiantBombProvider implements MetadataProvider {
|
|||||||
|
|
||||||
context?.progress(35);
|
context?.progress(35);
|
||||||
|
|
||||||
const developers: Company[] = [];
|
const developers: CompanyModel[] = [];
|
||||||
if (gameData.developers) {
|
if (gameData.developers) {
|
||||||
for (const dev of gameData.developers) {
|
for (const dev of gameData.developers) {
|
||||||
context?.logger.info(`Importing developer "${dev.name}"`);
|
context?.logger.info(`Importing developer "${dev.name}"`);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { Company } from "~/prisma/client";
|
import type { CompanyModel } from "~/prisma/client/models";
|
||||||
import { MetadataSource } from "~/prisma/client";
|
import { MetadataSource } from "~/prisma/client/enums";
|
||||||
import type { MetadataProvider } from ".";
|
import type { MetadataProvider } from ".";
|
||||||
import { MissingMetadataProviderConfig } from ".";
|
import { MissingMetadataProviderConfig } from ".";
|
||||||
import type {
|
import type {
|
||||||
@ -386,8 +386,8 @@ export class IGDBProvider implements MetadataProvider {
|
|||||||
|
|
||||||
context?.progress(20);
|
context?.progress(20);
|
||||||
|
|
||||||
const publishers: Company[] = [];
|
const publishers: CompanyModel[] = [];
|
||||||
const developers: Company[] = [];
|
const developers: CompanyModel[] = [];
|
||||||
for (const involvedCompany of currentGame.involved_companies ?? []) {
|
for (const involvedCompany of currentGame.involved_companies ?? []) {
|
||||||
// get details about the involved company
|
// get details about the involved company
|
||||||
const involved_company_response = await this.request<IGDBInvolvedCompany>(
|
const involved_company_response = await this.request<IGDBInvolvedCompany>(
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { type Prisma, MetadataSource } from "~/prisma/client";
|
import type { Prisma } from "~/prisma/client/client";
|
||||||
|
import { MetadataSource } from "~/prisma/client/enums";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
import type {
|
import type {
|
||||||
_FetchGameMetadataParams,
|
_FetchGameMetadataParams,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { MetadataSource } from "~/prisma/client";
|
import { MetadataSource } from "~/prisma/client/enums";
|
||||||
import type { MetadataProvider } from ".";
|
import type { MetadataProvider } from ".";
|
||||||
import type {
|
import type {
|
||||||
_FetchGameMetadataParams,
|
_FetchGameMetadataParams,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { Company } from "~/prisma/client";
|
import type { CompanyModel } from "~/prisma/client/models";
|
||||||
import { MetadataSource } from "~/prisma/client";
|
import { MetadataSource } from "~/prisma/client/enums";
|
||||||
import type { MetadataProvider } from ".";
|
import type { MetadataProvider } from ".";
|
||||||
import type {
|
import type {
|
||||||
GameMetadataSearchResult,
|
GameMetadataSearchResult,
|
||||||
@ -396,7 +396,7 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
|||||||
|
|
||||||
const game = res.data.cargoquery[0].title;
|
const game = res.data.cargoquery[0].title;
|
||||||
|
|
||||||
const publishers: Company[] = [];
|
const publishers: CompanyModel[] = [];
|
||||||
if (game.Publishers !== null) {
|
if (game.Publishers !== null) {
|
||||||
context?.logger.info("Found publishers, importing...");
|
context?.logger.info("Found publishers, importing...");
|
||||||
const pubListClean = this.parseWikiStringArray(game.Publishers);
|
const pubListClean = this.parseWikiStringArray(game.Publishers);
|
||||||
@ -416,7 +416,7 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
|||||||
|
|
||||||
context?.progress(40);
|
context?.progress(40);
|
||||||
|
|
||||||
const developers: Company[] = [];
|
const developers: CompanyModel[] = [];
|
||||||
if (game.Developers !== null) {
|
if (game.Developers !== null) {
|
||||||
context?.logger.info("Found developers, importing...");
|
context?.logger.info("Found developers, importing...");
|
||||||
const devListClean = this.parseWikiStringArray(game.Developers);
|
const devListClean = this.parseWikiStringArray(game.Developers);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ Design goals:
|
|||||||
2. Real-time; use websocket listeners to keep clients up-to-date
|
2. Real-time; use websocket listeners to keep clients up-to-date
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Notification } from "~/prisma/client";
|
import type { NotificationModel } from "~/prisma/client/models";
|
||||||
import prisma from "../db/database";
|
import prisma from "../db/database";
|
||||||
import type { GlobalACL } from "../acls";
|
import type { GlobalACL } from "../acls";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import type { GlobalACL } from "../acls";
|
|||||||
|
|
||||||
// TODO: document notification action format
|
// TODO: document notification action format
|
||||||
export type NotificationCreateArgs = Pick<
|
export type NotificationCreateArgs = Pick<
|
||||||
Notification,
|
NotificationModel,
|
||||||
"title" | "description" | "actions" | "nonce"
|
"title" | "description" | "actions" | "nonce"
|
||||||
> & { acls: Array<GlobalACL> };
|
> & { acls: Array<GlobalACL> };
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ class NotificationSystem {
|
|||||||
string,
|
string,
|
||||||
Map<
|
Map<
|
||||||
string,
|
string,
|
||||||
{ callback: (notification: Notification) => void; acls: GlobalACL[] }
|
{ callback: (notification: NotificationModel) => void; acls: GlobalACL[] }
|
||||||
>
|
>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class NotificationSystem {
|
|||||||
userId: string,
|
userId: string,
|
||||||
acls: Array<GlobalACL>,
|
acls: Array<GlobalACL>,
|
||||||
id: string,
|
id: string,
|
||||||
callback: (notification: Notification) => void,
|
callback: (notification: NotificationModel) => void,
|
||||||
) {
|
) {
|
||||||
if (!this.listeners.has(userId)) this.listeners.set(userId, new Map());
|
if (!this.listeners.has(userId)) this.listeners.set(userId, new Map());
|
||||||
// eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion
|
||||||
@ -60,7 +60,10 @@ class NotificationSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async pushNotification(userId: string, notification: Notification) {
|
private async pushNotification(
|
||||||
|
userId: string,
|
||||||
|
notification: NotificationModel,
|
||||||
|
) {
|
||||||
for (const [_, listener] of this.listeners.get(userId) ?? []) {
|
for (const [_, listener] of this.listeners.get(userId) ?? []) {
|
||||||
const hasSome =
|
const hasSome =
|
||||||
notification.acls.findIndex(
|
notification.acls.findIndex(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Platform } from "~/prisma/client";
|
import { Platform } from "~/prisma/client/enums";
|
||||||
|
|
||||||
export function parsePlatform(platform: string) {
|
export function parsePlatform(platform: string) {
|
||||||
switch (platform.toLowerCase()) {
|
switch (platform.toLowerCase()) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { LibraryBackend } from "~/prisma/client";
|
import { LibraryBackend } from "~/prisma/client/enums";
|
||||||
import prisma from "../internal/db/database";
|
import prisma from "../internal/db/database";
|
||||||
import type { JsonValue } from "@prisma/client/runtime/library";
|
import type { JsonValue } from "@prisma/client/runtime/library";
|
||||||
import type { LibraryProvider } from "../internal/library/provider";
|
import type { LibraryProvider } from "../internal/library/provider";
|
||||||
|
|||||||
Reference in New Issue
Block a user