From 5e204793dd7f2642d5008899d27a29ad318b39cc Mon Sep 17 00:00:00 2001 From: Hoggormino <125792648+Hoggormino@users.noreply.github.com> Date: Wed, 16 Sep 2026 21:30:22 +0200 Subject: [PATCH] ESP32: make the worker URL a build option instead of a source edit cloud_client.h hard-coded the worker URL, and wrangler.toml pointed users at a "WiFi Setup -> Server URL" field that has never existed, so anyone self-hosting cloud-plugins/ had to edit a header. cloud_client_set_url() exists but has no callers, and the UART protocol has no frame for it. Add CONFIG_TT_CLOUD_URL (Kconfig.projbuild, menu "TagTinker") defaulting to the current URL, and take TT_CLOUD_DEFAULT_URL from it. Setting it in sdkconfig.defaults or through menuconfig is now enough; rebuild and reflash still apply, and there is no hidden run-time channel. Also says so in wrangler.toml and the README WiFi Plugins bullet. Co-Authored-By: Claude Opus 5 --- README.md | 2 +- cloud-plugins/wrangler.toml | 7 ++++--- esp32-wifi-fw/main/Kconfig.projbuild | 18 ++++++++++++++++++ esp32-wifi-fw/main/cloud_client.h | 14 ++++++++++---- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 esp32-wifi-fw/main/Kconfig.projbuild diff --git a/README.md b/README.md index 71e2b7c..fe8fe76 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ This tool is built for IoT security curiosity, learning about obscure protocols, - **TagTinker Image Prep (web):** Single-file, dependency-free HTML page that lists every supported tag profile, runs a full image pipeline (tone, contrast, detail, sharpen, dither, photo-grade Oklab 3-colour quantisation) and exports a Flipper-ready BMP. Hosted at **[i12bp8.github.io/TagTinker](https://i12bp8.github.io/TagTinker/)** (source: `web-image-prep/`). - **Drop-folder image flow:** Drop a prepared BMP into `apps_data/tagtinker/dropped/` on the Flipper SD card, then open `Targeted Payloads → → Set Image` and pick it. The Flipper rescales the 1-bit and two-plane BMPs that the image preparer exports, so one file can be sent to graphics tags of other sizes and to any page. Type 1626 (SmartTAG Color 2.6) targets only accept files up to 24 KB. - **NFC Tag Scan:** Add a target by scanning the tag's NFC chip instead of typing its barcode. This works when the tag's NFC data carries an ID TagTinker can decode; otherwise use `+ Type Barcode`. -- **WiFi Plugins (optional):** Plug a Flipper WiFi Dev Board (ESP32-S2) into the GPIO header to unlock live, network-rendered tag designs — crypto price cards, weather tiles, identicons, and more — auto-discovered by the FAP. New plugins live entirely on the cloud worker; the Flipper firmware never has to be re-flashed to add one. +- **WiFi Plugins (optional):** Plug a Flipper WiFi Dev Board (ESP32-S2) into the GPIO header to unlock live, network-rendered tag designs — crypto price cards, weather tiles, identicons, and more — auto-discovered by the FAP. New plugins live entirely on the cloud worker; the Flipper firmware never has to be re-flashed to add one. The dev board firmware talks to the worker named by `CONFIG_TT_CLOUD_URL`, so you can point it at your own deployment of `cloud-plugins/` instead. image - Display text and custom images. diff --git a/cloud-plugins/wrangler.toml b/cloud-plugins/wrangler.toml index cebb840..47d3a38 100644 --- a/cloud-plugins/wrangler.toml +++ b/cloud-plugins/wrangler.toml @@ -3,6 +3,7 @@ main = "src/index.ts" compatibility_date = "2024-09-23" # `npm run deploy` will publish to ..workers.dev. -# The dev board firmware has no runtime URL setting yet. To use your own -# deployment, set TT_CLOUD_DEFAULT_URL in esp32-wifi-fw/main/cloud_client.h, -# then rebuild and reflash the ESP32-S2. +# The dev board firmware has no runtime URL setting. To use your own +# deployment, set CONFIG_TT_CLOUD_URL (idf.py menuconfig, under TagTinker, +# or in esp32-wifi-fw/sdkconfig.defaults), then rebuild and reflash the +# ESP32-S2. diff --git a/esp32-wifi-fw/main/Kconfig.projbuild b/esp32-wifi-fw/main/Kconfig.projbuild new file mode 100644 index 0000000..f803bee --- /dev/null +++ b/esp32-wifi-fw/main/Kconfig.projbuild @@ -0,0 +1,18 @@ +menu "TagTinker" + +config TT_CLOUD_URL + string "Cloud worker base URL" + default "https://tagtinker.jhackerr.workers.dev" + help + Base URL of the Cloudflare Worker that serves /plugins and /render + for the WiFi Plugins feature. + + Point this at your own deployment (see cloud-plugins/) if you would + rather not send plugin parameters to someone else's worker. Set it + with `idf.py menuconfig` under TagTinker, or put + CONFIG_TT_CLOUD_URL="https://your-worker.example.workers.dev" in + sdkconfig.defaults, then rebuild and reflash the board. + + No trailing slash. + +endmenu diff --git a/esp32-wifi-fw/main/cloud_client.h b/esp32-wifi-fw/main/cloud_client.h index c9a5cf5..973e0f4 100644 --- a/esp32-wifi-fw/main/cloud_client.h +++ b/esp32-wifi-fw/main/cloud_client.h @@ -2,10 +2,11 @@ * Cloud plugin client. * * Talks to the TagTinker Cloudflare Worker that hosts plugin manifests - * and renders. The base URL is TT_CLOUD_DEFAULT_URL below unless NVS - * already holds one. cloud_client_set_url() can store a different URL, but - * nothing calls it yet, so pointing the board at another worker currently - * means editing TT_CLOUD_DEFAULT_URL and reflashing. + * and renders. The base URL comes from CONFIG_TT_CLOUD_URL, which is set + * with `idf.py menuconfig` under TagTinker or in sdkconfig.defaults, unless + * NVS already holds one. cloud_client_set_url() can store a different URL + * at run time, but nothing calls it yet, so changing worker means + * rebuilding and reflashing. * * GET /plugins -> JSON manifest list * GET /render/?...-> binary framebuffer (see worker docs) @@ -21,8 +22,13 @@ #include #include #include +#include "sdkconfig.h" +#ifdef CONFIG_TT_CLOUD_URL +#define TT_CLOUD_DEFAULT_URL CONFIG_TT_CLOUD_URL +#else #define TT_CLOUD_DEFAULT_URL "https://tagtinker.jhackerr.workers.dev" +#endif /* Persisted base URL (no trailing slash). */ const char* cloud_client_url(void);