Remove Immich URL/API key from the config page
Build and push server image / build-and-push (push) Successful in 34s
Build and push server image / build-and-push (push) Successful in 34s
Now that they're set via docker-compose.yml's environment (previous commit), leaving editable fields for them on the page was misleading -- anything typed there would be silently overwritten by the env vars on the next load() anyway. Replaced with a read-only info banner showing the configured Immich URL (never the API key value, even though it's already env-sourced rather than user input) or a warning if IMMICH_URL/ IMMICH_API_KEY aren't set. POST /api/config no longer accepts or touches those two fields at all. Verified: page renders with no immich_url/immich_api_key input fields or API key value in either case (env vars set or unset); config save/albums/ frame-image still work end-to-end via a mock Immich server.
This commit is contained in:
+4
-4
@@ -61,16 +61,16 @@ def api_albums():
|
||||
|
||||
@app.post("/api/config")
|
||||
def api_config_save(
|
||||
immich_url: str = Form(""),
|
||||
immich_api_key: str = Form(""),
|
||||
album_id: str = Form(""),
|
||||
order: str = Form("sequential"),
|
||||
refresh_interval_s: int = Form(3600),
|
||||
smart_crop_faces: bool = Form(True),
|
||||
):
|
||||
# Immich URL/API key are env-var only (IMMICH_URL/IMMICH_API_KEY, see
|
||||
# docker-compose.yml.example) -- config.load() already applies them,
|
||||
# and this handler doesn't touch cfg.immich_url/immich_api_key at all,
|
||||
# so there's nothing here that could overwrite or clear them.
|
||||
cfg = config.load()
|
||||
cfg.immich_url = immich_url.strip()
|
||||
cfg.immich_api_key = immich_api_key.strip()
|
||||
if album_id != cfg.album_id:
|
||||
cfg.cursor = 0 # restart from the top of a newly selected album
|
||||
cfg.album_id = album_id
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
.status { margin-top: 16px; padding: 10px; border-radius: 4px; font-size: 14px; }
|
||||
.status.ok { background: #dcfce7; color: #166534; }
|
||||
.status.err { background: #fee2e2; color: #991b1b; }
|
||||
.info-box { margin-top: 16px; padding: 10px; border-radius: 4px; font-size: 13px; background: #f3f4f6; color: #444; }
|
||||
.info-box.warn { background: #fef9c3; color: #854d0e; }
|
||||
code { background: #f3f4f6; padding: 2px 5px; border-radius: 3px; }
|
||||
</style>
|
||||
</head>
|
||||
@@ -26,13 +28,17 @@
|
||||
<h1>ESPresso Frame</h1>
|
||||
<p class="sub">Point your frame's "Tools Server" field at this server's <code>host:port</code>.</p>
|
||||
|
||||
{% if cfg.immich_url %}
|
||||
<div class="info-box">Immich: <code>{{ cfg.immich_url }}</code> (API key configured). Set via
|
||||
<code>IMMICH_URL</code>/<code>IMMICH_API_KEY</code> in <code>docker-compose.yml</code> -- see
|
||||
<code>docker-compose.yml.example</code>.</div>
|
||||
{% else %}
|
||||
<div class="info-box warn">Immich isn't configured yet. Set <code>IMMICH_URL</code> and
|
||||
<code>IMMICH_API_KEY</code> in <code>docker-compose.yml</code> (copy
|
||||
<code>docker-compose.yml.example</code>) and restart the server.</div>
|
||||
{% endif %}
|
||||
|
||||
<form id="config-form">
|
||||
<label>Immich URL
|
||||
<input type="text" id="immich_url" value="{{ cfg.immich_url }}" placeholder="http://192.168.1.10:2283" required>
|
||||
</label>
|
||||
<label>Immich API Key
|
||||
<input type="password" id="immich_api_key" value="{{ cfg.immich_api_key }}" required>
|
||||
</label>
|
||||
<label>Album
|
||||
<select id="album_id">
|
||||
{% if cfg.album_id %}<option value="{{ cfg.album_id }}" selected>(current selection -- reload to rename)</option>{% endif %}
|
||||
@@ -67,8 +73,6 @@
|
||||
async function saveConfig() {
|
||||
const minutes = parseInt(document.getElementById('refresh_interval_minutes').value, 10) || 60;
|
||||
const body = new URLSearchParams({
|
||||
immich_url: document.getElementById('immich_url').value,
|
||||
immich_api_key: document.getElementById('immich_api_key').value,
|
||||
album_id: document.getElementById('album_id').value || '',
|
||||
order: document.getElementById('order').value,
|
||||
refresh_interval_s: String(minutes * 60),
|
||||
|
||||
Reference in New Issue
Block a user