Add HTTPS support and a management-token gate for the web UI
Build and push server image / build-and-push (push) Successful in 31s
Build and push server image / build-and-push (push) Successful in 31s
ESP32 side can now reach the tools server over HTTPS: the Tools Server field accepts an https:// address for a TLS-terminating reverse proxy in front of the server (which still only ever speaks plain HTTP itself), trusting Cloudflare's Origin CA root (embedded at build time) since that's the common way to get a real cert on a private origin. Every URL the device builds -- image fetch, config check, manage-menu data, the QR codes' own links -- goes through one build_url() helper that picks the scheme from what's configured. Also adds an optional MANAGEMENT_TOKEN (docker-compose.yml) that gates the web UI (/, /api/*) behind a shared secret -- unset by default, so existing trusted-LAN deployments are unaffected. The same token is entered once during the ESP32's captive-portal setup and gets baked into the manage-menu's QR code (?token=...), so scanning it just works; visiting the page without a valid token shows a plain entry prompt instead of the config UI, and a valid query-param hit sets a cookie so the page's own fetch()/<img> calls stay authorized for the rest of the visit. Device-facing /frame/* endpoints are unaffected -- a separate, already-documented trust boundary.
This commit is contained in:
@@ -7,12 +7,14 @@
|
||||
#define FRAME_CFG_SSID_MAX_LEN 32
|
||||
#define FRAME_CFG_PASSWORD_MAX_LEN 64
|
||||
#define FRAME_CFG_SERVER_MAX_LEN 128
|
||||
#define FRAME_CFG_TOKEN_MAX_LEN 64
|
||||
#define FRAME_AP_PASSWORD_LEN 10
|
||||
|
||||
typedef struct {
|
||||
char sta_ssid[FRAME_CFG_SSID_MAX_LEN + 1];
|
||||
char sta_password[FRAME_CFG_PASSWORD_MAX_LEN + 1];
|
||||
char toolsserver[FRAME_CFG_SERVER_MAX_LEN + 1];
|
||||
char access_token[FRAME_CFG_TOKEN_MAX_LEN + 1]; /* optional; matches the server's MANAGEMENT_TOKEN */
|
||||
} frame_config_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user