API optimisations (#343)

* feat: api optimisation

* feat: emulator rename
This commit is contained in:
DecDuck
2026-02-06 23:12:03 +11:00
committed by GitHub
parent d6920700cb
commit bc5623cc78
20 changed files with 246 additions and 134 deletions
+3 -4
View File
@@ -75,7 +75,6 @@
<div v-if="versionGuesses" class="flex flex-col gap-4">
<!-- setup executable -->
<div class="bg-zinc-800 p-4 rounded-xl relative flex flex-col gap-y-2">
<div>
<label class="block text-sm font-medium leading-6 text-zinc-100">{{
@@ -155,7 +154,7 @@
</Switch>
</SwitchGroup>
<div
v-if="type === GameType.Redist"
v-if="type === GameType.Dependency"
class="absolute inset-0 bg-zinc-900/50"
/>
</div>
@@ -215,7 +214,7 @@
v-model="versionSettings.launches[launchIdx]"
:version-guesses="versionGuesses"
:needs-name="true"
:allow-executor="true"
:allow-emulator="true"
:type="type"
/>
</DisclosurePanel>
@@ -361,7 +360,7 @@ const currentlySelectedVersion = ref(-1);
const versionSettings = ref<Omit<typeof ImportVersion.infer, "version" | "id">>(
{
delta: false,
onlySetup: type === GameType.Redist,
onlySetup: type === GameType.Dependency,
launches: [],
setups: [],
requiredContent: [],
+6 -6
View File
@@ -369,15 +369,15 @@ const importModes: {
title: "Game",
description: "Games are shown in store, and are discoverable.",
},
Executor: {
title: "Executor",
Emulator: {
title: "Emulator",
description:
"Executors are used to launch games. Mainly emulators or wrappers.",
"Emulators are used to launch other games, wrapping them in another executable.",
},
Redist: {
title: "Redistributable",
Dependency: {
title: "Dependency",
description:
"Additional content that must be downloaded and installed before running the game.",
"Dependencies are setup-only files that get installed before the game is launched.",
},
};
+5 -12
View File
@@ -93,12 +93,12 @@
{{ $t("store.size") }}
</td>
<td
v-if="size.versions.length > 0"
v-if="sizes.length > 0"
class="whitespace-nowrap inline-flex gap-x-4 px-3 py-4 text-sm text-zinc-400"
>
<ul class="flex flex-col">
<ol
v-for="version in size.versions"
v-for="version in sizes"
:key="version.versionId"
class="inline-flex items-center gap-x-1"
>
@@ -268,21 +268,14 @@ const gameId = route.params.id.toString();
const user = useUser();
const { game, rating, size } = await $dropFetch(`/api/v1/games/${gameId}`);
const { game, rating, sizes, platforms } = await $dropFetch(
`/api/v1/games/${gameId}`,
);
const isClient = isClientRequest();
const descriptionHTML = micromark(game.mDescription);
const platforms = game.versions
.map((e) => [
...e.launches.map((v) => v.platform),
...e.setups.map((v) => v.platform),
])
.flat()
.flat()
.filter((e, i, u) => u.indexOf(e) === i);
// const rating = Math.round(game.mReviewRating * 5);
const averageRating = Math.round((rating._avg.mReviewRating ?? 0) * 5);
const ratingArray = Array(5)