mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-02-16 14:12:41 +00:00
fix: firmware cannot be linked
This commit is contained in:
20
src/routes/(app)/ccos/[device]/[version]/+page.ts
Normal file
20
src/routes/(app)/ccos/[device]/[version]/+page.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { PageLoad } from "./$types";
|
||||
import type { FileListing, Listing } from "../../listing";
|
||||
|
||||
export const load = (async ({ fetch, params }) => {
|
||||
const result = await fetch(
|
||||
`${import.meta.env.VITE_FIRMWARE_URL}/${params.device}/${params.version}/`,
|
||||
);
|
||||
const data: Listing[] = await result.json();
|
||||
|
||||
return {
|
||||
uf2: data.find(
|
||||
(entry) => entry.type === "file" && entry.name === "CURRENT.UF2",
|
||||
) as FileListing,
|
||||
ota: data.find(
|
||||
(entry) => entry.type === "file" && entry.name === "firmware.bin",
|
||||
),
|
||||
version: params.version,
|
||||
device: params.device,
|
||||
};
|
||||
}) satisfies PageLoad;
|
||||
Reference in New Issue
Block a user