From 934f87270369cd294626cf5142817edcac6c3a6c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 11 Sep 2025 16:01:17 -0700 Subject: pos route --- src/routes/(app)/pos/+page.server.ts | 21 +++++++ src/routes/(app)/pos/+page.svelte | 105 +++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 src/routes/(app)/pos/+page.server.ts create mode 100644 src/routes/(app)/pos/+page.svelte diff --git a/src/routes/(app)/pos/+page.server.ts b/src/routes/(app)/pos/+page.server.ts new file mode 100644 index 00000000..f7a3fda3 --- /dev/null +++ b/src/routes/(app)/pos/+page.server.ts @@ -0,0 +1,21 @@ +import { PUBLIC_COINOS_URL } from "$env/static/public"; +import { fd } from "$lib/utils"; +import { hex } from "@scure/base"; + +export const actions = { + default: async ({ fetch, request }) => { + const body = await fd(request); + console.log("POSTING", body); + 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 { data: hex.encode(buf) }; + }, +}; diff --git a/src/routes/(app)/pos/+page.svelte b/src/routes/(app)/pos/+page.svelte new file mode 100644 index 00000000..760a89b4 --- /dev/null +++ b/src/routes/(app)/pos/+page.svelte @@ -0,0 +1,105 @@ + + +
+

+ Flash config +

+ + {#if esploader} + {#if data} + {#if progress} +
Done!
+ {:else} +
Generated config file ({data.length * 2} bytes)
+ + {/if} + {:else} +
+ + + + +
+ {/if} + {:else} + + {/if} +
-- cgit v1.2.3