mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3435] [CLOSED] [GUI] Use web API keys immediately when browser storage fails #4634
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4634
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3435
Author: @engharat
Created: 10/20/2026
Status: ❌ Closed
Base:
main← Head:fix/web-api-key-persistence📝 Commits (1)
3afe9d4[GUI] Use web API key immediately and retain it when storage fails📊 Changes
2 files changed (+113 additions, -5 deletions)
View changed files
➕
serve/test_web_api_key.py(+99 -0)📝
serve/web/app.js(+14 -5)📄 Description
Problem and result
The web app saves its API key only on
change(usually blur), and every request reads it back from localStorage. Before blur, an edited key is not used. If storage is blocked or full, the app discards the entered key, sends no key (or the old one), and still says “API key saved.”The page now uses the trimmed key immediately on input, saves it when possible, and keeps using it in memory if storage fails. On change, it warns that the key must be entered again after reload when persistence is unavailable. Clearing the field removes Authorization. Existing stored keys and keyless servers keep working.
Related symptom: #725. This fixes the client-side event/storage paths, not server-side key normalization proposed in the closed #956.
Approach
Keep the current page's key in memory for the shared request-header helper. Have the existing storage setter report whether its write succeeded, so the notification does not claim persistence when the write failed. No new dependencies, server changes, authentication bypasses, or engine changes.
Validation
Linux, Python 3.14.4, Node v22.22.1. Final commit:
3afe9d4a.Passed:
python3 -m unittest serve.test_web_api_key serve.test_web_sampling -v: 12 tests passed (8 API-key regressions, 4 existing sampling tests).node --check serve/web/app.jsandgit diff --check.127.0.0.1:8080, confirmed input updates Authorization and storage without blur. With Storage reads/writes forced to throw, confirmed Authorization still uses the edited key, a warning appears, and clearing the field removes Authorization. Test values were removed afterward./metricson the live server returned HTTP 200.Failed / limits:
.venv/bin/python -m unittest discover -s serve -t .run, before adding the final notification regression: 888 tests, 2 failures, 14 skipped. Failures wereserve.test_keepawake.KeepAwakeTests.test_service_holds_for_the_whole_request_including_early_closeandserve.test_responses.NoLeakedSampler.test_server_close_ends_the_sampler. The keepawake failure also reproduces against an exported unmodified parent revision (e88ee39d); the sampler test passes in isolation on both revisions. Neither was changed here.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.