mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-20 19:51:09 +10:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1fccd9bff | |||
| 2ae7f41be0 | |||
| beb824c8d9 |
@ -1,54 +0,0 @@
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
||||
services:
|
||||
- docker:24.0.5-dind
|
||||
|
||||
before_script:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
image: docker:latest
|
||||
variables:
|
||||
IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
|
||||
LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
|
||||
PUBLISH_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
PUBLISH_LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
|
||||
script:
|
||||
- docker build -t $IMAGE_NAME .
|
||||
- docker image tag $IMAGE_NAME $LATEST_IMAGE_NAME
|
||||
- docker push $IMAGE_NAME
|
||||
- docker push $LATEST_IMAGE_NAME
|
||||
- |
|
||||
if [ $CI_COMMIT_TAG ]; then
|
||||
docker image tag $IMAGE_NAME $PUBLISH_IMAGE_NAME
|
||||
docker image tag $IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME
|
||||
docker push $PUBLISH_IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME
|
||||
fi
|
||||
|
||||
build-arm64:
|
||||
stage: build
|
||||
image: arm64v8/docker:latest
|
||||
tags:
|
||||
- aarch64
|
||||
variables:
|
||||
IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA-arm64
|
||||
LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest-arm64
|
||||
PUBLISH_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-arm64
|
||||
PUBLISH_LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest-arm64
|
||||
script:
|
||||
- docker build -t $IMAGE_NAME . --platform=linux/arm64
|
||||
- docker image tag $IMAGE_NAME $LATEST_IMAGE_NAME
|
||||
- docker push $IMAGE_NAME
|
||||
- docker push $LATEST_IMAGE_NAME
|
||||
- |
|
||||
if [ $CI_COMMIT_TAG ]; then
|
||||
docker image tag $IMAGE_NAME $PUBLISH_IMAGE_NAME
|
||||
docker image tag $IMAGE_NAME $PUBLISH_LATEST_IMAGE_NAME
|
||||
docker push $PUBLISH_IMAGE_NAME
|
||||
docker push $PUBLISH_LATEST_IMAGE_NAME
|
||||
fi
|
||||
@ -1,4 +1,3 @@
|
||||
import type { RouteLocationNormalized } from "vue-router";
|
||||
import type { NavigationItem } from "./types";
|
||||
|
||||
export const useCurrentNavigationIndex = (
|
||||
@ -9,7 +8,7 @@ export const useCurrentNavigationIndex = (
|
||||
|
||||
const currentNavigation = ref(-1);
|
||||
|
||||
function calculateCurrentNavIndex(to: RouteLocationNormalized) {
|
||||
function calculateCurrentNavIndex(to: typeof route) {
|
||||
const validOptions = navigation
|
||||
.map((e, i) => ({ ...e, index: i }))
|
||||
.filter((e) => to.fullPath.startsWith(e.prefix));
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div v-if="!noWrapper" class="flex flex-col w-full min-h-screen bg-zinc-900">
|
||||
<UserHeader class="z-50" hydrate-on-idle />
|
||||
<LazyUserHeader class="z-50" hydrate-on-idle />
|
||||
<div class="grow flex">
|
||||
<NuxtPage />
|
||||
</div>
|
||||
<UserFooter class="z-50" hydrate-on-interaction />
|
||||
<LazyUserFooter class="z-50" hydrate-on-interaction />
|
||||
</div>
|
||||
<div v-else class="flex w-full min-h-screen bg-zinc-900">
|
||||
<NuxtPage />
|
||||
|
||||
@ -175,6 +175,9 @@ export default defineNuxtConfig({
|
||||
},
|
||||
|
||||
i18n: {
|
||||
bundle: {
|
||||
optimizeTranslationDirective: false,
|
||||
},
|
||||
defaultLocale: "en-us",
|
||||
strategy: "no_prefix",
|
||||
experimental: {
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordapp/twemoji": "^16.0.1",
|
||||
"@drop-oss/droplet": "3.2.0",
|
||||
"@drop-oss/droplet": "3.4.0",
|
||||
"@headlessui/vue": "^1.7.23",
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"@lobomfz/prismark": "0.0.3",
|
||||
@ -37,6 +37,7 @@
|
||||
"bcryptjs": "^3.0.2",
|
||||
"cheerio": "^1.0.0",
|
||||
"cookie-es": "^2.0.0",
|
||||
"dotenv": "^17.2.3",
|
||||
"fast-fuzzy": "^1.12.0",
|
||||
"file-type-mime": "^0.4.3",
|
||||
"jdenticon": "^3.3.0",
|
||||
@ -65,7 +66,6 @@
|
||||
"@nuxt/eslint": "^1.3.0",
|
||||
"@tailwindcss/forms": "^0.5.9",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@types/bcryptjs": "^3.0.0",
|
||||
"@types/luxon": "^3.6.2",
|
||||
"@types/node": "^22.13.16",
|
||||
"@types/semver": "^7.7.0",
|
||||
|
||||
3619
pnpm-lock.yaml
generated
3619
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
onlyBuiltDependencies:
|
||||
- '@prisma/client'
|
||||
- '@prisma/engines'
|
||||
- '@tailwindcss/oxide'
|
||||
- "@prisma/client"
|
||||
- "@prisma/engines"
|
||||
- "@tailwindcss/oxide"
|
||||
- esbuild
|
||||
- prisma
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { config } from "dotenv";
|
||||
import type { PrismaConfig } from "prisma";
|
||||
import path from "node:path";
|
||||
|
||||
config();
|
||||
|
||||
export default {
|
||||
schema: path.join("prisma"),
|
||||
earlyAccess: true,
|
||||
|
||||
@ -42,7 +42,7 @@ export default defineEventHandler(async (h3) => {
|
||||
)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Invalid capabilities.",
|
||||
message: "Invalid capabilities.",
|
||||
});
|
||||
|
||||
if (
|
||||
|
||||
@ -17,21 +17,10 @@ export default defineClientEventHandler(async (h3) => {
|
||||
orderBy: {
|
||||
versionIndex: "desc", // Latest one first
|
||||
},
|
||||
omit: {
|
||||
dropletManifest: true,
|
||||
},
|
||||
});
|
||||
|
||||
const mappedVersions = versions
|
||||
.map((version) => {
|
||||
if (!version.dropletManifest) return undefined;
|
||||
|
||||
const newVersion = { ...version, dropletManifest: undefined };
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore idk why we delete an undefined object
|
||||
delete newVersion.dropletManifest;
|
||||
return {
|
||||
...newVersion,
|
||||
};
|
||||
})
|
||||
.filter((e) => e);
|
||||
|
||||
return mappedVersions;
|
||||
return versions;
|
||||
});
|
||||
|
||||
@ -4,6 +4,8 @@ class SystemConfig {
|
||||
private libraryFolder = process.env.LIBRARY ?? "./.data/library";
|
||||
private dataFolder = process.env.DATA ?? "./.data/data";
|
||||
|
||||
private metadataTimeout = parseInt(process.env.METADATA_TIMEOUT ?? "5000");
|
||||
|
||||
private externalUrl = normalizeUrl(
|
||||
process.env.EXTERNAL_URL ?? "http://localhost:3000",
|
||||
{ stripWWW: false },
|
||||
@ -28,6 +30,10 @@ class SystemConfig {
|
||||
return this.dataFolder;
|
||||
}
|
||||
|
||||
getMetadataTimeout() {
|
||||
return this.metadataTimeout;
|
||||
}
|
||||
|
||||
getDropVersion() {
|
||||
return this.dropVersion;
|
||||
}
|
||||
|
||||
@ -105,7 +105,10 @@ class LibraryManager {
|
||||
if (!game) return undefined;
|
||||
|
||||
try {
|
||||
const versions = await provider.listVersions(libraryPath);
|
||||
const versions = await provider.listVersions(
|
||||
libraryPath,
|
||||
game.versions.map((v) => v.versionName),
|
||||
);
|
||||
const unimportedVersions = versions.filter(
|
||||
(e) =>
|
||||
game.versions.findIndex((v) => v.versionName == e) == -1 &&
|
||||
|
||||
@ -24,7 +24,10 @@ export abstract class LibraryProvider<CFG> {
|
||||
* @param game folder name of the game to list versions for
|
||||
* @returns list of version folder names
|
||||
*/
|
||||
abstract listVersions(game: string): Promise<string[]>;
|
||||
abstract listVersions(
|
||||
game: string,
|
||||
existingPaths?: string[],
|
||||
): Promise<string[]>;
|
||||
|
||||
/**
|
||||
* @param game folder name of the game
|
||||
|
||||
@ -54,11 +54,15 @@ export class FilesystemProvider
|
||||
return folderDirs;
|
||||
}
|
||||
|
||||
async listVersions(game: string): Promise<string[]> {
|
||||
async listVersions(
|
||||
game: string,
|
||||
ignoredVersions?: string[],
|
||||
): Promise<string[]> {
|
||||
const gameDir = path.join(this.config.baseDir, game);
|
||||
if (!fs.existsSync(gameDir)) throw new GameNotFoundError();
|
||||
const versionDirs = fs.readdirSync(gameDir);
|
||||
const validVersionDirs = versionDirs.filter((e) => {
|
||||
if (ignoredVersions && ignoredVersions.includes(e)) return false;
|
||||
const fullDir = path.join(this.config.baseDir, game, e);
|
||||
return DROPLET_HANDLER.hasBackendForPath(fullDir);
|
||||
});
|
||||
@ -109,17 +113,12 @@ export class FilesystemProvider
|
||||
) {
|
||||
const filepath = path.join(this.config.baseDir, game, version);
|
||||
if (!fs.existsSync(filepath)) return undefined;
|
||||
let stream;
|
||||
while (!(stream instanceof ReadableStream)) {
|
||||
const v = DROPLET_HANDLER.readFile(
|
||||
filepath,
|
||||
filename,
|
||||
options?.start ? BigInt(options.start) : undefined,
|
||||
options?.end ? BigInt(options.end) : undefined,
|
||||
);
|
||||
if (!v) return undefined;
|
||||
stream = v.getStream() as ReadableStream<unknown>;
|
||||
}
|
||||
const stream = DROPLET_HANDLER.readFile(
|
||||
filepath,
|
||||
filename,
|
||||
options?.start ? BigInt(options.start) : undefined,
|
||||
options?.end ? BigInt(options.end) : undefined,
|
||||
);
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ export class FlatFilesystemProvider
|
||||
);
|
||||
if (!stream) return undefined;
|
||||
|
||||
return stream.getStream();
|
||||
return stream;
|
||||
}
|
||||
|
||||
fsStats() {
|
||||
|
||||
@ -82,6 +82,10 @@ export class MetadataHandler {
|
||||
// TODO: fix eslint error
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
>(async (resolve, reject) => {
|
||||
setTimeout(
|
||||
() => reject(new Error("Timeout while fetching results")),
|
||||
systemConfig.getMetadataTimeout(),
|
||||
);
|
||||
try {
|
||||
const results = await provider.search(query);
|
||||
const mappedResults: InternalGameMetadataResult[] = results.map(
|
||||
|
||||
Reference in New Issue
Block a user