From e7815576941f681371ad8e43db519c7c41efdfcd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 18:20:24 +0200 Subject: [PATCH] Add /settings web editor for the encrypted addon config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A login → decrypt → edit → re-encrypt page so account settings (the addon URLs + TMDB key) can be changed from any browser instead of typing them on a TV. Doubles as the per-user config-update tool (editing a live account's config, which the one-time onboarding template can't do). - pb_public/settings.html: auth-with-password, load the owner's addon_config (rules already scope to profile.user), decrypt the blob in-browser with the password (PBKDF2→AES-GCM, byte-identical to the app + onboarding page), edit fields, re-encrypt and PATCH. - Crucial: re-encrypt reusing the record's EXISTING salt, so the derived key is unchanged and an already-logged-in device (which cached that key and has no password on a restored session) decrypts the edited blob with no re-entry. A fresh salt would force a TV re-entry — the opposite of the point. - 18+ fields (adult addon URL + enable toggle) render only for an account with nsfwEnabled; a clean account never sees them and their stored values are carried through untouched on save. - pb_hooks/settings.pb.js: /settings → /settings.html redirect. No server logic beyond the redirect — all crypto/IO is client-side against the existing collection API. Crypto round-trip + salt-reuse + wrong-key rejection verified against the app's format (WebCrypto, Node). Co-Authored-By: Claude Opus 4.8 --- pb_hooks/settings.pb.js | 6 + pb_public/settings.html | 315 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 321 insertions(+) create mode 100644 pb_hooks/settings.pb.js create mode 100644 pb_public/settings.html diff --git a/pb_hooks/settings.pb.js b/pb_hooks/settings.pb.js new file mode 100644 index 0000000..3ee295f --- /dev/null +++ b/pb_hooks/settings.pb.js @@ -0,0 +1,6 @@ +/// Pretty URL for the account settings editor: /settings → the static page. +/// The page itself (pb_public/settings.html) is a login → decrypt → edit → +/// re-encrypt flow for the client-encrypted addon_config; everything happens in +/// the browser against the normal collection API, so there's no server logic +/// here beyond this redirect. +routerAdd("GET", "/settings", (e) => e.redirect(302, "/settings.html")) diff --git a/pb_public/settings.html b/pb_public/settings.html new file mode 100644 index 0000000..948e6f1 --- /dev/null +++ b/pb_public/settings.html @@ -0,0 +1,315 @@ + + + + + + +Amber — nastavení účtu + + + +
+

Nastavení účtu

+

Přihlas se a uprav zdroje filmů a seriálů — + změny se do aplikace propíšou samy.

+ + +
+ + + + + +
+ + + + +
+ +

Heslo se použije jen ve tvém prohlížeči k dešifrování a opětovnému + zašifrování nastavení — na server se heslo ani klíč nikdy neposílají.

+
+ + + +