feat: import of custom platforms & file extensions

This commit is contained in:
DecDuck
2025-09-06 18:29:04 +10:00
parent 7266d0485b
commit fcfc30e5df
36 changed files with 13182 additions and 271 deletions

24
composables/platform.ts Normal file
View File

@ -0,0 +1,24 @@
import { Platform } from "~/prisma/client/enums";
export type PlatformRenderable = {
name: string;
param: string;
platformIcon: { key: string; fallback?: string };
};
export function renderPlatforms(
userPlatforms: { platformName: string; id: string; iconSvg: string }[],
): PlatformRenderable[] {
return [
...Object.values(Platform).map((e) => ({
name: e,
param: e,
platformIcon: { key: e },
})),
...userPlatforms.map((e) => ({
name: e.platformName,
param: e.id,
platformIcon: { key: e.id, fallback: e.iconSvg },
})),
];
}

View File

@ -4,7 +4,7 @@ import type {
NitroFetchRequest,
TypedInternalResponse,
} from "nitropack/types";
import type { FetchError } from "ofetch";
import { FetchError } from "ofetch";
interface DropFetch<
DefaultT = unknown,
@ -66,6 +66,9 @@ export const $dropFetch: DropFetch = async (rawRequest, opts) => {
(_, c) => c(),
);
}
if(e instanceof FetchError) {
e.message = e.data.message ?? e.message;
}
throw e;
}
}