feat(settings): save display settings without an API key

Asking for the key every time a phone changes a chart option was friction
the owner doesn't want. These settings only change how data is displayed
(averaging, scale, chart range, language default), so PUT /api/settings is
now open. Inverter edits (name, kWp, ...) and ingest still need the key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 18:24:16 +03:00
co-authored by Claude Opus 5.5
parent 9ac86e2588
commit 80f82c8c63
7 changed files with 14 additions and 36 deletions
+2 -2
View File
@@ -197,8 +197,8 @@ def test_view_settings_shared_defaults_and_auth(client):
body = {**s, "comparison_readings": 3, "comparison_scale": "custom", "comparison_custom_kw": 25,
"power_range": "run", "power_smoothing": "light", "future_option": True}
assert client.put("/api/settings", json=body, headers={"X-API-Key": "nope"}).status_code == 401
saved = client.put("/api/settings", json=body).json()
# No API key needed: display options only
saved = client.put("/api/settings", json=body, headers={"X-API-Key": ""}).json()
assert saved["comparison_custom_kw"] == 25 and "future_option" not in saved
assert client.get("/api/settings").json()["power_range"] == "run"