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
4 changes: 2 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -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 />
Expand Down
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ export default defineNuxtConfig({
},

i18n: {
bundle: {
optimizeTranslationDirective: false,
},
defaultLocale: "en-us",
strategy: "no_prefix",
experimental: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
90 changes: 45 additions & 45 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion server/internal/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
5 changes: 4 additions & 1 deletion server/internal/library/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 11 additions & 12 deletions server/internal/library/providers/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion server/internal/library/providers/flat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class FlatFilesystemProvider
);
if (!stream) return undefined;

return stream.getStream();
return stream;
}

fsStats() {
Expand Down