Static page that plots Home Assistant on/off history of the heatpump compressor with pan/zoom, per-phase hover durations and statistics (min/max/mean/median, total on-time, duty cycle) for the visible range. English/German UI. Served by nginx in Docker with basic auth, CSP and a healthcheck; Plotly is vendored locally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
746 B
Bash
Executable File
21 lines
746 B
Bash
Executable File
#!/bin/sh
|
|
# Creates nginx/.htpasswd for HTTP basic auth.
|
|
# Usage: ./set-password.sh <user> [password] (prompts for the password if omitted)
|
|
set -eu
|
|
|
|
user="${1:?usage: $0 <user> [password]}"
|
|
case "$user" in *:*) echo "user name must not contain ':'" >&2; exit 1 ;; esac
|
|
|
|
if [ $# -ge 2 ]; then
|
|
hash=$(openssl passwd -apr1 "$2")
|
|
else
|
|
hash=$(openssl passwd -apr1)
|
|
fi
|
|
|
|
file="$(dirname "$0")/nginx/.htpasswd"
|
|
[ -d "$file" ] && rmdir "$file" # docker creates a directory if the file was missing on first start
|
|
umask 077
|
|
printf '%s:%s\n' "$user" "$hash" > "$file"
|
|
chmod 644 "$file" # nginx workers must be able to read it
|
|
echo "Wrote $file for user '$user'. Run 'docker compose restart' if the container is already running."
|