Merge claude/1

This commit is contained in:
librelad 2026-05-26 22:53:10 +01:00
commit 12a9fe48ff
2 changed files with 9 additions and 6 deletions

View File

@ -13,7 +13,6 @@ webuiGenerateBackupMigrate()
{ {
local output_dir="$containers_dir/libreportal/frontend/data/backup/generated" local output_dir="$containers_dir/libreportal/frontend/data/backup/generated"
local output_file="$output_dir/migrate.json" local output_file="$output_dir/migrate.json"
local temp_file="${output_file}.tmp.$$"
runFileOp mkdir -p "$output_dir" runFileOp mkdir -p "$output_dir"
@ -122,13 +121,15 @@ webuiGenerateBackupMigrate()
locations_json+="]" locations_json+="]"
# --- Write atomically ---------------------------------------------------- # --- Write atomically ----------------------------------------------------
cat > "$temp_file" <<EOF # Pipe through runFileWrite (routes the write via the dockerinstall user
# that owns the data/ tree) — the previous `cat > "$temp_file"` redirect
# failed because the manager can't open paths under $containers_dir.
runFileWrite "$output_file" <<EOF
{ {
"generated_at": "$generated_at", "generated_at": "$generated_at",
"destination": $destination_json, "destination": $destination_json,
"locations": $locations_json "locations": $locations_json
} }
EOF EOF
runFileOp mv "$temp_file" "$output_file"
runFileOp chmod 644 "$output_file" 2>/dev/null || true runFileOp chmod 644 "$output_file" 2>/dev/null || true
} }

View File

@ -10,7 +10,6 @@ webuiGeneratePeers()
{ {
local output_dir="$containers_dir/libreportal/frontend/data/peers/generated" local output_dir="$containers_dir/libreportal/frontend/data/peers/generated"
local output_file="$output_dir/peers.json" local output_file="$output_dir/peers.json"
local temp_file="${output_file}.tmp.$$"
runFileOp mkdir -p "$output_dir" runFileOp mkdir -p "$output_dir"
@ -20,12 +19,15 @@ webuiGeneratePeers()
peers=$(peerList 2>/dev/null) peers=$(peerList 2>/dev/null)
[[ -z "$peers" ]] && peers='[]' [[ -z "$peers" ]] && peers='[]'
cat > "$temp_file" <<EOF # Pipe the JSON straight through runFileWrite — the previous
# `cat > "$temp_file"` redirect failed because $temp_file sits in the
# dockerinstall-owned data/ tree and the manager can't open it for write.
# The mv that followed then errored with "No such file or directory".
runFileWrite "$output_file" <<EOF
{ {
"generated_at": "$generated_at", "generated_at": "$generated_at",
"peers": $peers "peers": $peers
} }
EOF EOF
runFileOp mv "$temp_file" "$output_file"
runFileOp chmod 644 "$output_file" 2>/dev/null || true runFileOp chmod 644 "$output_file" 2>/dev/null || true
} }