In-app store, torrential backend, locales (#332)
* feat: add store nav and fixes * fix: reduce password requirement & new task error ui * fix: client webtoken fix * fix: delta versions and dockerfile * fix: use setup platforms for filter & display * fix: setup not accounted when returning valid options * feat: tighter delta version support * feat: dl/disk size * feat: offload manifest generation to torrential * fix: bump torrential * feat: remove droplet * feat: bump torrential * feat: convert locales
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import libraryManager from "~/server/internal/library";
|
||||
|
||||
export default defineClientEventHandler(async (h3) => {
|
||||
const id = getRouterParam(h3, "id");
|
||||
@@ -57,8 +56,5 @@ export default defineClientEventHandler(async (h3) => {
|
||||
})),
|
||||
};
|
||||
|
||||
return {
|
||||
...gameVersionMapped,
|
||||
size: libraryManager.getGameVersionSize(id, version),
|
||||
};
|
||||
return gameVersionMapped;
|
||||
});
|
||||
|
||||
+12
-16
@@ -1,6 +1,7 @@
|
||||
import type { Platform } from "~/prisma/client/enums";
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import type { GameVersionSize } from "~/server/internal/gamesize";
|
||||
import gameSizeManager from "~/server/internal/gamesize";
|
||||
|
||||
type VersionDownloadOption = {
|
||||
@@ -8,24 +9,23 @@ type VersionDownloadOption = {
|
||||
displayName?: string | undefined;
|
||||
versionPath?: string | undefined;
|
||||
platform: Platform;
|
||||
size: number;
|
||||
size: GameVersionSize;
|
||||
requiredContent: Array<{
|
||||
gameId: string;
|
||||
versionId: string;
|
||||
name: string;
|
||||
iconObjectId: string;
|
||||
shortDescription: string;
|
||||
size: number;
|
||||
size: GameVersionSize;
|
||||
}>;
|
||||
};
|
||||
|
||||
export default defineClientEventHandler(async (h3) => {
|
||||
const query = getQuery(h3);
|
||||
const id = query.id?.toString();
|
||||
const id = getRouterParam(h3, "id")!;
|
||||
if (!id)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "No ID in request query",
|
||||
statusMessage: "No ID in router params",
|
||||
});
|
||||
|
||||
const rawVersions = await prisma.gameVersion.findMany({
|
||||
@@ -62,6 +62,7 @@ export default defineClientEventHandler(async (h3) => {
|
||||
},
|
||||
},
|
||||
},
|
||||
setups: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -73,11 +74,11 @@ export default defineClientEventHandler(async (h3) => {
|
||||
VersionDownloadOption["requiredContent"]
|
||||
> = new Map();
|
||||
|
||||
for (const launch of v.launches) {
|
||||
for (const launch of [...v.launches, ...v.setups]) {
|
||||
if (!platformOptions.has(launch.platform))
|
||||
platformOptions.set(launch.platform, []);
|
||||
|
||||
if (launch.executor) {
|
||||
if ("executor" in launch && launch.executor) {
|
||||
const old = platformOptions.get(launch.platform)!;
|
||||
old.push({
|
||||
gameId: launch.executor.gameVersion.game.id,
|
||||
@@ -86,19 +87,14 @@ export default defineClientEventHandler(async (h3) => {
|
||||
iconObjectId: launch.executor.gameVersion.game.mIconObjectId,
|
||||
shortDescription:
|
||||
launch.executor.gameVersion.game.mShortDescription,
|
||||
size:
|
||||
(await gameSizeManager.getGameVersionSize(
|
||||
launch.executor.gameVersion.game.id,
|
||||
launch.executor.gameVersion.versionId,
|
||||
)) ?? 0,
|
||||
size: (await gameSizeManager.getVersionSize(
|
||||
launch.executor.gameVersion.versionId,
|
||||
))!,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const size = await gameSizeManager.getGameVersionSize(
|
||||
v.gameId,
|
||||
v.versionId,
|
||||
);
|
||||
const size = await gameSizeManager.getVersionSize(v.versionId);
|
||||
|
||||
return platformOptions
|
||||
.entries()
|
||||
@@ -1,29 +1,21 @@
|
||||
import { APITokenMode } from "~/prisma/client/enums";
|
||||
import { DateTime } from "luxon";
|
||||
import type { UserACL } from "~/server/internal/acls";
|
||||
import { defineClientEventHandler } from "~/server/internal/clients/event-handler";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import { CLIENT_WEBTOKEN_ACLS } from "~/server/plugins/04.auth-init";
|
||||
|
||||
export default defineClientEventHandler(
|
||||
async (h3, { fetchUser, fetchClient, clientId }) => {
|
||||
const user = await fetchUser();
|
||||
const client = await fetchClient();
|
||||
|
||||
const acls: UserACL = [
|
||||
"read",
|
||||
"store:read",
|
||||
"collections:read",
|
||||
"object:read",
|
||||
"settings:read",
|
||||
];
|
||||
|
||||
const token = await prisma.aPIToken.create({
|
||||
data: {
|
||||
name: `${client.name} Web Access Token ${DateTime.now().toISO()}`,
|
||||
clientId,
|
||||
userId: user.id,
|
||||
mode: APITokenMode.Client,
|
||||
acls,
|
||||
acls: CLIENT_WEBTOKEN_ACLS,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user