Files
Kaj SchittecatandClaude Opus 5.5 48a8303db3 web: the Store, Lua apps and backups in the browser
Store: the firmware's own catalog, install and language code over
wadaHttpRequest; http://firmware.wadamesh.com/apps/... becomes the
same-origin fw/apps/... (serve.py and the nginx snippet proxy exactly those
paths). The update check, OTA images and reports stay unreachable
(CAP_FW_UPDATE_CHECK 0); the Store badge fetches the catalog on its own.
CAP_STORE_DOWNLOADS keeps the baked apps and languages as the offline first
load and turns the Apps tab and language downloads on. Other servers
(wada.net) are fetched directly: CORS decides, no open proxy. Installs and
app data live in the backend's IndexedDB data dir.

Backups: the stand-in exports and imports the device's backup file (no
private key); CAP_FILE_HANDOFF downloads an export and imports a file picked
on the computer through the UI's own confirm + import. A restart waits for
the node commands an import queued. The bar's More menu backs up and
restores the whole data dir of this browser as one .tar.

webtest: a Store app installed via the proxy survives a reload and runs; a
backup goes out (download) and into a fresh profile (file picker); a
browser backup restores the app and the settings into another one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 15:03:11 +02:00

20 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
// Files between the UI and the visitor (CAP_FILE_HANDOFF): a device writes a backup to
// its own storage and the user copies it off the card; in a browser the file is handed
// over (the browser downloads it) and taken in (the browser's file picker).
//
// browser download = a Blob + <a download> from the page (the UI's button press is
// the user gesture); picker = <input type=file>, the chosen file is written
// into this backend's SPIFFS (web/shell/app.js wadaPickFile)
// native a download is copied to $WADA_DATA_DIR/downloads/; there is no picker
#include <FS.h>
#include <stddef.h>
// Hand `path` on `fs` to the visitor under `download_name`.
void boardHandOffFile(fs::FS& fs, const char* path, const char* download_name);
// Ask the visitor for a file (`accept`: the picker's filter, e.g. ".json"); it lands in
// SPIFFS at "/<its name>" and boardTakePickedFile then reports it, once.
void boardPickFile(const char* accept);
bool boardTakePickedFile(char* path, size_t cap);