Game specialisation & delta versions (#323)
* feat: game specialisation, auto-guess extensions * fix: enforce specialisation specific schema at API level * fix: lint * feat: partial work on depot endpoints * feat: bump torrential * feat: dummy version creation for depot uploads * fix: lint * fix: types * fix: lint * feat: depot version import * fix: lint * fix: remove any type * fix: lint * fix: push update interval * fix: cpu usage calculation * feat: delta version support * feat: style tweaks for selectlaunch.vue * fix: lint
This commit is contained in:
@@ -13,15 +13,24 @@ export default defineClientEventHandler(async (h3) => {
|
||||
|
||||
const gameVersion = await prisma.gameVersion.findUnique({
|
||||
where: {
|
||||
gameId_versionId: {
|
||||
gameId: id,
|
||||
versionId: version,
|
||||
},
|
||||
versionId: version,
|
||||
},
|
||||
include: {
|
||||
launches: {
|
||||
include: {
|
||||
executor: true,
|
||||
executor: {
|
||||
include: {
|
||||
gameVersion: {
|
||||
select: {
|
||||
game: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setups: true,
|
||||
@@ -34,8 +43,22 @@ export default defineClientEventHandler(async (h3) => {
|
||||
statusMessage: "Game version not found",
|
||||
});
|
||||
|
||||
return {
|
||||
const gameVersionMapped = {
|
||||
...gameVersion,
|
||||
launches: gameVersion.launches.map((launch) => ({
|
||||
...launch,
|
||||
executor: launch.executor
|
||||
? {
|
||||
...launch.executor,
|
||||
gameVersion: undefined,
|
||||
gameId: launch.executor.gameVersion.game.id,
|
||||
}
|
||||
: undefined,
|
||||
})),
|
||||
};
|
||||
|
||||
return {
|
||||
...gameVersionMapped,
|
||||
size: libraryManager.getGameVersionSize(id, version),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import { createDownloadManifestDetails } from "~/server/internal/library/manifest/index";
|
||||
|
||||
export default defineClientEventHandler(async (h3) => {
|
||||
const query = getQuery(h3);
|
||||
const id = query.id?.toString();
|
||||
const version = query.version?.toString();
|
||||
if (!id || !version)
|
||||
if (!version)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Missing id or version in query",
|
||||
statusMessage: "Missing version ID in query",
|
||||
});
|
||||
|
||||
const manifest = await prisma.gameVersion.findUnique({
|
||||
where: { gameId_versionId: { gameId: id, versionId: version } },
|
||||
select: { dropletManifest: true },
|
||||
});
|
||||
if (!manifest)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Invalid game or version, or no versions added.",
|
||||
});
|
||||
return manifest.dropletManifest;
|
||||
const result = await createDownloadManifestDetails(version);
|
||||
return result;
|
||||
});
|
||||
|
||||
@@ -5,8 +5,8 @@ import gameSizeManager from "~/server/internal/gamesize";
|
||||
|
||||
type VersionDownloadOption = {
|
||||
versionId: string;
|
||||
displayName?: string;
|
||||
versionPath: string;
|
||||
displayName?: string | undefined;
|
||||
versionPath?: string | undefined;
|
||||
platform: Platform;
|
||||
size: number;
|
||||
requiredContent: Array<{
|
||||
@@ -106,7 +106,8 @@ export default defineClientEventHandler(async (h3) => {
|
||||
([platform, requiredContent]) =>
|
||||
({
|
||||
versionId: v.versionId,
|
||||
versionPath: v.versionPath,
|
||||
displayName: v.displayName || undefined,
|
||||
versionPath: v.versionPath || undefined,
|
||||
platform,
|
||||
requiredContent,
|
||||
size: size!,
|
||||
|
||||
Reference in New Issue
Block a user