blob: 1df1bb33a5723e5c4fb76569a63db56eb7b947e6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { PUBLIC_COINOS_URL } from "$env/static/public";
import { auth, fd, get } from "$lib/utils";
import { hex } from "@scure/base";
export async function load({ cookies }) {
let token;
try {
token = await get("/ro", auth(cookies));
} catch (e) {}
return { token };
}
export const actions = {
default: async ({ fetch, request }) => {
const body = await fd(request);
const res = await fetch(`${PUBLIC_COINOS_URL}/flash`, {
method: "POST",
body: JSON.stringify(body),
headers: {
"content-type": "application/json",
accept: "application/octet-stream",
},
});
const buf = new Uint8Array(await res.arrayBuffer());
return { bytes: hex.encode(buf) };
},
};
|