fix(wireguard-dashboard): Bypass jshn for QR code output to avoid argument size limit
The base64-encoded SVG QR code exceeded jshn's argument list limit, causing "Argument list too long" errors. Build the JSON response manually via file I/O so the large string is never passed as a command argument. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2ab0965917
commit
75e3f59207
@ -788,13 +788,17 @@ PersistentKeepalive = 25"
|
|||||||
PresharedKey = ${psk}"
|
PresharedKey = ${psk}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate QR code as SVG (PNG disabled in OpenWrt qrencode) and convert to base64
|
# Generate QR code as SVG and convert to base64
|
||||||
local qr_base64=$(echo "$config" | qrencode -t SVG -o - | base64 -w 0)
|
# Build JSON manually to avoid jshn "Argument list too long" with large base64 strings
|
||||||
|
local tmpfile="/tmp/wg_qr_$$.json"
|
||||||
|
local config_escaped=$(printf '%s' "$config" | sed 's/\\/\\\\/g; s/"/\\"/g' | awk '{printf "%s\\n", $0}' | sed '$ s/\\n$//')
|
||||||
|
|
||||||
json_add_string "qrcode" "data:image/svg+xml;base64,$qr_base64"
|
printf '{"qrcode":"data:image/svg+xml;base64,' > "$tmpfile"
|
||||||
json_add_string "config" "$config"
|
echo "$config" | qrencode -t SVG -o - | base64 -w 0 >> "$tmpfile"
|
||||||
|
printf '","config":"%s"}\n' "$config_escaped" >> "$tmpfile"
|
||||||
|
|
||||||
json_dump
|
cat "$tmpfile"
|
||||||
|
rm -f "$tmpfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get bandwidth history (if vnstat available)
|
# Get bandwidth history (if vnstat available)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user