feat: storage path in Settings UI, deploy creates directory

This commit is contained in:
Claus Lohmar 2026-08-06 19:41:14 +01:00
parent be801e9d27
commit dc236e561d
2 changed files with 7 additions and 2 deletions

View file

@ -145,10 +145,10 @@ if $GREENFIELD; then
# Build config.json from sample with sensible defaults.
cp config.json.sample "${CONFIG_FILE}"
STORAGE_PATH=$(jq -r .storage.recordings_path "${CONFIG_FILE}")
sudo mkdir -p "${STORAGE_PATH}" 2>/dev/null || true
sudo mkdir -p "${STORAGE_PATH}" 2>/dev/null || mkdir -p "${STORAGE_PATH}"
sudo chown "$(whoami):$(id -gn)" "${STORAGE_PATH}" 2>/dev/null || true
log "Config created: ${CONFIG_FILE}"
log "Storage: ${STORAGE_PATH} (change via web UI Settings)"
log "Storage: ${STORAGE_PATH}"
else
log "Config preserved: ${CONFIG_FILE}"
fi

View file

@ -263,6 +263,7 @@ async function renderCameraCards() {
container.innerHTML = `
<div class="camera-card" id="auth-card" style="grid-column:1/-1">
<h3>🔐 Access Setup</h3>
<label style="margin-bottom:12px">Storage path <input type="text" id="storage-path" value="${escAttr(config?.storage?.recordings_path || '/mnt/recordings')}" style="width:100%"></label>
<div style="display:flex;gap:16px;flex-wrap:wrap;margin-top:8px">
<div style="flex:1;min-width:200px">
<h4 style="font-size:13px;color:var(--accent);margin-bottom:6px">Port 8080 Admin</h4>
@ -433,6 +434,10 @@ document.getElementById('btn-save').addEventListener('click', async () => {
cfg.auth.viewer.username = viewerUser;
cfg.auth.viewer.enabled = viewerEnabled || false;
cfg.server.viewer_port = viewerEnabled ? ":8090" : "";
// Storage path from settings field.
const storagePath = document.getElementById('storage-path')?.value;
if (storagePath) cfg.storage.recordings_path = storagePath;
if (masterPass) { cfg.auth.master.password = masterPass; cfg.auth.master.enabled = true; }
if (viewerPass) { cfg.auth.viewer.password = viewerPass; }