From 37ad990af9cd5d72bc4f8eb67bce4f461c225920 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 11:27:37 +0000 Subject: [PATCH 1/4] Default ENCODE_PRESET/CRF_SEASONS_FINAL in make-finals.sh Older sky-cam.conf versions may not define these. Fall back to the canonical defaults so make-finals.sh works without requiring the user to update their local conf. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- make-finals.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/make-finals.sh b/make-finals.sh index 9ede6a4..3817087 100755 --- a/make-finals.sh +++ b/make-finals.sh @@ -21,6 +21,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(realpath "$0")")" source "$SCRIPT_DIR/sky-cam.conf" export TIMEZONE +ENCODE_PRESET="${ENCODE_PRESET:-slow}" +CRF_SEASONS_FINAL="${CRF_SEASONS_FINAL:-26}" BACKUP_ROOT="" DRY_RUN=false From 9d4d50b91ca773657430022f57315921ea7c8b52 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 15:21:12 +0000 Subject: [PATCH 2/4] Fix install.sh for non-login shell environments - Set XDG_RUNTIME_DIR before systemctl --user calls so daemon-reload and enable --now work when run outside a login session (e.g. via SSH or sudo) - Run loginctl enable-linger so user services start at boot without a login session - Update .env.example to use single quotes around RTSP URLs and document URL-encoding for special characters in passwords https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- install.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a4bb3a3..9128c20 100755 --- a/install.sh +++ b/install.sh @@ -202,8 +202,16 @@ env_example="$HERE/.env.example" echo "# .env is gitignored and never checked in." echo "" echo "# RTSP stream URLs — one line per camera (variable name = CAM_RTSP_)" + echo "#" + echo "# Use single quotes around the whole value to prevent shell interpretation." + echo "# Special characters in the PASSWORD part of the URL must be URL-encoded:" + echo "# @ -> %40 : -> %3A / -> %2F # -> %23" + echo "# ! -> %21 \$ -> %24 & -> %26 % -> %25" + echo "# + -> %2B = -> %3D space -> %20" + echo "# Example: password p@ss!word becomes p%40ss%21word in the URL." + echo "" for cam in "${CAMERAS[@]}"; do - echo "CAM_RTSP_${cam}=rtsp://admin:PASSWORD@192.168.1.XXX:554/stream1" + echo "CAM_RTSP_${cam}='rtsp://admin:PASSWORD@192.168.1.XXX:554/stream1'" done echo "" echo "# Mattermost upload" @@ -218,6 +226,16 @@ env_example="$HERE/.env.example" } > "$env_example" echo " wrote .env.example (cp .env.example .env then fill in real values)" +# ── User-session prerequisites (non-system installs only) ──────────────────── +if ! $SYSTEM_MODE; then + # Make systemctl --user reachable when run outside a login session + export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" + # Start user services at boot even without an interactive login + loginctl enable-linger "$USER" \ + && echo " loginctl enable-linger: ok" \ + || echo " WARNING: loginctl enable-linger failed (may need to run manually)" +fi + # ── Reload and enable ───────────────────────────────────────────────────────── echo "" $SC daemon-reload From 3c2e413ea29c6aeb7f46e544da35eabf1cbe5038 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 15:25:12 +0000 Subject: [PATCH 3/4] Expand URL-encoding reference in .env.example Full number-row special character table with percent codes, safe characters called out, and a note on : and / which break URL parsing. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 9128c20..c4df99e 100755 --- a/install.sh +++ b/install.sh @@ -204,11 +204,15 @@ env_example="$HERE/.env.example" echo "# RTSP stream URLs — one line per camera (variable name = CAM_RTSP_)" echo "#" echo "# Use single quotes around the whole value to prevent shell interpretation." - echo "# Special characters in the PASSWORD part of the URL must be URL-encoded:" - echo "# @ -> %40 : -> %3A / -> %2F # -> %23" - echo "# ! -> %21 \$ -> %24 & -> %26 % -> %25" - echo "# + -> %2B = -> %3D space -> %20" - echo "# Example: password p@ss!word becomes p%40ss%21word in the URL." + echo "# Special characters in the PASSWORD must be URL-encoded (number-row reference):" + echo "#" + echo "# ! %21 @ %40 # %23 \$ %24 % %25 ^ %5E" + echo "# & %26 * %2A ( %28 ) %29 - safe _ safe" + echo "# + %2B = %3D ~ %7E \` %60 space %20" + echo "#" + echo "# Also critical (break URL parsing if unencoded): : %3A / %2F" + echo "#" + echo "# Example: password my@p\$ss:word! -> my%40p%24ss%3Aword%21" echo "" for cam in "${CAMERAS[@]}"; do echo "CAM_RTSP_${cam}='rtsp://admin:PASSWORD@192.168.1.XXX:554/stream1'" From 98cef1bcd8e1e100bf70e5d77e54b2d1e0897095 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 15:26:42 +0000 Subject: [PATCH 4/4] Add url-encode-password.sh helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prompts for a password without echoing, URL-encodes it via Python's urllib.parse.quote, and prints the result with a ready-to-paste .env snippet. Password is passed via environment variable to avoid any shell quoting or injection issues — never written to disk or network. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- url-encode-password.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 url-encode-password.sh diff --git a/url-encode-password.sh b/url-encode-password.sh new file mode 100755 index 0000000..d8714ea --- /dev/null +++ b/url-encode-password.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# url-encode-password.sh — URL-encode a password for use in an RTSP (or any) URL. +# +# Runs entirely locally. The password is read without echoing, never written +# to disk, never sent anywhere. The encoded result is printed to stdout so +# you can copy it straight into your .env file. +# +# Usage: +# ./url-encode-password.sh + +printf 'Password (not echoed): ' +read -rs password +echo # newline after silent input + +# Pass via environment variable — avoids any shell quoting / injection issues. +encoded=$(PASSWORD="$password" python3 -c " +import os, urllib.parse +print(urllib.parse.quote(os.environ['PASSWORD'], safe='')) +") + +echo "URL-encoded: $encoded" +echo "" +echo "Paste into .env like:" +echo " CAM_RTSP_='rtsp://admin:${encoded}@192.168.1.XXX:554/stream1'"