Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Dockerfile
.github
.vscode
*.md

#### gitignore below
# Nuxt dev/build outputs
.output
.data
Expand All @@ -24,8 +30,14 @@ logs
.env.*
!.env.example

.data


# deploy template
deploy-template/
deploy-template/*

!deploy-template/compose.yml

# generated prisma client
/prisma/client
/prisma/validate
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM node:lts-alpine AS deps
WORKDIR /app
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
FROM node:lts-alpine AS build-system
Expand All @@ -13,6 +13,7 @@ WORKDIR /app

ENV NODE_ENV=production
ENV NUXT_TELEMETRY_DISABLED=1
ENV YARN_CACHE_FOLDER=/root/.yarn

# add git so drop can determine its git ref at build
RUN apk add --no-cache git
Expand All @@ -21,12 +22,12 @@ RUN apk add --no-cache git
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ARG BUILD_DROP_VERSION="v0.0.0-unknown.1"
ARG BUILD_DROP_VERSION
ARG BUILD_GIT_REF

# build
RUN yarn postinstall
RUN yarn build
RUN --mount=type=cache,target=/root/.yarn yarn postinstall && \
yarn build

# create run environment for Drop
FROM node:lts-alpine AS run-system
Expand All @@ -35,7 +36,7 @@ WORKDIR /app
ENV NODE_ENV=production
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/.output ./app
Expand Down
4 changes: 2 additions & 2 deletions components/Auth/Simple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<script setup lang="ts">
import { XCircleIcon } from "@heroicons/vue/20/solid";
import type { User } from "~/prisma/client";
import type { UserModel } from "~/prisma/client/models";

const username = ref("");
const password = ref("");
Expand Down Expand Up @@ -124,6 +124,6 @@ async function signin() {
},
});
const user = useUser();
user.value = await $dropFetch<User | null>("/api/v1/user");
user.value = await $dropFetch<UserModel | null>("/api/v1/user");
}
</script>
4 changes: 2 additions & 2 deletions components/CreateCollectionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<script setup lang="ts">
import { ref } from "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";

const props = defineProps<{
Expand Down Expand Up @@ -79,7 +79,7 @@ async function createCollection() {
// Add the game if provided
if (props.gameId) {
const entry = await $dropFetch<
CollectionEntry & { game: SerializeObject<Game> }
CollectionEntryModel & { game: SerializeObject<GameModel> }
>(`/api/v1/collection/${response.id}/entry`, {
method: "POST",
body: { id: props.gameId },
Expand Down
4 changes: 2 additions & 2 deletions components/DeleteCollectionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
</template>

<script setup lang="ts">
import type { Collection } from "~/prisma/client";
import type { CollectionModel } from "~/prisma/client/models";
import { DialogTitle } from "@headlessui/vue";

const collection = defineModel<Collection | undefined>();
const collection = defineModel<CollectionModel | undefined>();
const deleteLoading = ref(false);

const collections = await useCollections();
Expand Down
4 changes: 2 additions & 2 deletions components/DeleteUserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

<script setup lang="ts">
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 router = useRouter();
const { t } = useI18n();
Expand Down
6 changes: 3 additions & 3 deletions components/GameCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
</template>

<script setup lang="ts">
import type { Game } from "~/prisma/client";
import type { GameModel } from "~/prisma/client/models";
import type { SerializeObject } from "nitropack";

const props = defineProps<{
items: Array<SerializeObject<Game>>;
items: Array<SerializeObject<GameModel>>;
min?: number;
width?: number;
}>();
Expand All @@ -51,7 +51,7 @@ const { showGamePanelTextDecoration } = await $dropFetch(
const currentComponent = ref<HTMLDivElement>();

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)
.fill(0)
.map((_, i) => props.items[i]),
Expand Down
12 changes: 7 additions & 5 deletions components/GameEditor/Metadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
accept="image/*"
endpoint="/api/v1/admin/game/image"
:multiple="true"
@upload="(result: Game) => uploadAfterImageUpload(result)"
@upload="(result: GameModel) => uploadAfterImageUpload(result)"
/>
<ModalTemplate v-model="showAddCarouselModal">
<template #default>
Expand Down Expand Up @@ -440,7 +440,7 @@
</template>

<script setup lang="ts">
import type { Game } from "~/prisma/client";
import type { GameModel } from "~/prisma/client/models";
import { micromark } from "micromark";
import {
CheckIcon,
Expand All @@ -461,7 +461,9 @@ const showAddImageDescriptionModal = ref(false);
const showEditCoreMetadata = ref(false);
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)
throw createError({
statusCode: 500,
Expand Down Expand Up @@ -563,7 +565,7 @@ const descriptionSaving = ref<DescriptionSavingState>(

let savingTimeout: undefined | NodeJS.Timeout;

type PatchGameBody = Partial<Game>;
type PatchGameBody = Partial<GameModel>;

watch(descriptionHTML, (_v) => {
descriptionSaving.value = DescriptionSavingState.Waiting;
Expand Down Expand Up @@ -693,7 +695,7 @@ async function deleteImage(id: string) {
}
}

async function uploadAfterImageUpload(result: Game) {
async function uploadAfterImageUpload(result: GameModel) {
if (!game.value) return;
game.value.mImageLibraryObjectIds = result.mImageLibraryObjectIds;
}
Expand Down
8 changes: 5 additions & 3 deletions components/GameEditor/Version.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
class="mt-2 space-y-4"
@update="() => updateVersionOrder()"
>
<template #item="{ element: item }: { element: GameVersion }">
<template
#item="{ element: item }: { element: GameVersionModel }"
>
<div
class="w-full inline-flex items-center px-4 py-2 bg-zinc-800 rounded justify-between"
>
Expand Down Expand Up @@ -97,7 +99,7 @@
</template>

<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 type { SerializeObject } from "nitropack";
import type { H3Error } from "h3";
Expand All @@ -112,7 +114,7 @@ defineProps<{ unimportedVersions: string[] }>();

const { t } = useI18n();

type GameAndVersions = Game & { versions: GameVersion[] };
type GameAndVersions = GameModel & { versions: GameVersionModel[] };
const game = defineModel<SerializeObject<GameAndVersions>>() as Ref<
SerializeObject<GameAndVersions>
>;
Expand Down
4 changes: 2 additions & 2 deletions components/NotificationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@

<script setup lang="ts">
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() {
await $dropFetch(`/api/v1/notifications/${props.notification.id}`, {
Expand Down
4 changes: 2 additions & 2 deletions components/UserHeader/NotificationWidgetPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</template>

<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>
10 changes: 7 additions & 3 deletions composables/collection.ts
Original file line number Diff line number Diff line change
@@ -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";

type FullCollection = Collection & {
entries: Array<CollectionEntry & { game: SerializeObject<Game> }>;
type FullCollection = CollectionModel & {
entries: Array<CollectionEntryModel & { game: SerializeObject<GameModel> }>;
};

export const useCollections = async () => {
Expand Down
4 changes: 2 additions & 2 deletions composables/news.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Article } from "~/prisma/client";
import type { ArticleModel } from "~/prisma/client/models";
import type { SerializeObject } from "nitropack";

export const useNews = () =>
useState<
| Array<
SerializeObject<
Article & {
ArticleModel & {
tags: Array<{ id: string; name: string }>;
author: { displayName: string; id: string } | null;
}
Expand Down
6 changes: 3 additions & 3 deletions composables/notifications.ts
Original file line number Diff line number Diff line change
@@ -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");

export const useNotifications = () =>
useState<Array<Notification>>("notifications", () => []);
useState<Array<NotificationModel>>("notifications", () => []);

ws.listen((e) => {
const notification = JSON.parse(e) as Notification;
const notification = JSON.parse(e) as NotificationModel;
const notifications = useNotifications();
notifications.value.push(notification);
});
6 changes: 3 additions & 3 deletions composables/user.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { User } from "~/prisma/client";
import type { UserModel } from "~/prisma/client/models";

// undefined = haven't check
// null = check, no user
// {} = check, user

export const useUser = () => useState<User | undefined | null>(undefined);
export const useUser = () => useState<UserModel | undefined | null>(undefined);
export const updateUser = async () => {
const user = useUser();
if (user.value === null) return;

user.value = await $dropFetch<User | null>("/api/v1/user");
user.value = await $dropFetch<UserModel | null>("/api/v1/user");
};
5 changes: 3 additions & 2 deletions composables/users.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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 = () =>
useState<
| Array<
SerializeObject<
User & {
UserModel & {
authMecs?: Array<{ id: string; mec: AuthMec }>;
}
>
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function getDropVersion(): string {
path.dirname(import.meta.url.replace("file://", "")),
"package.json",
);
console.log(`Reading package.json from ${packageJsonPath}`);

if (!existsSync(packageJsonPath)) {
console.error("Could not find package.json, using default version.");
return defaultVersion;
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
"lint:fix": "eslint . --fix && prettier --write --list-different ."
},
"dependencies": {
"@discordapp/twemoji": "^15.1.0",
"@discordapp/twemoji": "^16.0.1",
"@drop-oss/droplet": "1.6.0",
"@headlessui/vue": "^1.7.23",
"@heroicons/vue": "^2.1.5",
"@lobomfz/prismark": "0.0.3",
"@nuxt/fonts": "^0.11.0",
"@nuxt/image": "^1.10.0",
"@nuxtjs/i18n": "^9.5.5",
"@prisma/client": "^6.7.0",
"@prisma/client": "^6.11.1",
"@tailwindcss/vite": "^4.0.6",
"argon2": "^0.41.1",
"argon2": "^0.43.0",
"arktype": "^2.1.10",
"axios": "^1.7.7",
"bcryptjs": "^3.0.2",
Expand All @@ -43,7 +43,7 @@
"nuxt-security": "2.2.0",
"pino": "^9.7.0",
"pino-pretty": "^13.0.0",
"prisma": "^6.7.0",
"prisma": "^6.11.1",
"sanitize-filename": "^1.6.3",
"semver": "^7.7.1",
"stream-mime-type": "^2.0.0",
Expand All @@ -52,7 +52,7 @@
"vite-plugin-static-copy": "^3.0.0",
"vue": "latest",
"vue-router": "latest",
"vue3-carousel": "^0.15.0",
"vue3-carousel": "^0.16.0",
"vue3-carousel-nuxt": "^1.1.5",
"vuedraggable": "^4.1.0"
},
Expand All @@ -72,17 +72,16 @@
"h3": "^1.15.3",
"nitropack": "^2.11.12",
"ofetch": "^1.4.1",
"postcss": "^8.4.47",
"prettier": "^3.5.3",
"sass": "^1.79.4",
"tailwindcss": "^4.0.0",
"typescript": "^5.8.3",
"vue-tsc": "^2.2.8"
"vue-tsc": "^3.0.1"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"overrides": {
"vue3-carousel-nuxt": {
"vue3-carousel": "^0.15.0"
"vue3-carousel": "^0.16.0"
}
},
"prisma": {
Expand Down
Loading
Loading