feat(frontend): post collected samples to /api/v1/reports (closes #53)
check / check (push) Failing after 1s
check / check (push) Failing after 1s
A Reporter beside AppState POSTs a JSON delta report to the same-origin /api/v1/reports every reportInterval (default 60s). buildReport is an exported pure function of host state, emitting each host's unreported, non-paused samples plus a per-browser clientId, geo null, and a UTC timestamp; a per-host high-water mark advances only on a delivered POST, so a failed send re-sends next interval within the history window. Failure is quiet and never blocks probing. The client id feature-detects crypto.randomUUID and otherwise builds a v4 id from crypto.getRandomValues, so insecure-context loads (plain HTTP to a non-localhost host) work; reporter setup is isolated so it can never stop probing. init() runs only when the #app page is present, so a test can import buildReport. vite.config.js proxies /api to 127.0.0.1:8080 for yarn dev. Model: opus-4-8
This commit is contained in:
@@ -7,6 +7,13 @@ const commitFull = execSync("git rev-parse HEAD").toString().trim();
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss()],
|
||||
server: {
|
||||
// Proxy /api to a locally running netwatch-server so `yarn dev`
|
||||
// exercises the real report-posting path.
|
||||
proxy: {
|
||||
"/api": "http://127.0.0.1:8080",
|
||||
},
|
||||
},
|
||||
define: {
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||
__COMMIT_FULL__: JSON.stringify(commitFull),
|
||||
|
||||
Reference in New Issue
Block a user