diff --git a/web/.env.example b/web/.env.example new file mode 100644 index 0000000..6697b77 --- /dev/null +++ b/web/.env.example @@ -0,0 +1,5 @@ +# Replace with your DB credentials! +DATABASE_URL="postgres://user:password@host:port/db-name" + +SERVER_URL="http://localhost:8080" +PUBLIC_SERVER_WS_URL="ws://localhost:8080" diff --git a/web/src/lib/api/devices.remote.ts b/web/src/lib/api/devices.remote.ts new file mode 100644 index 0000000..dd412c9 --- /dev/null +++ b/web/src/lib/api/devices.remote.ts @@ -0,0 +1,17 @@ +import { query, getRequestEvent } from '$app/server'; +import { env } from '$env/dynamic/private'; + +const SERVER_URL = env.SERVER_URL || 'http://localhost:8080'; + +export const listDevices = query(async () => { + const { request } = getRequestEvent(); + + const res = await fetch(`${SERVER_URL}/devices`, { + headers: { + cookie: request.headers.get('cookie') ?? '' + } + }); + + if (!res.ok) return []; + return res.json(); +}); diff --git a/web/src/routes/dashboard/devices/+page.svelte b/web/src/routes/dashboard/devices/+page.svelte new file mode 100644 index 0000000..572e841 --- /dev/null +++ b/web/src/routes/dashboard/devices/+page.svelte @@ -0,0 +1,36 @@ + + +
No devices connected.
++ Install the Android app, paste your API key, and your device will appear here. +
+ + Create an API key + +{device.name}
++ Connected {new Date(device.connectedAt).toLocaleString()} +
+Step {step.step}: {step.action}
+{step.reasoning}
+Goal completed successfully.
+ {:else if status === 'failed'} +Goal failed. Please try again.
+ {/if} +