feat(qbit-ui,config-edit): add qui option, fix Byparr sync race, add Esc navigation & active state

This commit is contained in:
soulis-1256 2026-11-21 21:26:15 +02:00
parent 5529f74c0b
commit fd576d27ac
No known key found for this signature in database
24 changed files with 1691 additions and 362 deletions

View file

@ -29,7 +29,9 @@ PORT_FORWARD_ONLY=${PORT_FORWARD_ONLY}
VPN_PORT_FORWARDING=${VPN_PORT_FORWARDING}
# Optional feature overlays
# y/n — VueTorrent alternate WebUI mod for qBittorrent
# vuetorrent | qui | stock — qBittorrent WebUI frontend
QBIT_UI=${QBIT_UI}
# y/n — legacy sync for QBIT_UI=vuetorrent
VUETORRENT_ENABLED=${VUETORRENT_ENABLED}
# none | intel | nvidia — hardware transcoding passthrough for Jellyfin
GPU_TRANSCODING=${GPU_TRANSCODING}

View file

@ -47,7 +47,8 @@ Enable during `Manual` setup or toggle anytime via `assemblrr config edit`:
| Overlay File | Env Key | Description |
|---|---|---|
| [`compose/vuetorrent.yaml`](compose/vuetorrent.yaml) | `VUETORRENT_ENABLED=y` | Modern VueTorrent WebUI theme mod for qBittorrent *(default: enabled)* |
| [`compose/vuetorrent.yaml`](compose/vuetorrent.yaml) | `QBIT_UI=vuetorrent` | Modern VueTorrent theme inside qBittorrent (:8081) *(default)* |
| [`compose/qui.yaml`](compose/qui.yaml) | `QBIT_UI=qui` | Fast Go+React standalone qBittorrent WebUI (`7476`, leaves stock qBit on `8081`) |
| [`compose/gpu-intel.yaml`](compose/gpu-intel.yaml) | `GPU_TRANSCODING=amd` / `intel` | AMD VAAPI / Intel QSV (`/dev/dri`) hardware transcoding + Jellyfin auto-wiring |
| [`compose/gpu-nvidia.yaml`](compose/gpu-nvidia.yaml) | `GPU_TRANSCODING=nvidia` | NVIDIA NVENC/NVDEC GPU reservation + Jellyfin auto-wiring *(auto-enabled when detected)* |
| [`compose/byparr.yaml`](compose/byparr.yaml) | `BYPARR_ENABLED=y` | Byparr Cloudflare solver wired into Prowlarr (`byparr` tag) |

View file

@ -669,7 +669,10 @@ check_status() {
badges+=("VPN off")
fi
[ "${GPU_TRANSCODING:-none}" != "none" ] && badges+=("GPU ${GPU_TRANSCODING}")
[ "${VUETORRENT_ENABLED:-n}" = "y" ] && badges+=("VueTorrent")
case "$(qbit_ui_mode 2>/dev/null || echo "${QBIT_UI:-stock}")" in
vuetorrent) badges+=("VueTorrent") ;;
qui) badges+=("qui") ;;
esac
[ "${BYPARR_ENABLED:-n}" = "y" ] && badges+=("Byparr")
[ "${USENET_ENABLED:-n}" = "y" ] && badges+=("Usenet")
local badge_str="" b
@ -837,7 +840,7 @@ show_config() {
echo " VPN enabled: ${VPN_ENABLED:-n}"
echo " VPN type: ${VPN_TYPE:-openvpn}"
echo " Timezone: ${TZ:-UTC}"
echo " VueTorrent: ${VUETORRENT_ENABLED:-n}"
echo " qBittorrent UI: $(qbit_ui_mode 2>/dev/null || echo "${QBIT_UI:-stock}")"
echo " GPU transcoding: ${GPU_TRANSCODING:-none}"
echo " Byparr solver: ${BYPARR_ENABLED:-n}"
echo " SABnzbd / Usenet: ${USENET_ENABLED:-n}"

View file

@ -142,6 +142,10 @@ main() {
run_critical qbit_set_credentials
fi
if type qbit_qui_enabled >/dev/null 2>&1 && qbit_qui_enabled; then
run_optional configure_qui
fi
if [ "${USENET_ENABLED:-n}" = "y" ] || [ "${USENET_ENABLED:-n}" = "Y" ]; then
run_critical configure_sabnzbd
fi
@ -233,8 +237,13 @@ main() {
_cfg_log_info " 1. Open Jellyfin at http://${ui_host}:8096"
_cfg_log_info " 2. Open Seerr at http://${ui_host}:5055 and request a movie or show"
_cfg_log_info " 3. qBittorrent UI: http://${ui_host}:8081 | Bazarr UI: http://${ui_host}:6767"
local step_num=4
if type qbit_qui_enabled >/dev/null 2>&1 && qbit_qui_enabled; then
_cfg_log_info " ${step_num}. qui UI: http://${ui_host}:7476"
step_num=$((step_num + 1))
fi
if [ "${USENET_ENABLED:-n}" = "y" ] || [ "${USENET_ENABLED:-n}" = "Y" ]; then
_cfg_log_info " 4. SABnzbd UI: http://${ui_host}:8085"
_cfg_log_info " ${step_num}. SABnzbd UI: http://${ui_host}:8085"
fi
echo
if [ -n "$AUTH_USERNAME" ]; then

View file

@ -298,7 +298,8 @@ generate_env_file() {
export VPN_ENABLED VPN_SERVICE VPN_TYPE
export WIREGUARD_ADDRESSES
export PORT_FORWARD_ONLY VPN_PORT_FORWARDING
export VUETORRENT_ENABLED="${vuetorrent_enabled:-y}"
export QBIT_UI="${qbit_ui:-vuetorrent}"
[ "$QBIT_UI" = "vuetorrent" ] && export VUETORRENT_ENABLED="y" || export VUETORRENT_ENABLED="n"
export GPU_TRANSCODING="${gpu_transcoding:-none}"
export BYPARR_ENABLED="${byparr_enabled:-n}"
export USENET_ENABLED="${usenet_enabled:-n}"
@ -309,7 +310,7 @@ generate_env_file() {
log_error "Failed to locate .env.example"
fi
# Explicit key list matching .env.example 1-to-1
envsubst '${PUID} ${PGID} ${MEDIA_DIRECTORY} ${INSTALL_DIRECTORY} ${MEDIA_SERVICE} ${TZ} ${VPN_ENABLED} ${VPN_SERVICE} ${VPN_TYPE} ${WIREGUARD_ADDRESSES} ${PORT_FORWARD_ONLY} ${VPN_PORT_FORWARDING} ${VUETORRENT_ENABLED} ${GPU_TRANSCODING} ${BYPARR_ENABLED} ${USENET_ENABLED} ${API_HOST}' \
envsubst '${PUID} ${PGID} ${MEDIA_DIRECTORY} ${INSTALL_DIRECTORY} ${MEDIA_SERVICE} ${TZ} ${VPN_ENABLED} ${VPN_SERVICE} ${VPN_TYPE} ${WIREGUARD_ADDRESSES} ${PORT_FORWARD_ONLY} ${VPN_PORT_FORWARDING} ${QBIT_UI} ${VUETORRENT_ENABLED} ${GPU_TRANSCODING} ${BYPARR_ENABLED} ${USENET_ENABLED} ${API_HOST}' \
< "$env_template" | tr -d '\r' > "$env_file" || \
log_error "Failed to generate .env file"
@ -461,7 +462,8 @@ MEDIA_SERVICE="${media_service:-jellyfin}"
VPN_ENABLED="${setup_vpn,,}"
VPN_TYPE="${vpn_type:-openvpn}"
TZ="$tz"
VUETORRENT_ENABLED="${vuetorrent_enabled:-y}"
QBIT_UI="${qbit_ui:-vuetorrent}"
VUETORRENT_ENABLED="$([ "${qbit_ui:-vuetorrent}" = "vuetorrent" ] && echo y || echo n)"
GPU_TRANSCODING="${gpu_transcoding:-none}"
BYPARR_ENABLED="${byparr_enabled:-n}"
USENET_ENABLED="${usenet_enabled:-n}"
@ -856,7 +858,7 @@ main() {
configure_quality_profile
configure_subtitle_language
configure_opensubtitles
configure_vuetorrent
configure_qbit_ui
configure_gpu_transcoding
configure_byparr
configure_usenet
@ -877,7 +879,7 @@ main() {
echo " VPN: DISABLED"
fi
echo " Media service: $media_service (port $media_service_port)"
echo " VueTorrent UI: ${vuetorrent_enabled:-y}"
echo " qBittorrent UI: ${qbit_ui:-vuetorrent}"
echo " GPU transcoding: ${gpu_transcoding:-none}"
echo " Byparr solver: ${byparr_enabled:-n}"
echo " SABnzbd / Usenet: ${usenet_enabled:-n}"
@ -932,7 +934,7 @@ main() {
write_auth_secrets
write_opensubtitles_secrets
write_usenet_secrets
VUETORRENT_ENABLED="${vuetorrent_enabled:-y}" write_qbittorrent_config
QBIT_UI="${qbit_ui:-vuetorrent}" VUETORRENT_ENABLED="${vuetorrent_enabled:-y}" write_qbittorrent_config
write_runtime_config
_record_install_metadata
install_cli
@ -973,7 +975,10 @@ main() {
ready_badges+=("VPN off")
fi
[ "${gpu_transcoding:-none}" != "none" ] && ready_badges+=("GPU ${gpu_transcoding}")
[ "${vuetorrent_enabled:-y}" = "y" ] && ready_badges+=("VueTorrent")
case "${qbit_ui:-vuetorrent}" in
vuetorrent) ready_badges+=("VueTorrent") ;;
qui) ready_badges+=("qui") ;;
esac
[ "${byparr_enabled:-n}" = "y" ] && ready_badges+=("Byparr")
[ "${usenet_enabled:-n}" = "y" ] && ready_badges+=("Usenet")
local badge_str="" _b

30
compose/qui.yaml Normal file
View file

@ -0,0 +1,30 @@
# Overlay: qui standalone qBittorrent WebUI (alternative to VueTorrent; leaves stock qBittorrent on :8081)
services:
qui:
image: ghcr.io/autobrr/qui:v1.36.0
container_name: qui
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
- QUI__HOST=0.0.0.0
- QUI__PORT=7476
ports:
- 7476:7476
volumes:
- ${INSTALL_DIRECTORY}/config/qui:/config
- ${MEDIA_DIRECTORY}:/data
depends_on:
qbittorrent:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -qO /dev/null http://127.0.0.1:7476/health || exit 1"]
interval: 15s
timeout: 5s
retries: 3
start_period: 15s
start_interval: 2s
restart: unless-stopped
networks:
assemblrr_network:
ipv4_address: 172.60.0.27

View file

@ -10,7 +10,7 @@ readonly _ASSEMBLRR_COMPOSE_SOURCED=1
# Builds the docker compose arguments array (COMPOSE_ARGS) based on VPN & feature flags.
# Usage: build_compose_args "$install_dir" "$vpn_enabled"
# Reads optional env flags: VUETORRENT_ENABLED, GPU_TRANSCODING, BYPARR_ENABLED, USENET_ENABLED.
# Reads optional env flags: QBIT_UI (or legacy VUETORRENT_ENABLED), GPU_TRANSCODING, BYPARR_ENABLED, USENET_ENABLED.
# custom.yaml is always appended last so user overrides win.
build_compose_args() {
local _install_dir="$1"
@ -25,11 +25,14 @@ build_compose_args() {
COMPOSE_ARGS+=("-f" "$_install_dir/compose/direct-access.yaml")
fi
if [ "${VUETORRENT_ENABLED:-n}" = "y" ] || [ "${VUETORRENT_ENABLED:-n}" = "Y" ]; then
if [ -f "$_install_dir/compose/vuetorrent.yaml" ]; then
COMPOSE_ARGS+=("-f" "$_install_dir/compose/vuetorrent.yaml")
fi
fi
case "$(qbit_ui_mode)" in
vuetorrent)
[ -f "$_install_dir/compose/vuetorrent.yaml" ] && COMPOSE_ARGS+=("-f" "$_install_dir/compose/vuetorrent.yaml")
;;
qui)
[ -f "$_install_dir/compose/qui.yaml" ] && COMPOSE_ARGS+=("-f" "$_install_dir/compose/qui.yaml")
;;
esac
case "${GPU_TRANSCODING:-none}" in
intel|INTEL|amd|AMD|vaapi|VAAPI)

View file

@ -24,7 +24,7 @@ opensubtitles|OpenSubtitles.com username and password
auth|Shared login for every service UI
timezone|Container timezone
vpn|VPN on/off, provider, and credentials (restarts stack)
vuetorrent|qBittorrent VueTorrent WebUI theme (restarts stack)
qbit-ui|qBittorrent WebUI: VueTorrent, qui, or stock (restarts stack)
gpu|Jellyfin hardware GPU transcoding: Intel/AMD or NVIDIA (restarts stack)
byparr|Byparr Cloudflare solver for Prowlarr (restarts stack)
usenet|SABnzbd Usenet downloader and NNTP provider (restarts stack)
@ -54,6 +54,9 @@ config_edit_resolve() {
local want="${1:-}"
want=$(echo "$want" | tr '[:upper:]' '[:lower:]')
[ -z "$want" ] && return 1
case "$want" in
vuetorrent|vue|qui) want="qbit-ui" ;;
esac
local id
while IFS='|' read -r id _; do
[ -z "$id" ] && continue
@ -202,33 +205,187 @@ _config_edit_restart_stack() {
log_success "Stack restarted"
}
_config_edit_kv() {
local key="$1" f_main="$2" envf="$3"
local v=""
[ -n "$f_main" ] && [ -f "$f_main" ] && v=$(_pointer_get "$f_main" "$key")
[ -z "$v" ] && [ -n "$envf" ] && [ -f "$envf" ] && v=$(_pointer_get "$envf" "$key")
printf '%s' "$v"
}
_config_edit_current_status() {
local id="$1"
local inst="${INSTALL_DIR:-}"
[ -n "$inst" ] && [ -d "$inst" ] || return 0
local cfg="" envf="$inst/.env"
[ -f "$inst/.assemblrr-config" ] && cfg="$inst/.assemblrr-config"
[ -z "$cfg" ] && [ -f "$inst/.${APP_NAME:-assemblrr}-config" ] && cfg="$inst/.${APP_NAME:-assemblrr}-config"
local f_main="${cfg:-$envf}"
local val="" val2=""
case "$id" in
qbit-ui)
val=$(_config_edit_kv "QBIT_UI" "$f_main" "$envf")
if [ -z "$val" ]; then
val2=$(_config_edit_kv "VUETORRENT_ENABLED" "$f_main" "$envf")
case "${val2,,}" in
y|yes) val="vuetorrent" ;;
*) val="stock" ;;
esac
fi
case "${val,,}" in
vuetorrent|vue) echo "on|vuetorrent" ;;
qui) echo "on|qui" ;;
*) echo "off|stock" ;;
esac
;;
gpu)
val=$(_config_edit_kv "GPU_TRANSCODING" "$f_main" "$envf")
val="${val:-none}"
case "${val,,}" in
""|none) echo "off|none" ;;
*) echo "on|${val}" ;;
esac
;;
byparr)
val=$(_config_edit_kv "BYPARR_ENABLED" "$f_main" "$envf")
case "${val,,}" in
y|yes) echo "on|on" ;;
*) echo "off|off" ;;
esac
;;
usenet)
val=$(_config_edit_kv "USENET_ENABLED" "$f_main" "$envf")
case "${val,,}" in
y|yes)
val2=$(_config_edit_kv "USENET_HOST" "$f_main" "$envf")
if [ -n "$val2" ]; then
echo "on|on · ${val2}"
else
echo "on|on"
fi
;;
*) echo "off|off" ;;
esac
;;
vpn)
val=$(_config_edit_kv "VPN_ENABLED" "$f_main" "$envf")
case "${val,,}" in
y|yes)
val2=$(_config_edit_kv "VPN_SERVICE" "$f_main" "$envf")
if [ -n "$val2" ]; then
echo "on|on · ${val2}"
else
echo "on|on"
fi
;;
*) echo "off|off" ;;
esac
;;
profile)
val=$(_config_edit_kv "QUALITY_TIER" "$f_main" "$envf")
val2=$(_config_edit_kv "QUALITY_SOURCE" "$f_main" "$envf")
case "${val,,}" in
uhd) [ "${val2,,}" = "web" ] && echo "on|4K WEB" || echo "on|4K Bluray+WEB" ;;
hd) [ "${val2,,}" = "web" ] && echo "on|1080p WEB" || echo "on|1080p Bluray+WEB" ;;
any) echo "dim|Any" ;;
*) echo "dim|default" ;;
esac
;;
language)
val=$(_config_edit_kv "SUBTITLE_LANGUAGES" "$f_main" "$envf")
[ -z "$val" ] && val=$(_config_edit_kv "SUBTITLE_LANGUAGE" "$f_main" "$envf")
if [ -n "$val" ]; then
echo "on|${val}"
else
echo "dim|default (en)"
fi
;;
timezone)
val=$(_config_edit_kv "TZ" "$f_main" "$envf")
echo "on|${val:-UTC}"
;;
opensubtitles)
if [ -s "$inst/secrets/opensubtitles_username.txt" ]; then
val=$(cat "$inst/secrets/opensubtitles_username.txt" 2>/dev/null || true)
echo "on|set (${val})"
else
echo "off|not set"
fi
;;
auth)
if [ -s "$inst/secrets/auth_username.txt" ]; then
val=$(cat "$inst/secrets/auth_username.txt" 2>/dev/null || true)
echo "on|${val}"
else
echo "dim|unset"
fi
;;
indexers) echo "dim|in Prowlarr" ;;
providers) echo "dim|in Bazarr" ;;
all) echo "dim|full wizard" ;;
esac
}
_config_edit_pick() {
local data selected
data=$(_config_edit_catalog | awk -F'|' '{printf "%s\t%s\n", $1, $2}')
if type _fzf_can_render >/dev/null 2>&1 && _fzf_can_render && _fzf_has_tty; then
selected=$(echo "$data" | fzf \
local interactive=0
if type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
interactive=1
fi
if [ "$interactive" -eq 1 ]; then
local data="" id desc st kind label col_id col_st line
while IFS='|' read -r id desc; do
[ -z "$id" ] && continue
st=$(_config_edit_current_status "$id" || true)
kind="${st%%|*}"
label="${st#*|}"
[ "$st" = "$kind" ] && label=""
col_id=$(_tui_pad_ansi "$id" 14)
if [ -n "$label" ]; then
case "$kind" in
on) col_st=$(_tui_pad_ansi "[$label]" 20 "32") ;;
*) col_st=$(_tui_pad_ansi "[$label]" 20 "2") ;;
esac
else
col_st=$(_tui_pad_ansi "" 20)
fi
line=$(printf '%s\t%s %s %s' "$id" "$col_id" "$col_st" "$desc")
data+="${line}"$'\n'
done < <(_config_edit_catalog)
local selected fzf_rc=0
selected=$(printf '%s' "$data" | fzf \
--ansi \
--prompt="Edit which setting> " \
--delimiter='\t' \
--with-nth=1,2 \
--header='↑↓=navigate Enter=confirm Esc=cancel' \
--delimiter=$'\t' \
--with-nth=2 \
--header='↑↓=navigate Enter=confirm Esc=exit' \
--height=60% \
--layout=reverse \
--border \
2>/dev/null | cut -f1 || true)
2>/dev/null) || fzf_rc=$?
flush_tty_input
echo "$selected"
[ "$fzf_rc" -ne 0 ] && return 0
printf '%s\n' "$selected" | cut -f1
return 0
fi
# Non-fzf fallback prints all UI/prompts to stderr so stdout returns ONLY the chosen section id
echo >&2
log_info "What do you want to change?" >&2
local i=1 id desc
local i=1 id desc st label tag=""
while IFS='|' read -r id desc; do
printf " %2d) %-14s %s\n" "$i" "$id" "$desc" >&2
st=$(_config_edit_current_status "$id" || true)
label="${st#*|}"
[ -n "$st" ] && [ "$st" != "$label" ] && tag=" [$label]" || tag=""
printf " %2d) %-14s %-18s %s\n" "$i" "$id" "$tag" "$desc" >&2
i=$((i + 1))
done < <(_config_edit_catalog)
local choice=""
read_prompt "Choose a section [1]: " choice
if ! read_prompt "Choose a section [1]: " choice; then
echo ""
return 0
fi
choice=${choice:-1}
if [[ "$choice" =~ ^[0-9]+$ ]]; then
sed -n "${choice}p" < <(config_edit_section_ids)
@ -252,14 +409,14 @@ _config_edit_indexers() {
SELECTED_INDEXERS=()
configure_indexers "$PROWLARR_API_KEY"
if ui_picker_cancelled; then
return 0
return "${PROMPT_CANCEL_RC:-2}"
fi
if [ "${#SELECTED_INDEXERS[@]}" -eq 0 ]; then
local wipe="n"
if [ -t 0 ] && [ "${ASSEMBLRR_NONINTERACTIVE:-0}" != "1" ]; then
echo
log_warning "No indexers selected."
read_prompt "Remove ALL Prowlarr indexers? (y/N) [Default = n]: " wipe
read_prompt "Remove ALL Prowlarr indexers? (y/N) [Default = n]: " wipe || return "${PROMPT_CANCEL_RC:-2}"
wipe=${wipe:-n}
fi
if [ "${wipe,,}" != "y" ]; then
@ -278,14 +435,14 @@ _config_edit_providers() {
SELECTED_SUBTITLE_PROVIDERS=()
configure_subtitle_providers
if ui_picker_cancelled; then
return 0
return "${PROMPT_CANCEL_RC:-2}"
fi
if [ "${#SELECTED_SUBTITLE_PROVIDERS[@]}" -eq 0 ]; then
local wipe="n"
if [ -t 0 ] && [ "${ASSEMBLRR_NONINTERACTIVE:-0}" != "1" ]; then
echo
log_warning "No subtitle providers selected."
read_prompt "Disable ALL Bazarr providers? (y/N) [Default = n]: " wipe
read_prompt "Disable ALL Bazarr providers? (y/N) [Default = n]: " wipe || return "${PROMPT_CANCEL_RC:-2}"
wipe=${wipe:-n}
fi
if [ "${wipe,,}" != "y" ]; then
@ -298,8 +455,14 @@ _config_edit_providers() {
_config_edit_language() {
_config_edit_load
configure_subtitle_language
if ui_picker_cancelled; then
local rc=0
configure_subtitle_language || rc=$?
if [ "$rc" -eq "${PROMPT_CANCEL_RC:-2}" ] || ui_picker_cancelled; then
return "${PROMPT_CANCEL_RC:-2}"
fi
if [ "${subtitle_language:-}" = "${SUBTITLE_LANGUAGE:-}" ] && \
[ "${subtitle_languages:-}" = "${SUBTITLE_LANGUAGES:-}" ]; then
log_info "Subtitle languages unchanged."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "SUBTITLE_LANGUAGE" "${subtitle_language:-}"
@ -312,8 +475,13 @@ _config_edit_language() {
_config_edit_profile() {
_config_edit_load
configure_quality_profile
local prev_tier="${QUALITY_TIER:-}" prev_source="${QUALITY_SOURCE:-}"
configure_quality_profile || return $?
quality_sync_exports
if [ "$QUALITY_TIER" = "$prev_tier" ] && [ "$QUALITY_SOURCE" = "$prev_source" ]; then
log_info "Quality profile unchanged."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "QUALITY_TIER" "$QUALITY_TIER"
config_set_kv "$(_config_edit_runtime_file)" "QUALITY_SOURCE" "$QUALITY_SOURCE"
config_set_kv "$(_config_edit_runtime_file)" "SEERR_IS_4K" "$SEERR_IS_4K"
@ -330,7 +498,12 @@ _config_edit_profile() {
_config_edit_opensubtitles() {
_config_edit_load
configure_opensubtitles
local rc=0
configure_opensubtitles || rc=$?
if [ "$rc" -eq "${PROMPT_CANCEL_RC:-2}" ]; then
log_info "Cancelled."
return "${PROMPT_CANCEL_RC:-2}"
fi
local secrets_dir="$INSTALL_DIR/secrets"
mkdir -p "$secrets_dir"
if [ "${opensubtitles_enabled:-n}" = "y" ] && [ -n "${opensubtitles_username:-}" ]; then
@ -344,6 +517,7 @@ _config_edit_opensubtitles() {
return 0
fi
log_info "Cancelled."
return "${PROMPT_CANCEL_RC:-2}"
}
_config_edit_auth() {
@ -352,7 +526,7 @@ _config_edit_auth() {
old_user=$(cat "$INSTALL_DIR/secrets/auth_username.txt" 2>/dev/null || echo "${AUTH_USERNAME:-}")
old_pass=$(cat "$INSTALL_DIR/secrets/auth_password.txt" 2>/dev/null || echo "${AUTH_PASSWORD:-}")
configure_auth
configure_auth || return $?
local secrets_dir="$INSTALL_DIR/secrets"
AUTH_USERNAME="${auth_username:-admin}"
AUTH_PASSWORD="${auth_password:-}"
@ -384,6 +558,9 @@ _config_edit_auth() {
if sabnzbd_enabled 2>/dev/null; then
sabnzbd_change_credentials "$AUTH_USERNAME" "$AUTH_PASSWORD" || fail=1
fi
if type qbit_qui_enabled >/dev/null 2>&1 && qbit_qui_enabled; then
qui_change_credentials "$old_user" "$old_pass" "$AUTH_USERNAME" "$AUTH_PASSWORD" || fail=1
fi
if type seerr_verify_login >/dev/null 2>&1; then
seerr_verify_login || true
@ -405,7 +582,12 @@ _config_edit_auth() {
_config_edit_timezone() {
_config_edit_load
configure_timezone
local prev_tz="${TZ:-UTC}"
configure_timezone || return $?
if [ "${tz:-UTC}" = "$prev_tz" ]; then
log_info "Timezone unchanged (${prev_tz}) — no restart needed."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "TZ" "${tz:-UTC}"
config_set_kv "$INSTALL_DIR/.env" "TZ" "${tz:-UTC}" 0
TZ="${tz:-UTC}"
@ -414,9 +596,14 @@ _config_edit_timezone() {
_config_edit_vpn() {
_config_edit_load
configure_vpn
local prev_vpn="${VPN_ENABLED:-n}"
configure_vpn || return $?
local enabled="n"
[ "${setup_vpn,,}" = "y" ] && enabled="y"
if [ "$enabled" = "n" ] && [ "${prev_vpn,,}" != "y" ]; then
log_info "VPN already disabled — no restart needed."
return 0
fi
VPN_ENABLED="$enabled"
VPN_TYPE="${vpn_type:-openvpn}"
VPN_SERVICE="${vpn_service:-}"
@ -474,22 +661,54 @@ _config_edit_vpn() {
wait_for_api "Prowlarr" "9696" "$PROWLARR_API_KEY" "/api/v1/system/status" || true
prowlarr_sync_gluetun_proxy "$PROWLARR_API_KEY" || true
fi
if type qbit_qui_enabled >/dev/null 2>&1 && qbit_qui_enabled; then
configure_qui || true
fi
}
_config_edit_qbit_ui() {
_config_edit_load
local prev_ui
prev_ui=$(qbit_ui_mode)
configure_qbit_ui || return $?
if ui_picker_cancelled; then
return "${PROMPT_CANCEL_RC:-2}"
fi
QBIT_UI="${qbit_ui:-vuetorrent}"
if [ "$QBIT_UI" = "$prev_ui" ]; then
log_info "qBittorrent UI unchanged (${prev_ui}) — no restart needed."
return 0
fi
[ "$QBIT_UI" = "vuetorrent" ] && VUETORRENT_ENABLED="y" || VUETORRENT_ENABLED="n"
config_set_kv "$(_config_edit_runtime_file)" "QBIT_UI" "$QBIT_UI"
config_set_kv "$(_config_edit_runtime_file)" "VUETORRENT_ENABLED" "$VUETORRENT_ENABLED"
config_set_kv "$INSTALL_DIR/.env" "QBIT_UI" "$QBIT_UI" 0
config_set_kv "$INSTALL_DIR/.env" "VUETORRENT_ENABLED" "$VUETORRENT_ENABLED" 0
if [ "$QBIT_UI" = "qui" ]; then
mkdir -p "$INSTALL_DIR/config/qui"
ensure_owned "$INSTALL_DIR/config/qui" "${PUID:-$(id -u)}" "${PGID:-$(id -g)}" 2>/dev/null || true
fi
install_directory="$INSTALL_DIR" write_qbittorrent_config
_config_edit_restart_stack
qbit_set_credentials || true
if qbit_qui_enabled; then
configure_qui || true
fi
}
_config_edit_vuetorrent() {
_config_edit_load
configure_vuetorrent
VUETORRENT_ENABLED="${vuetorrent_enabled:-n}"
config_set_kv "$(_config_edit_runtime_file)" "VUETORRENT_ENABLED" "$VUETORRENT_ENABLED"
config_set_kv "$INSTALL_DIR/.env" "VUETORRENT_ENABLED" "$VUETORRENT_ENABLED" 0
_config_edit_restart_stack
qbit_set_credentials || true
_config_edit_qbit_ui "$@"
}
_config_edit_gpu() {
_config_edit_load
configure_gpu_transcoding
local prev_gpu="${GPU_TRANSCODING:-none}"
configure_gpu_transcoding || return $?
GPU_TRANSCODING="${gpu_transcoding:-none}"
if [ "$GPU_TRANSCODING" = "$prev_gpu" ]; then
log_info "GPU transcoding unchanged (${prev_gpu}) — no restart needed."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "GPU_TRANSCODING" "$GPU_TRANSCODING"
config_set_kv "$INSTALL_DIR/.env" "GPU_TRANSCODING" "$GPU_TRANSCODING" 0
_config_edit_restart_stack
@ -501,8 +720,13 @@ _config_edit_gpu() {
_config_edit_byparr() {
_config_edit_load
configure_byparr
local prev_byparr="${BYPARR_ENABLED:-n}"
configure_byparr || return $?
BYPARR_ENABLED="${byparr_enabled:-n}"
if [ "${BYPARR_ENABLED,,}" = "${prev_byparr,,}" ]; then
log_info "Byparr unchanged (${prev_byparr,,}) — no restart needed."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "BYPARR_ENABLED" "$BYPARR_ENABLED"
config_set_kv "$INSTALL_DIR/.env" "BYPARR_ENABLED" "$BYPARR_ENABLED" 0
_config_edit_restart_stack
@ -514,8 +738,17 @@ _config_edit_byparr() {
_config_edit_usenet() {
_config_edit_load
configure_usenet
local prev_usenet="${USENET_ENABLED:-n}"
configure_usenet || return $?
USENET_ENABLED="${usenet_enabled:-n}"
if [ "$USENET_ENABLED" = "n" ] && [ "${prev_usenet,,}" != "y" ]; then
log_info "SABnzbd / Usenet already disabled — no restart needed."
return 0
fi
if [ "${usenet_keep_nntp:-0}" = "1" ] && [ "${prev_usenet,,}" = "y" ]; then
log_info "SABnzbd / Usenet unchanged — no restart needed."
return 0
fi
config_set_kv "$(_config_edit_runtime_file)" "USENET_ENABLED" "$USENET_ENABLED"
config_set_kv "$INSTALL_DIR/.env" "USENET_ENABLED" "$USENET_ENABLED" 0
config_set_kv "$(_config_edit_runtime_file)" "USENET_HOST" "${usenet_host:-}"
@ -587,34 +820,49 @@ config_edit_run() {
esac
_config_edit_load_picker
raw=$(_config_edit_pick)
raw=$(echo "${raw:-}" | head -1 | tr -d '[:space:]')
if [ -z "$raw" ]; then
echo "Cancelled."
return 0
fi
local prev_allow_esc="${PROMPT_ALLOW_ESC:-0}"
local rc=0
PROMPT_ALLOW_ESC=1
while true; do
raw=$(_config_edit_pick)
raw=$(echo "${raw:-}" | head -1 | tr -d '[:space:]')
if [ -z "$raw" ]; then
echo "Cancelled."
rc=0
break
fi
if ! section=$(config_edit_resolve "$raw"); then
log_error "Unknown config section: $raw"
return 1
fi
if ! section=$(config_edit_resolve "$raw"); then
log_error "Unknown config section: $raw"
rc=1
break
fi
flush_tty_input
flush_tty_input
case "$section" in
indexers) _config_edit_indexers ;;
providers) _config_edit_providers ;;
language) _config_edit_language ;;
profile) _config_edit_profile ;;
opensubtitles) _config_edit_opensubtitles ;;
auth) _config_edit_auth ;;
timezone) _config_edit_timezone ;;
vpn) _config_edit_vpn ;;
vuetorrent) _config_edit_vuetorrent ;;
gpu) _config_edit_gpu ;;
byparr) _config_edit_byparr ;;
usenet) _config_edit_usenet ;;
all) _config_edit_all ;;
*) log_error "Unknown config section: $section"; return 1 ;;
esac
rc=0
case "$section" in
indexers) _config_edit_indexers || rc=$? ;;
providers) _config_edit_providers || rc=$? ;;
language) _config_edit_language || rc=$? ;;
profile) _config_edit_profile || rc=$? ;;
opensubtitles) _config_edit_opensubtitles || rc=$? ;;
auth) _config_edit_auth || rc=$? ;;
timezone) _config_edit_timezone || rc=$? ;;
vpn) _config_edit_vpn || rc=$? ;;
qbit-ui|vuetorrent) _config_edit_qbit_ui || rc=$? ;;
gpu) _config_edit_gpu || rc=$? ;;
byparr) _config_edit_byparr || rc=$? ;;
usenet) _config_edit_usenet || rc=$? ;;
all) _config_edit_all || rc=$? ;;
*) log_error "Unknown config section: $section"; rc=1; break ;;
esac
if [ "$rc" -eq "${PROMPT_CANCEL_RC:-2}" ]; then
continue
fi
break
done
PROMPT_ALLOW_ESC="$prev_allow_esc"
return "$rc"
}

View file

@ -304,6 +304,7 @@ prepare_install_dirs() {
"config/recyclarr"
"config/bazarr"
"config/sabnzbd"
"config/qui"
"secrets"
"scripts"
)

View file

@ -27,6 +27,35 @@ _fzf_can_render() {
command -v fzf &>/dev/null && echo "test" | timeout 1 fzf --height=5 --no-mouse --filter="test" &>/dev/null
}
_fzf_is_interactive() {
_fzf_can_render && _fzf_has_tty
}
# Pad plain text to fixed width before optionally wrapping in an ANSI SGR color code.
_tui_pad_ansi() {
local text="$1"
local width="$2"
local code="${3:-}"
local padded
printf -v padded '%-*s' "$width" "$text"
if [ -n "$code" ] && [ -n "$text" ]; then
printf '\033[%sm%s\033[0m' "$code" "$padded"
else
printf '%s' "$padded"
fi
}
# Single-select fzf submenu with embedded 2-line header so Esc leaves zero scrollback lines.
_tui_edit_select() {
local prompt="$1"
local title="$2"
local default="$3"
local rows="$4"
local header
header="${title}"$'\n'"↑↓=navigate Enter=confirm Esc=back"
fzf_single_select_data "$rows" "$prompt" "$header" "$default" "2"
}
# True when installed fzf >= major.minor (handles older distro fzf like 0.29 on Ubuntu 22.04).
_fzf_version_ge() {
local req_maj="${1:-0}" req_min="${2:-0}" ver maj min
@ -249,11 +278,13 @@ pick_storage_paths() {
}
# Single-select from TSV rows (first column is the value).
# Optional $5 overrides fzf --with-nth (default: 1..2).
fzf_single_select_data() {
local data="$1"
local prompt="${2:-Select> }"
local header="${3:-↑↓=navigate Enter=confirm Esc=default}"
local default="${4:-}"
local with_nth="${5:-1..2}"
if [ -z "$data" ]; then
echo "$default"
@ -273,7 +304,9 @@ fzf_single_select_data() {
if ! _fzf_can_render || ! _fzf_has_tty; then
echo "$data" | head -25 >&2
local input=""
read_prompt "Enter selection (default: ${default:-first}): " input
if ! read_prompt "Enter selection (default: ${default:-first}): " input; then
return "${PROMPT_CANCEL_RC:-2}"
fi
if [ -z "$input" ]; then
if [ -n "$default" ]; then
echo "$default"
@ -286,22 +319,23 @@ fzf_single_select_data() {
return 0
fi
local selected
local selected fzf_rc=0
selected=$(echo "$data" | fzf \
--ansi \
--prompt="$prompt" \
--height=40% \
--reverse \
--border \
--header="$header" \
--delimiter=$'\t' \
--with-nth=1..2 \
2>/dev/null | cut -f1) || true
if [ -z "$selected" ]; then
echo "$default"
else
echo "$selected"
--with-nth="$with_nth" \
2>/dev/null) || fzf_rc=$?
flush_tty_input
if [ "$fzf_rc" -ne 0 ] || [ -z "$selected" ]; then
return "${PROMPT_CANCEL_RC:-2}"
fi
printf '%s\n' "$selected" | cut -f1
return 0
}
# Format Prowlarr schema JSON + existing-name JSON array into TSV menu rows:
@ -374,6 +408,7 @@ fzf_multi_select() {
if _fzf_can_render && $has_tty; then
local selected fzf_rc=0
local -a fzf_args=(
--ansi
--multi
--prompt="$prompt"
--delimiter=$'\t'
@ -437,10 +472,15 @@ configure_indexers() {
log_info "Skipping Prowlarr indexer picker (non-interactive)."
return 0
fi
ui_intro \
"Optional: pick Prowlarr indexers now, or skip and use the Prowlarr UI later." \
"Add or remove Prowlarr indexers. Esc keeps the current set."
log_info "Only enable sources you are authorized to use."
local interactive_edit=0
if ui_is_edit && _fzf_is_interactive; then
interactive_edit=1
else
ui_intro \
"Optional: pick Prowlarr indexers now, or skip and use the Prowlarr UI later." \
"Add or remove Prowlarr indexers. Esc keeps the current set."
log_info "Only enable sources you are authorized to use."
fi
local prowlarr_key="${provided_key:-}"
local indexer_data=""
@ -469,7 +509,11 @@ configure_indexers() {
local prompt header
if ui_is_edit; then
prompt="Prowlarr indexers> "
header="TAB=toggle Enter=save Esc=cancel [P]=private"
if [ "$interactive_edit" -eq 1 ]; then
header=$'Add or remove Prowlarr indexers (authorized sources only)\nTAB=toggle Enter=save Esc=back [P]=private'
else
header="TAB=toggle Enter=save Esc=back [P]=private"
fi
else
prompt="Prowlarr indexers (optional)> "
header="TAB=toggle Enter=confirm Esc=skip [P]=private"
@ -481,7 +525,9 @@ configure_indexers() {
"indexer" \
"$preselect_names" \
1 || true
ui_picker_done "indexers"
if ! ui_is_edit || ! ui_picker_cancelled; then
ui_picker_done "indexers"
fi
else
if ui_is_edit; then
log_info "Prowlarr is not responding — cannot edit indexers."
@ -523,14 +569,19 @@ configure_subtitle_providers() {
log_info "Skipping Bazarr provider picker (non-interactive)."
return 0
fi
ui_intro \
"Optional: pick Bazarr subtitle providers now, or skip and use the Bazarr UI later." \
"Choose which Bazarr subtitle providers to enable. Esc keeps the current set."
ui_note \
"Catalog comes from the running Bazarr image. OpenSubtitles.com is enabled automatically only if you saved credentials." \
"Catalog comes from the running Bazarr image."
local interactive_edit=0
if ui_is_edit && _fzf_is_interactive; then
interactive_edit=1
else
ui_intro \
"Optional: pick Bazarr subtitle providers now, or skip and use the Bazarr UI later." \
"Choose which Bazarr subtitle providers to enable. Esc keeps the current set."
ui_note \
"Catalog comes from the running Bazarr image. OpenSubtitles.com is enabled automatically only if you saved credentials." \
"Catalog comes from the running Bazarr image."
fi
local names formatted
local names formatted preselect_names=""
if ! names=$(_list_bazarr_providers_from_container); then
if ui_is_edit; then
log_info "Bazarr is not running — cannot edit providers."
@ -545,23 +596,35 @@ configure_subtitle_providers() {
return 0
fi
formatted=$(echo "$names" | awk '{print $1 "\t"}')
local prompt header preselect_names=""
if ui_is_edit && type _bazarr_config_file >/dev/null 2>&1 && type _bazarr_extract_apikey >/dev/null 2>&1; then
local bcfg bkey=""
bcfg=$(_bazarr_config_file 2>/dev/null || true)
[ -n "$bcfg" ] && bkey=$(_bazarr_extract_apikey "$bcfg")
if [ -n "$bkey" ]; then
preselect_names=$(curl -s --connect-timeout 5 \
-H "X-API-KEY: ${bkey}" \
"http://${host}:${BAZARR_PORT:-6767}/api/system/settings" \
2>/dev/null | jq -r '.general.enabled_providers[]? // empty' 2>/dev/null || true)
fi
fi
formatted=$(awk -v active="$preselect_names" '
BEGIN {
n = split(active, a, /\n/)
for (k = 1; k <= n; k++) if (a[k] != "") act[a[k]] = 1
}
{
if ($1 in act) printf "%s\t\033[32m[active]\033[0m\n", $1
else printf "%s\t\n", $1
}' <<< "$names")
local prompt header
if ui_is_edit; then
prompt="Bazarr providers> "
header="TAB=toggle Enter=save Esc=cancel"
if type _bazarr_config_file >/dev/null 2>&1 && type _bazarr_extract_apikey >/dev/null 2>&1; then
local bcfg bkey
bcfg=$(_bazarr_config_file 2>/dev/null || true)
if [ -n "$bcfg" ]; then
bkey=$(_bazarr_extract_apikey "$bcfg")
fi
if [ -n "${bkey:-}" ]; then
preselect_names=$(curl -s --connect-timeout 5 \
-H "X-API-KEY: ${bkey}" \
"http://${host}:${BAZARR_PORT:-6767}/api/system/settings" \
2>/dev/null | jq -r '.general.enabled_providers[]? // empty' 2>/dev/null || true)
fi
if [ "$interactive_edit" -eq 1 ]; then
header=$'Choose Bazarr subtitle providers to enable\nTAB=toggle Enter=save Esc=back'
else
header="TAB=toggle Enter=save Esc=back"
fi
else
prompt="Bazarr providers (optional)> "
@ -573,5 +636,7 @@ configure_subtitle_providers() {
SELECTED_SUBTITLE_PROVIDERS \
"provider" \
"$preselect_names" || true
ui_picker_done "providers"
if ! ui_is_edit || ! ui_picker_cancelled; then
ui_picker_done "providers"
fi
}

View file

@ -42,6 +42,7 @@ compose/base.yaml|compose/base.yaml
compose/direct-access.yaml|compose/direct-access.yaml
compose/vpn.yaml|compose/vpn.yaml
compose/vuetorrent.yaml|compose/vuetorrent.yaml
compose/qui.yaml|compose/qui.yaml
compose/gpu-intel.yaml|compose/gpu-intel.yaml
compose/gpu-nvidia.yaml|compose/gpu-nvidia.yaml
compose/byparr.yaml|compose/byparr.yaml

View file

@ -510,3 +510,21 @@ probe_writable_path() {
fi
return 0
}
# Single source of truth for qBittorrent WebUI selection: vuetorrent | qui | stock.
# Falls back to legacy VUETORRENT_ENABLED when QBIT_UI is unset.
qbit_ui_mode() {
local raw="${QBIT_UI:-}"
case "${raw,,}" in
qui) echo "qui" ;;
vuetorrent|vue) echo "vuetorrent" ;;
stock|none|default) echo "stock" ;;
"")
case "${VUETORRENT_ENABLED:-n}" in
y|Y|yes|YES) echo "vuetorrent" ;;
*) echo "stock" ;;
esac
;;
*) echo "stock" ;;
esac
}

View file

@ -24,43 +24,106 @@ configure_media_service() {
}
configure_quality_profile() {
ui_intro \
"What default quality should movies and TV use (Radarr, Sonarr, and Seerr)?" \
"Change the default quality on Radarr, Sonarr, and Seerr."
echo " 1) 4K (Ultra-HD — TV: assemblrr 4K WEB)"
echo " 2) 1080p (TV: assemblrr 1080p WEB)"
echo " 3) Any (stock *arr profile — no quality preference)"
local quality_choice source_choice
while true; do
read_prompt "Choose your default quality profile [1]: " quality_choice
quality_choice=${quality_choice:-1}
case "$quality_choice" in
1) QUALITY_TIER="uhd"; break ;;
2) QUALITY_TIER="hd"; break ;;
3) QUALITY_TIER="any"; break ;;
*) log_warning "Invalid choice. Please choose 1, 2, or 3." ;;
esac
done
QUALITY_SOURCE="bluray"
if [ "$QUALITY_TIER" != "any" ]; then
echo
echo " Movies: WEB only, or allow Blu-ray upgrades?"
echo " (TV stays WEB. TRaSH has no English Blu-ray TV default.)"
echo " 1) WEB only (smaller files; no Blu-ray upgrades)"
echo " 2) Bluray + WEB (upgrades WEB to a Blu-ray encode when one exists)"
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
local cur_tier="${QUALITY_TIER:-uhd}" cur_source="${QUALITY_SOURCE:-bluray}"
while true; do
read_prompt "Choose movie source [2]: " source_choice
source_choice=${source_choice:-2}
case "$source_choice" in
1) QUALITY_SOURCE="web"; break ;;
2) QUALITY_SOURCE="bluray"; break ;;
*) log_warning "Invalid choice. Please choose 1 or 2." ;;
local bu="" bh="" ba="" t_rows tier=""
case "${cur_tier,,}" in
uhd) bu="[active]" ;;
hd) bh="[active]" ;;
any) ba="[active]" ;;
esac
t_rows=$(printf '%s\t%s %s %s\n' \
"uhd" "$(_tui_pad_ansi "4K" 6)" "$(_tui_pad_ansi "$bu" 8 32)" "Ultra-HD — movies: 4K, TV: assemblrr 4K WEB" \
"hd" "$(_tui_pad_ansi "1080p" 6)" "$(_tui_pad_ansi "$bh" 8 32)" "Full-HD — movies: 1080p, TV: assemblrr 1080p WEB" \
"any" "$(_tui_pad_ansi "Any" 6)" "$(_tui_pad_ansi "$ba" 8 32)" "Stock *arr profile — no quality preference")
tier=$(_tui_edit_select "Quality tier> " "Default quality for Radarr, Sonarr, and Seerr" "$cur_tier" "$t_rows") || return "${PROMPT_CANCEL_RC:-2}"
QUALITY_TIER="$tier"
QUALITY_SOURCE="bluray"
if [ "$QUALITY_TIER" != "any" ]; then
local bw="" bb="" s_rows src=""
if [ "$QUALITY_TIER" = "$cur_tier" ]; then
[ "$cur_source" = "web" ] && bw="[active]" || bb="[active]"
fi
s_rows=$(printf '%s\t%s %s %s\n' \
"bluray" "$(_tui_pad_ansi "Bluray + WEB" 13)" "$(_tui_pad_ansi "$bb" 8 32)" "Upgrades WEB to a Blu-ray encode when one exists (TV stays WEB)" \
"web" "$(_tui_pad_ansi "WEB only" 13)" "$(_tui_pad_ansi "$bw" 8 32)" "Smaller files; no Blu-ray upgrades")
src=$(_tui_edit_select "Movie source> " "Movies: WEB only, or allow Blu-ray upgrades?" "$cur_source" "$s_rows") || continue
QUALITY_SOURCE="$src"
fi
break
done
seerr_is_4k="false"
[ "$QUALITY_TIER" = "uhd" ] && seerr_is_4k="true"
export QUALITY_TIER QUALITY_SOURCE seerr_is_4k
case "$QUALITY_TIER" in
uhd)
if [ "$QUALITY_SOURCE" = "web" ]; then
log_success "Quality: 4K WEB for movies and TV"
else
log_success "Quality: 4K (movies: 4K Bluray + WEB, TV: 4K WEB)"
fi
;;
hd)
if [ "$QUALITY_SOURCE" = "web" ]; then
log_success "Quality: 1080p WEB for movies and TV"
else
log_success "Quality: 1080p (movies: 1080p Bluray + WEB, TV: 1080p WEB)"
fi
;;
*)
log_success "Quality: Any"
;;
esac
return 0
fi
local quality_choice source_choice went_back
while true; do
ui_intro \
"What default quality should movies and TV use (Radarr, Sonarr, and Seerr)?" \
"Change the default quality on Radarr, Sonarr, and Seerr. (Esc=back)"
echo " 1) 4K (Ultra-HD — TV: assemblrr 4K WEB)"
echo " 2) 1080p (TV: assemblrr 1080p WEB)"
echo " 3) Any (stock *arr profile — no quality preference)"
while true; do
read_prompt "Choose your default quality profile [1]: " quality_choice || return "${PROMPT_CANCEL_RC:-2}"
quality_choice=${quality_choice:-1}
case "$quality_choice" in
1) QUALITY_TIER="uhd"; break ;;
2) QUALITY_TIER="hd"; break ;;
3) QUALITY_TIER="any"; break ;;
*) log_warning "Invalid choice. Please choose 1, 2, or 3." ;;
esac
done
fi
QUALITY_SOURCE="bluray"
if [ "$QUALITY_TIER" != "any" ]; then
echo
echo " Movies: WEB only, or allow Blu-ray upgrades?"
echo " (TV stays WEB. TRaSH has no English Blu-ray TV default.)"
echo " 1) WEB only (smaller files; no Blu-ray upgrades)"
echo " 2) Bluray + WEB (upgrades WEB to a Blu-ray encode when one exists)"
went_back=0
while true; do
if ! read_prompt "Choose movie source [2]: " source_choice; then
went_back=1
break
fi
source_choice=${source_choice:-2}
case "$source_choice" in
1) QUALITY_SOURCE="web"; break ;;
2) QUALITY_SOURCE="bluray"; break ;;
*) log_warning "Invalid choice. Please choose 1 or 2." ;;
esac
done
[ "$went_back" -eq 1 ] && continue
fi
break
done
seerr_is_4k="false"
[ "$QUALITY_TIER" = "uhd" ] && seerr_is_4k="true"
@ -97,9 +160,14 @@ configure_subtitle_language() {
SELECTED_SUBTITLE_LANGUAGES=()
FZF_SELECT_STATUS="cancelled"
ui_intro \
"Select subtitle languages to download. If you pick more than one, a second menu asks which Jellyfin should prefer." \
"Change subtitle languages. If you pick more than one, a second menu asks which Jellyfin should prefer."
local interactive_edit=0
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
interactive_edit=1
else
ui_intro \
"Select subtitle languages to download. If you pick more than one, a second menu asks which Jellyfin should prefer." \
"Change subtitle languages. If you pick more than one, a second menu asks which Jellyfin should prefer."
fi
if [ "${ASSEMBLRR_NONINTERACTIVE:-0}" = "1" ]; then
log_info "Skipping subtitle language picker (non-interactive)."
@ -113,65 +181,104 @@ configure_subtitle_language() {
data=$(iso639_bundled_menu)
fi
local prompt header preselect_names=""
local prompt header preselect_names="" preferred=""
preselect_names=$(_subtitle_stored_lang_codes)
if ui_is_edit && [ -n "$preselect_names" ]; then
local pref_now="${SUBTITLE_LANGUAGE:-}"
pref_now="${pref_now%%,*}"
pref_now=${pref_now// /}
[ -z "$pref_now" ] && pref_now=$(printf '%s\n' "$preselect_names" | head -1)
data=$(awk -F'\t' -v active="$preselect_names" -v pref="$pref_now" '
BEGIN {
n = split(active, a, /\n/)
for (k = 1; k <= n; k++) if (a[k] != "") act[a[k]] = 1
}
{
if ($1 == pref && ($1 in act)) printf "%s\t%s \033[32m[preferred]\033[0m\n", $1, $2
else if ($1 in act) printf "%s\t%s \033[32m[active]\033[0m\n", $1, $2
else print $0
}' <<< "$data")
fi
if ui_is_edit; then
prompt="Subtitle languages> "
header="TAB=toggle Enter=save Esc=cancel"
if [ "$interactive_edit" -eq 1 ]; then
header=$'Select subtitle languages (second step asks preferred if multiple)\nTAB=toggle Enter=save Esc=back'
else
header="TAB=toggle Enter=save Esc=back"
fi
else
prompt="Subtitle languages> "
header="TAB=toggle Enter=confirm Esc=skip"
fi
fzf_multi_select "$data" \
"$prompt" \
"$header" \
SELECTED_SUBTITLE_LANGUAGES \
"language" \
"$preselect_names" || true
ui_picker_done "languages"
if ui_picker_cancelled; then
return 0
fi
if [ "${#SELECTED_SUBTITLE_LANGUAGES[@]}" -eq 0 ]; then
subtitle_language=""
subtitle_languages=""
log_success "Subtitle language: none (Bazarr defaults to English)"
export subtitle_language subtitle_languages
return 0
fi
while true; do
SELECTED_SUBTITLE_LANGUAGES=()
FZF_SELECT_STATUS="cancelled"
fzf_multi_select "$data" \
"$prompt" \
"$header" \
SELECTED_SUBTITLE_LANGUAGES \
"language" \
"$preselect_names" || true
if ui_picker_cancelled; then
[ "$interactive_edit" -eq 1 ] || ui_picker_done "languages"
ui_is_edit && return "${PROMPT_CANCEL_RC:-2}"
return 0
fi
local preferred="${SELECTED_SUBTITLE_LANGUAGES[0]}"
if [ "${#SELECTED_SUBTITLE_LANGUAGES[@]}" -gt 1 ]; then
local current_pref="${SUBTITLE_LANGUAGE:-}"
current_pref="${current_pref%%,*}"
current_pref=${current_pref// /}
local in_set=0 code
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
[ "$code" = "$current_pref" ] && in_set=1 && break
done
[ "$in_set" -eq 0 ] && current_pref="$preferred"
if [ "${#SELECTED_SUBTITLE_LANGUAGES[@]}" -eq 0 ]; then
ui_picker_done "languages"
subtitle_language=""
subtitle_languages=""
log_success "Subtitle language: none (Bazarr defaults to English)"
export subtitle_language subtitle_languages
return 0
fi
local selected_data="" row
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
row=$(printf '%s\n' "$data" | awk -F'\t' -v c="$code" '$1 == c { print; exit }')
[ -n "$row" ] && selected_data+="$row"$'\n'
done
ui_intro \
"Which of those should Jellyfin prefer for playback?" \
"Which of those should Jellyfin prefer for playback?"
preferred=$(fzf_single_select_data \
"$selected_data" \
"Preferred language> " \
"↑↓=navigate Enter=confirm Esc=keep current preferred" \
"$current_pref")
[ -z "$preferred" ] && preferred="$current_pref"
in_set=0
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
[ "$code" = "$preferred" ] && in_set=1 && break
done
[ "$in_set" -eq 0 ] && preferred="${SELECTED_SUBTITLE_LANGUAGES[0]}"
fi
preferred="${SELECTED_SUBTITLE_LANGUAGES[0]}"
if [ "${#SELECTED_SUBTITLE_LANGUAGES[@]}" -gt 1 ]; then
local current_pref="${SUBTITLE_LANGUAGE:-}"
current_pref="${current_pref%%,*}"
current_pref=${current_pref// /}
local in_set=0 code
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
[ "$code" = "$current_pref" ] && in_set=1 && break
done
[ "$in_set" -eq 0 ] && current_pref="$preferred"
local selected_data="" row pref_rc=0 pref_pick="" pref_hdr
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
row=$(printf '%s\n' "$data" | awk -F'\t' -v c="$code" '$1 == c { print; exit }')
[ -n "$row" ] && selected_data+="$row"$'\n'
done
if [ "$interactive_edit" -eq 1 ]; then
pref_hdr=$'Which language should Jellyfin prefer for playback?\n↑↓=navigate Enter=confirm Esc=back'
else
ui_intro \
"Which of those should Jellyfin prefer for playback?" \
"Which of those should Jellyfin prefer for playback? (Esc=back)"
pref_hdr="↑↓=navigate Enter=confirm Esc=back"
fi
pref_pick=$(fzf_single_select_data \
"$selected_data" \
"Preferred language> " \
"$pref_hdr" \
"$current_pref") || pref_rc=$?
if [ "$pref_rc" -ne 0 ]; then
preselect_names=$(printf '%s\n' "${SELECTED_SUBTITLE_LANGUAGES[@]}")
continue
fi
preferred="$pref_pick"
[ -z "$preferred" ] && preferred="$current_pref"
in_set=0
for code in "${SELECTED_SUBTITLE_LANGUAGES[@]}"; do
[ "$code" = "$preferred" ] && in_set=1 && break
done
[ "$in_set" -eq 0 ] && preferred="${SELECTED_SUBTITLE_LANGUAGES[0]}"
fi
break
done
subtitle_language="$preferred"
subtitle_languages=$(_subtitle_join_preferred_first "$preferred" "${SELECTED_SUBTITLE_LANGUAGES[@]}")
@ -190,7 +297,7 @@ _opensubtitles_collect() {
opensubtitles_password=""
while [ -z "$opensubtitles_username" ]; do
read_prompt "OpenSubtitles.com username (profile name, not email; blank to cancel): " opensubtitles_username
read_prompt "OpenSubtitles.com username (profile name, not email; blank to cancel): " opensubtitles_username || return "${PROMPT_CANCEL_RC:-2}"
if [ -z "$opensubtitles_username" ]; then
if [ "$cancel_on_empty" = "1" ]; then
return 1
@ -204,7 +311,7 @@ _opensubtitles_collect() {
done
while [ -z "$opensubtitles_password" ]; do
read_masked "OpenSubtitles.com password: " opensubtitles_password
read_masked "OpenSubtitles.com password: " opensubtitles_password || return "${PROMPT_CANCEL_RC:-2}"
if [ -z "$opensubtitles_password" ]; then
log_warning "Password cannot be empty."
fi
@ -220,7 +327,16 @@ configure_opensubtitles() {
if ui_is_edit; then
echo
if _opensubtitles_collect 1; then
local cur_os="" os_file="${INSTALL_DIR:-}/secrets/opensubtitles_username.txt"
[ -n "${INSTALL_DIR:-}" ] && [ -s "$os_file" ] && cur_os=$(cat "$os_file" 2>/dev/null || true)
if [ -n "$cur_os" ]; then
log_info "OpenSubtitles.com: configured (${cur_os}). (Esc=back)"
else
log_info "OpenSubtitles.com: not configured. (Esc=back)"
fi
local collect_rc=0
_opensubtitles_collect 1 || collect_rc=$?
if [ "$collect_rc" -eq 0 ]; then
opensubtitles_enabled="y"
else
opensubtitles_enabled="n"
@ -228,6 +344,7 @@ configure_opensubtitles() {
opensubtitles_password=""
fi
export opensubtitles_enabled opensubtitles_username opensubtitles_password
[ "$collect_rc" -eq "${PROMPT_CANCEL_RC:-2}" ] && return "${PROMPT_CANCEL_RC:-2}"
return 0
fi
@ -259,21 +376,86 @@ configure_opensubtitles() {
export opensubtitles_enabled opensubtitles_username opensubtitles_password
}
configure_vuetorrent() {
vuetorrent_enabled="y"
configure_qbit_ui() {
local current
if [ -n "${QBIT_UI:-}" ] || [ -n "${VUETORRENT_ENABLED:-}" ]; then
current=$(qbit_ui_mode)
else
current="vuetorrent"
fi
FZF_SELECT_STATUS="cancelled"
if [ "${SETUP_MODE:-}" = "express" ]; then
export vuetorrent_enabled
qbit_ui="vuetorrent"
vuetorrent_enabled="y"
FZF_SELECT_STATUS="confirmed"
export qbit_ui vuetorrent_enabled
return 0
fi
ui_intro \
"Optional: VueTorrent gives qBittorrent a modern responsive WebUI theme." \
"Enable or disable VueTorrent theme on qBittorrent (restarts stack)."
local ans="y"
read_prompt "Enable VueTorrent WebUI theme for qBittorrent? (Y/n) [Default = y]: " ans
ans=${ans:-y}
[ "${ans,,}" = "n" ] && vuetorrent_enabled="n" || vuetorrent_enabled="y"
log_success "VueTorrent: $vuetorrent_enabled"
export vuetorrent_enabled
local interactive_edit=0
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
interactive_edit=1
else
ui_intro \
"Optional: pick qBittorrent's WebUI theme or standalone frontend." \
"Choose qBittorrent WebUI frontend (restarts stack)."
fi
local rows selected="" sel_rc=0
local b_vue="" b_qui="" b_stock=""
if ui_is_edit; then
case "$current" in
vuetorrent) b_vue="[active]" ;;
qui) b_qui="[active]" ;;
stock) b_stock="[active]" ;;
esac
fi
if type _tui_pad_ansi >/dev/null 2>&1; then
rows=$(printf '%s\t%s %s %s\n' \
"vuetorrent" "$(_tui_pad_ansi "vuetorrent" 10)" "$(_tui_pad_ansi "$b_vue" 8 32)" "Modern theme inside qBittorrent (:8081, no extra container)" \
"qui" "$(_tui_pad_ansi "qui" 10)" "$(_tui_pad_ansi "$b_qui" 8 32)" "Fast Go+React standalone UI (:7476, keeps stock qBit on :8081)" \
"stock" "$(_tui_pad_ansi "stock" 10)" "$(_tui_pad_ansi "$b_stock" 8 32)" "Built-in default qBittorrent WebUI (:8081)")
else
rows=$(printf '%s\t%s\n' \
"vuetorrent" "VueTorrent — Modern theme inside qBittorrent (:8081, no extra container)" \
"qui" "qui — Fast Go+React standalone UI (:7476, keeps stock qBit on :8081)" \
"stock" "Stock — Built-in default qBittorrent WebUI (:8081)")
fi
if [ "$interactive_edit" -eq 1 ]; then
selected=$(_tui_edit_select "qBit WebUI> " "Choose qBittorrent WebUI frontend (restarts stack if changed)" "$current" "$rows") || sel_rc=$?
elif type fzf_single_select_data >/dev/null 2>&1; then
local hdr="↑↓=navigate Enter=confirm Esc=keep ${current}"
ui_is_edit && hdr="↑↓=navigate Enter=confirm Esc=back"
selected=$(fzf_single_select_data "$rows" "qBit WebUI> " "$hdr" "$current" "2") || sel_rc=$?
else
selected="$current"
fi
if [ "$sel_rc" -ne 0 ]; then
if ui_is_edit; then
FZF_SELECT_STATUS="cancelled"
return "${PROMPT_CANCEL_RC:-2}"
fi
selected="$current"
fi
FZF_SELECT_STATUS="confirmed"
case "${selected,,}" in
qui) qbit_ui="qui" ;;
stock) qbit_ui="stock" ;;
vuetorrent) qbit_ui="vuetorrent" ;;
*) qbit_ui="$current" ;;
esac
[ "$qbit_ui" = "vuetorrent" ] && vuetorrent_enabled="y" || vuetorrent_enabled="n"
log_success "qBittorrent UI: $qbit_ui"
export qbit_ui vuetorrent_enabled
}
configure_vuetorrent() {
configure_qbit_ui "$@"
}
# Detect host GPU acceleration safely: NVIDIA only if Docker runtime exists, else /dev/dri vendor.
@ -304,39 +486,87 @@ detect_gpu_transcoding() {
}
configure_gpu_transcoding() {
gpu_transcoding=$(detect_gpu_transcoding)
local detected active_gpu=""
detected=$(detect_gpu_transcoding)
gpu_transcoding="$detected"
if [ "${SETUP_MODE:-}" = "express" ]; then
export gpu_transcoding
return 0
fi
if ui_is_edit; then
case "${GPU_TRANSCODING:-}" in
none|amd|intel|nvidia) active_gpu="$GPU_TRANSCODING"; gpu_transcoding="$GPU_TRANSCODING" ;;
vaapi) active_gpu="amd"; gpu_transcoding="amd" ;;
*) active_gpu="none" ;;
esac
fi
local has_nvidia_smi=0
command -v nvidia-smi >/dev/null 2>&1 && has_nvidia_smi=1
local hinted="1" amd_note="" intel_note="" nv_note=""
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
local a_n="" a_a="" a_i="" a_nv="" d_a="" d_i="" d_nv="" rows pick=""
case "$active_gpu" in
none) a_n="[active]" ;;
amd) a_a="[active]" ;;
intel) a_i="[active]" ;;
nvidia) a_nv="[active]" ;;
esac
case "$detected" in
amd|vaapi) d_a="[detected]" ;;
intel) d_i="[detected]" ;;
nvidia) d_nv="[detected]" ;;
esac
rows=$(printf '%s\t%s %s %s %s\n' \
"none" "$(_tui_pad_ansi "none" 8)" "$(_tui_pad_ansi "$a_n" 8 32)" "$(_tui_pad_ansi "" 10)" "CPU software transcoding" \
"amd" "$(_tui_pad_ansi "amd" 8)" "$(_tui_pad_ansi "$a_a" 8 32)" "$(_tui_pad_ansi "$d_a" 10 36)" "AMD VAAPI via /dev/dri" \
"intel" "$(_tui_pad_ansi "intel" 8)" "$(_tui_pad_ansi "$a_i" 8 32)" "$(_tui_pad_ansi "$d_i" 10 36)" "Intel QSV via /dev/dri" \
"nvidia" "$(_tui_pad_ansi "nvidia" 8)" "$(_tui_pad_ansi "$a_nv" 8 32)" "$(_tui_pad_ansi "$d_nv" 10 36)" "NVIDIA NVENC via nvidia-container-toolkit")
pick=$(_tui_edit_select "GPU transcoding> " "Jellyfin hardware GPU transcoding (restarts stack if changed)" "$active_gpu" "$rows") || return "${PROMPT_CANCEL_RC:-2}"
gpu_transcoding="$pick"
log_success "GPU transcoding: $gpu_transcoding"
export gpu_transcoding
return 0
fi
local hinted="1" none_note="" amd_note="" intel_note="" nv_note=""
case "$gpu_transcoding" in
amd) hinted="2"; amd_note=" [detected]" ;;
vaapi) hinted="2"; amd_note=" [detected]" ;;
intel) hinted="3"; intel_note=" [detected]" ;;
nvidia) hinted="4"; nv_note=" [detected]" ;;
amd) hinted="2" ;;
vaapi) hinted="2" ;;
intel) hinted="3" ;;
nvidia) hinted="4" ;;
esac
case "$detected" in
amd|vaapi) amd_note+=" [detected]" ;;
intel) intel_note+=" [detected]" ;;
nvidia) nv_note+=" [detected]" ;;
*)
if [ "$has_nvidia_smi" -eq 1 ]; then
nv_note=" [nvidia-smi found, install nvidia-container-toolkit first]"
nv_note+=" [nvidia-smi found, install nvidia-container-toolkit first]"
fi
;;
esac
if ui_is_edit; then
case "$active_gpu" in
none) none_note+=" [active]" ;;
amd) amd_note+=" [active]" ;;
intel) intel_note+=" [active]" ;;
nvidia) nv_note+=" [active]" ;;
esac
fi
ui_intro \
"Optional: hardware GPU transcoding passthrough and Jellyfin auto-configuration." \
"Select hardware GPU transcoding mode for Jellyfin (restarts stack & configures Jellyfin)."
echo " 1) None (CPU software transcoding)"
"Select hardware GPU transcoding mode for Jellyfin (Esc=back; restarts stack if changed)."
echo " 1) None (CPU software transcoding)${none_note}"
echo " 2) AMD (VAAPI via /dev/dri)${amd_note}"
echo " 3) Intel (QSV via /dev/dri)${intel_note}"
echo " 4) NVIDIA (NVENC via nvidia-container-toolkit)${nv_note}"
local choice
while true; do
read_prompt "Choose GPU transcoding mode [${hinted}]: " choice
read_prompt "Choose GPU transcoding mode [${hinted}]: " choice || return "${PROMPT_CANCEL_RC:-2}"
choice=${choice:-$hinted}
case "${choice,,}" in
1|none) gpu_transcoding="none"; break ;;
@ -356,12 +586,31 @@ configure_byparr() {
export byparr_enabled
return 0
fi
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
local cur="n" b_y="" b_n="" rows pick=""
case "${BYPARR_ENABLED:-n}" in y|Y) cur="y" ;; esac
[ "$cur" = "y" ] && b_y="[active]" || b_n="[active]"
rows=$(printf '%s\t%s %s %s\n' \
"y" "$(_tui_pad_ansi "enable" 8)" "$(_tui_pad_ansi "$b_y" 8 32)" "Run Byparr container and wire Cloudflare proxy in Prowlarr" \
"n" "$(_tui_pad_ansi "disable" 8)" "$(_tui_pad_ansi "$b_n" 8 32)" "Stop Byparr container")
pick=$(_tui_edit_select "Byparr solver> " "Byparr Cloudflare challenge solver for Prowlarr (restarts stack if changed)" "$cur" "$rows") || return "${PROMPT_CANCEL_RC:-2}"
byparr_enabled="$pick"
log_success "Byparr: $byparr_enabled"
export byparr_enabled
return 0
fi
ui_intro \
"Optional: Byparr solves Cloudflare challenges for Prowlarr indexers (FlareSolverr drop-in)." \
"Enable or disable Byparr Cloudflare solver in Prowlarr (restarts stack)."
local ans="n"
read_prompt "Enable Byparr challenge solver container? (y/N) [Default = n]: " ans
ans=${ans:-n}
"Enable or disable Byparr Cloudflare solver in Prowlarr (Esc=back; restarts stack if changed)."
local default_ans="n" yn="(y/N)"
if ui_is_edit; then
case "${BYPARR_ENABLED:-n}" in
y|Y) default_ans="y"; yn="(Y/n)" ;;
esac
fi
local ans="$default_ans"
read_prompt "Enable Byparr challenge solver container? ${yn} [Default = ${default_ans}]: " ans || return "${PROMPT_CANCEL_RC:-2}"
ans=${ans:-$default_ans}
[ "${ans,,}" = "y" ] && byparr_enabled="y" || byparr_enabled="n"
log_success "Byparr: $byparr_enabled"
export byparr_enabled
@ -369,6 +618,7 @@ configure_byparr() {
configure_usenet() {
usenet_enabled="n"
usenet_keep_nntp=0
usenet_host=""
usenet_port="563"
usenet_ssl="y"
@ -376,51 +626,191 @@ configure_usenet() {
usenet_password=""
usenet_connections="8"
if [ "${SETUP_MODE:-}" = "express" ]; then
export usenet_enabled usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
return 0
fi
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
local cur="n" cur_host="${USENET_HOST:-}"
case "${USENET_ENABLED:-n}" in y|Y) cur="keep" ;; esac
while true; do
local b_n="" b_k="" rows pick="" host_note=""
[ "$cur" = "n" ] && b_n="[active]" || b_k="[active]"
[ -n "$cur_host" ] && host_note=" (${cur_host})"
rows=$(printf '%s\t%s %s %s\n' \
"n" "$(_tui_pad_ansi "disable" 10)" "$(_tui_pad_ansi "$b_n" 8 32)" "Disable SABnzbd container" \
"keep" "$(_tui_pad_ansi "keep" 10)" "$(_tui_pad_ansi "$b_k" 8 32)" "Enabled${host_note} — keep current NNTP settings" \
"configure" "$(_tui_pad_ansi "configure" 10)" "$(_tui_pad_ansi "" 8)" "Enabled — enter/update NNTP server credentials")
pick=$(_tui_edit_select "SABnzbd / Usenet> " "SABnzbd Usenet downloader (restarts stack if changed)" "$cur" "$rows") || return "${PROMPT_CANCEL_RC:-2}"
usenet_keep_nntp=0
case "$pick" in
n)
usenet_enabled="n"
log_success "SABnzbd / Usenet: disabled"
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
return 0
;;
keep)
usenet_enabled="y"
usenet_keep_nntp=1
usenet_host="${USENET_HOST:-}"
usenet_port="${USENET_PORT:-563}"
usenet_ssl="${USENET_SSL:-y}"
usenet_username="${USENET_USERNAME:-}"
usenet_connections="${USENET_CONNECTIONS:-8}"
log_success "SABnzbd / Usenet: enabled${host_note}"
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
return 0
;;
configure)
usenet_enabled="y"
read_prompt "NNTP host (e.g. news.provider.example): " usenet_host || continue
read_prompt "NNTP port [563]: " usenet_port || continue
usenet_port=${usenet_port:-563}
read_prompt "Use SSL/TLS? (Y/n) [Default = y]: " usenet_ssl || continue
usenet_ssl=${usenet_ssl:-y}
read_prompt "NNTP username: " usenet_username || continue
read_masked "NNTP password: " usenet_password || continue
read_prompt "Max connections [8]: " usenet_connections || continue
usenet_connections=${usenet_connections:-8}
log_success "SABnzbd / Usenet: enabled (${usenet_host:-NNTP})"
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
return 0
;;
esac
done
fi
ui_intro \
"Optional: SABnzbd Usenet downloader (wired automatically into Sonarr/Radarr/Prowlarr)." \
"Enable or configure SABnzbd Usenet downloader and NNTP provider (restarts stack)."
"Enable or configure SABnzbd Usenet downloader and NNTP provider (Esc=back; restarts stack if changed)."
log_info "Note: real Usenet downloads require your own NNTP provider account (no subscription is bundled)."
local ans="n"
read_prompt "Enable SABnzbd Usenet downloader? (y/N) [Default = n]: " ans
ans=${ans:-n}
local default_ans="n" yn="(y/N)"
if ui_is_edit; then
case "${USENET_ENABLED:-n}" in
y|Y) default_ans="y"; yn="(Y/n)" ;;
esac
fi
local ans="$default_ans"
read_prompt "Enable SABnzbd Usenet downloader? ${yn} [Default = ${default_ans}]: " ans || return "${PROMPT_CANCEL_RC:-2}"
ans=${ans:-$default_ans}
if [ "${ans,,}" != "y" ]; then
usenet_enabled="n"
log_success "SABnzbd / Usenet: disabled"
export usenet_enabled usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
return 0
fi
usenet_enabled="y"
local add_nntp="n"
read_prompt "Configure an NNTP server now? (y/N, or 'n' to add in SABnzbd UI later): " add_nntp
read_prompt "Configure an NNTP server now? (y/N, or 'n' to add in SABnzbd UI later): " add_nntp || return "${PROMPT_CANCEL_RC:-2}"
add_nntp=${add_nntp:-n}
if [ "${add_nntp,,}" = "y" ]; then
read_prompt "NNTP host (e.g. news.provider.example): " usenet_host
read_prompt "NNTP port [563]: " usenet_port
read_prompt "NNTP host (e.g. news.provider.example): " usenet_host || return "${PROMPT_CANCEL_RC:-2}"
read_prompt "NNTP port [563]: " usenet_port || return "${PROMPT_CANCEL_RC:-2}"
usenet_port=${usenet_port:-563}
read_prompt "Use SSL/TLS? (Y/n) [Default = y]: " usenet_ssl
read_prompt "Use SSL/TLS? (Y/n) [Default = y]: " usenet_ssl || return "${PROMPT_CANCEL_RC:-2}"
usenet_ssl=${usenet_ssl:-y}
read_prompt "NNTP username: " usenet_username
read_masked "NNTP password: " usenet_password
read_prompt "Max connections [8]: " usenet_connections
read_prompt "NNTP username: " usenet_username || return "${PROMPT_CANCEL_RC:-2}"
read_masked "NNTP password: " usenet_password || return "${PROMPT_CANCEL_RC:-2}"
read_prompt "Max connections [8]: " usenet_connections || return "${PROMPT_CANCEL_RC:-2}"
usenet_connections=${usenet_connections:-8}
fi
log_success "SABnzbd / Usenet: enabled"
export usenet_enabled usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
export usenet_enabled usenet_keep_nntp usenet_host usenet_port usenet_ssl usenet_username usenet_password usenet_connections
}
configure_vpn() {
if ui_is_edit && type _fzf_is_interactive >/dev/null 2>&1 && _fzf_is_interactive; then
local cur_vpn="n" cur_svc="${VPN_SERVICE:-}" cur_type="${VPN_TYPE:-wireguard}" cur_pf="n"
case "${VPN_ENABLED:-n}" in y|Y) cur_vpn="y" ;; esac
case "${VPN_PORT_FORWARDING:-${PORT_FORWARD_ONLY:-off}}" in on|y|Y|true) cur_pf="y" ;; esac
local -a vpn_providers=(
"protonvpn"
"surfshark"
"mullvad"
"nordvpn"
"expressvpn"
"private internet access"
"windscribe"
"ivpn"
"custom"
)
while true; do
local b_on="" b_off="" cur_note="" rows
if [ "$cur_vpn" = "y" ]; then
b_on="[active]"
[ -n "$cur_svc" ] && cur_note=" (${cur_svc} · ${cur_type})"
else
b_off="[active]"
fi
rows=$(printf '%s\t%s %s %s\n' \
"y" "$(_tui_pad_ansi "enable" 8)" "$(_tui_pad_ansi "$b_on" 8 32)" "Configure / update Gluetun VPN${cur_note}" \
"n" "$(_tui_pad_ansi "disable" 8)" "$(_tui_pad_ansi "$b_off" 8 32)" "Direct access without VPN")
setup_vpn=$(_tui_edit_select "VPN> " "Gluetun VPN (restarts stack if changed)" "$cur_vpn" "$rows") || return "${PROMPT_CANCEL_RC:-2}"
if [ "$setup_vpn" = "n" ]; then
export setup_vpn="n" vpn_service="" vpn_type="openvpn" wireguard_addresses="" enable_port_forwarding="n"
log_success "VPN: disabled"
return 0
fi
# Step 2: Provider -> Step 3: Type -> Step 4: Credentials -> Step 5: Port Forwarding
while true; do
local p_rows="" p bp matched_preset=0
for p in "${vpn_providers[@]}"; do
bp=""
if [ "$cur_vpn" = "y" ] && [ "${cur_svc,,}" = "$p" ]; then
bp="[active]"
matched_preset=1
fi
if [ "$p" = "custom" ] && [ "$cur_vpn" = "y" ] && [ -n "$cur_svc" ] && [ "$matched_preset" -eq 0 ]; then
bp="[active]"
fi
p_rows+=$(printf '%s\t%s %s\n' "$p" "$(_tui_pad_ansi "$p" 24)" "$(_tui_pad_ansi "$bp" 8 32)")$'\n'
done
vpn_service=$(_tui_edit_select "VPN provider> " "Select VPN provider (supported by Gluetun)" "${cur_svc:-protonvpn}" "$p_rows") || break
while true; do
local bw="" bo="" t_rows
if [ "$cur_vpn" = "y" ]; then
[ "${cur_type,,}" = "wireguard" ] && bw="[active]" || bo="[active]"
fi
t_rows=$(printf '%s\t%s %s %s\n' \
"wireguard" "$(_tui_pad_ansi "WireGuard" 10)" "$(_tui_pad_ansi "$bw" 8 32)" "Recommended — faster, lower overhead" \
"openvpn" "$(_tui_pad_ansi "OpenVPN" 10)" "$(_tui_pad_ansi "$bo" 8 32)" "Username + password tunnel")
vpn_type=$(_tui_edit_select "VPN type> " "Provider: ${vpn_service}" "${cur_type:-wireguard}" "$t_rows") || break
echo
log_info "Provider docs: https://github.com/qdm12/gluetun-wiki/blob/main/setup/providers/${vpn_service// /-}.md"
prompt_vpn_credentials || continue
local bpf_n="" bpf_y="" pf_rows
if [ "$cur_vpn" = "y" ]; then
[ "$cur_pf" = "y" ] && bpf_y="[active]" || bpf_n="[active]"
fi
pf_rows=$(printf '%s\t%s %s %s\n' \
"n" "$(_tui_pad_ansi "off" 5)" "$(_tui_pad_ansi "$bpf_n" 8 32)" "Standard VPN without forwarded port" \
"y" "$(_tui_pad_ansi "on" 5)" "$(_tui_pad_ansi "$bpf_y" 8 32)" "Only if your provider supports Gluetun port forwarding")
enable_port_forwarding=$(_tui_edit_select "Port forwarding> " "Gluetun port forwarding" "$cur_pf" "$pf_rows") || continue
export setup_vpn vpn_service vpn_type enable_port_forwarding
export vpn_user vpn_password wireguard_private_key wireguard_addresses
return 0
done
done
done
fi
ui_intro \
"Time to set up the VPN." \
"Change VPN settings. This restarts the stack and can interrupt downloads."
"Change VPN settings (Esc=back). This restarts the stack and can interrupt downloads."
log_info "Supported VPN providers: https://github.com/qdm12/gluetun-wiki"
while true; do
read_prompt "Configure VPN? (Y/n) [Default = y]: " setup_vpn
read_prompt "Configure VPN? (Y/n) [Default = y]: " setup_vpn || return "${PROMPT_CANCEL_RC:-2}"
setup_vpn=${setup_vpn:-"y"}
case "${setup_vpn,,}" in
y|yes) setup_vpn="y"; break ;;
@ -460,7 +850,7 @@ configure_vpn() {
local vpn_choice vpn_type_choice
while true; do
read_prompt "Choose your VPN provider [1]: " vpn_choice
read_prompt "Choose your VPN provider [1]: " vpn_choice || return "${PROMPT_CANCEL_RC:-2}"
vpn_choice=${vpn_choice:-1}
if [[ "$vpn_choice" =~ ^[0-9]+$ ]]; then
if [ "$vpn_choice" -ge 1 ] && [ "$vpn_choice" -le ${#vpn_providers[@]} ]; then
@ -478,7 +868,7 @@ configure_vpn() {
echo " 1) WireGuard (recommended)"
echo " 2) OpenVPN"
while true; do
read_prompt "Choose VPN type [1]: " vpn_type_choice
read_prompt "Choose VPN type [1]: " vpn_type_choice || return "${PROMPT_CANCEL_RC:-2}"
vpn_type_choice=${vpn_type_choice:-1}
case "$vpn_type_choice" in
1|wireguard) vpn_type="wireguard"; break ;;
@ -491,10 +881,10 @@ configure_vpn() {
log_info "Provider docs: https://github.com/qdm12/gluetun-wiki/blob/main/setup/providers/${vpn_service// /-}.md"
echo
prompt_vpn_credentials
prompt_vpn_credentials || return $?
log_info "Port forwarding only helps if your provider supports it (and Gluetun can use it)."
read_prompt "Enable port forwarding? (y/N) [Default = n]: " enable_port_forwarding
read_prompt "Enable port forwarding? (y/N) [Default = n]: " enable_port_forwarding || return "${PROMPT_CANCEL_RC:-2}"
enable_port_forwarding=${enable_port_forwarding:-"n"}
case "${enable_port_forwarding,,}" in
y|yes) enable_port_forwarding="y" ;;
@ -509,12 +899,12 @@ prompt_vpn_credentials() {
if [ "${vpn_type:-}" = "wireguard" ]; then
wireguard_private_key=""
while [ -z "$wireguard_private_key" ]; do
read_masked "WireGuard private key: " wireguard_private_key
read_masked "WireGuard private key: " wireguard_private_key || return "${PROMPT_CANCEL_RC:-2}"
[ -z "$wireguard_private_key" ] && log_warning "Private key cannot be empty. Try again."
done
wireguard_addresses=""
while [ -z "$wireguard_addresses" ]; do
read_prompt "WireGuard interface addresses (e.g., 10.64.0.1/32): " wireguard_addresses
read_prompt "WireGuard interface addresses (e.g., 10.64.0.1/32): " wireguard_addresses || return "${PROMPT_CANCEL_RC:-2}"
[ -z "$wireguard_addresses" ] && log_warning "Addresses cannot be empty. Try again."
done
vpn_user=""
@ -522,18 +912,18 @@ prompt_vpn_credentials() {
else
vpn_user=""
while [ -z "$vpn_user" ]; do
read_prompt "VPN username (without spaces): " vpn_user
read_prompt "VPN username (without spaces): " vpn_user || return "${PROMPT_CANCEL_RC:-2}"
[ -z "$vpn_user" ] && log_warning "Username cannot be empty. Try again."
done
vpn_password=""
while [ -z "$vpn_password" ]; do
read_masked "VPN password: " vpn_password
read_masked "VPN password: " vpn_password || return "${PROMPT_CANCEL_RC:-2}"
if [ -z "$vpn_password" ]; then
log_warning "Password cannot be empty. Try again."
continue
fi
local vpn_password_confirm=""
read_masked "Confirm VPN password: " vpn_password_confirm
read_masked "Confirm VPN password: " vpn_password_confirm || return "${PROMPT_CANCEL_RC:-2}"
if [ "$vpn_password" != "$vpn_password_confirm" ]; then
log_warning "Passwords do not match. Try again."
vpn_password=""
@ -549,28 +939,43 @@ prompt_vpn_credentials() {
configure_auth() {
ui_intro \
"Set one username and password for every service web UI." \
"Change the shared login on every service UI."
"Change the shared login on every service UI. (Esc=back)"
ui_note \
"Same login on Radarr, Sonarr, Prowlarr, qBittorrent, Jellyfin, Bazarr, and SABnzbd (when enabled). Seerr signs in via Jellyfin." \
"Updates Radarr, Sonarr, Prowlarr, qBittorrent, Jellyfin, Bazarr, and SABnzbd (when enabled). Seerr signs in via Jellyfin."
"Same login on Radarr, Sonarr, Prowlarr, qBittorrent, qui, Jellyfin, Bazarr, and SABnzbd (when enabled). Seerr signs in via Jellyfin." \
"Updates Radarr, Sonarr, Prowlarr, qBittorrent, qui, Jellyfin, Bazarr, and SABnzbd (when enabled). Seerr signs in via Jellyfin."
local cur_user="${USER}"
if ui_is_edit && [ -n "${AUTH_USERNAME:-}" ]; then
cur_user="$AUTH_USERNAME"
log_info "Current login: ${cur_user}"
fi
local min_len=0
if [ "${qbit_ui:-}" = "qui" ] || { [ -z "${qbit_ui:-}" ] && type qbit_ui_mode >/dev/null 2>&1 && [ "$(qbit_ui_mode)" = "qui" ]; }; then
min_len=8
log_info "qui requires a password of at least ${min_len} characters."
fi
echo
auth_username=""
while [ -z "$auth_username" ]; do
read_prompt "Username for service login? [$USER]: " auth_username
auth_username=${auth_username:-$USER}
read_prompt "Username for service login? [${cur_user}]: " auth_username || return "${PROMPT_CANCEL_RC:-2}"
auth_username=${auth_username:-$cur_user}
[ -z "$auth_username" ] && log_warning "Username cannot be empty. Try again."
done
auth_password=""
while [ -z "$auth_password" ]; do
read_masked "Password for service login: " auth_password
read_masked "Password for service login: " auth_password || return "${PROMPT_CANCEL_RC:-2}"
if [ -z "$auth_password" ]; then
log_warning "Password cannot be empty. Try again."
continue
fi
if [ "$min_len" -gt 0 ] && [ "${#auth_password}" -lt "$min_len" ]; then
log_warning "qui requires a password of at least ${min_len} characters. Try again."
auth_password=""
continue
fi
local auth_password_confirm=""
read_masked "Confirm password: " auth_password_confirm
read_masked "Confirm password: " auth_password_confirm || return "${PROMPT_CANCEL_RC:-2}"
if [ "$auth_password" != "$auth_password_confirm" ]; then
log_warning "Passwords do not match. Try again."
auth_password=""
@ -592,13 +997,20 @@ configure_timezone() {
return 0
fi
local default_tz="$detected_tz"
if ui_is_edit; then
default_tz="${TZ:-$detected_tz}"
echo
log_info "Current timezone: ${default_tz} (Esc=back; restarts stack if changed)"
fi
while true; do
read_prompt "Timezone? [$detected_tz]: " tz
tz=${tz:-$detected_tz}
read_prompt "Timezone? [${default_tz}]: " tz || return "${PROMPT_CANCEL_RC:-2}"
tz=${tz:-$default_tz}
if [ -d /usr/share/zoneinfo ] && [ ! -f "/usr/share/zoneinfo/${tz}" ]; then
log_warning "Timezone '$tz' not found under /usr/share/zoneinfo (example: Europe/Athens, America/New_York, UTC)."
local keep="n"
read_prompt "Keep '$tz' anyway? (y/N) [Default = n]: " keep
read_prompt "Keep '$tz' anyway? (y/N) [Default = n]: " keep || return "${PROMPT_CANCEL_RC:-2}"
[ "${keep,,}" = "y" ] && break
continue
fi

View file

@ -206,6 +206,13 @@ _prowlarr_ensure_tag() {
[ -n "$tid" ] && echo "$tid"
}
_byparr_is_ready() {
command -v docker >/dev/null 2>&1 || return 0
local st
st=$(docker inspect --format='{{.State.Health.Status}}' byparr 2>/dev/null || echo "")
[ "$st" = "healthy" ]
}
# Sync Byparr (FlareSolverr-compatible API solver) in Prowlarr.
prowlarr_sync_byparr_proxy() {
local apikey="$1"
@ -236,6 +243,11 @@ prowlarr_sync_byparr_proxy() {
return 1
fi
# Wait for Byparr's initial GeoIP/browser warmup so Prowlarr's synchronous proxy test succeeds.
if command -v docker >/dev/null 2>&1 && docker inspect byparr >/dev/null 2>&1; then
wait_until "Waiting for Byparr solver" 60 2 _byparr_is_ready || true
fi
local tag_id schema payload result
tag_id=$(_prowlarr_ensure_tag "$apikey" "$PROWLARR_BYPARR_TAG" || true)
schema=$(api_get "9696" "/api/v1/indexerProxy/schema" "$apikey" || echo "")

View file

@ -22,10 +22,11 @@ qbit_vpn_enabled() {
}
qbit_vuetorrent_enabled() {
case "${VUETORRENT_ENABLED:-n}" in
y|Y|yes|YES) return 0 ;;
*) return 1 ;;
esac
[ "$(qbit_ui_mode)" = "vuetorrent" ]
}
qbit_qui_enabled() {
[ "$(qbit_ui_mode)" = "qui" ]
}
# Generate PBKDF2 password hash for qBittorrent WebUI (@ByteArray(salt:hash)).
@ -326,3 +327,236 @@ qbit_create_category() {
log_step_fail "${service_name}: failed to set qBittorrent '${category}' category (HTTP ${HTTP_STATUS})"
return 1
}
# --- Standalone qui (qBittorrent WebUI) configuration ---
_qui_secret_path() {
local base="${INSTALL_DIR:-${install_directory:-}}"
if [ -n "$base" ]; then
printf '%s/secrets/qui_password.txt\n' "$base"
fi
return 0
}
_qui_login_password() {
if [ -n "${QUI_PASSWORD:-}" ]; then
printf '%s' "$QUI_PASSWORD"
return 0
fi
local sp
sp=$(_qui_secret_path)
if [ -n "$sp" ] && [ -s "$sp" ]; then
cat "$sp" 2>/dev/null || true
return 0
fi
printf '%s' "${AUTH_PASSWORD:-}"
}
_qui_is_up() {
http_request GET "http://${API_HOST}:${_QUI_PORT:-7476}/health"
}
# Authenticated JSON call against qui (X-Requested-With required by qui CSRF middleware).
_qui_api() {
local method="$1"
local port="$2"
local path="$3"
local jar="$4"
shift 4
http_request "$method" "http://${API_HOST}:${port}${path}" \
-b "$jar" \
-H "Content-Type: application/json" \
-H "X-Requested-With: XMLHttpRequest" \
"$@"
}
# Build Create/Update instance JSON payload for qui /api/instances.
qui_build_instance_payload() {
local host_url="$1"
local user="$2"
local pass="$3"
jq -nc \
--arg name "qBittorrent" \
--arg host "$host_url" \
--arg u "$user" \
--arg p "$pass" \
'{name:$name,host:$host,username:$u,password:$p,hasLocalFilesystemAccess:true}'
}
_qui_login() {
local jar="$1"
local user="$2"
local pass="$3"
local port="${4:-7476}"
local payload
payload=$(jq -nc --arg u "$user" --arg p "$pass" '{username:$u,password:$p,remember_me:false}')
: >"$jar"
http_request POST "http://${API_HOST}:${port}/api/auth/login" \
-c "$jar" -H "Content-Type: application/json" -H "X-Requested-With: XMLHttpRequest" -d "$payload" || return 1
}
configure_qui() {
qbit_qui_enabled || return 0
local qui_port="${1:-7476}"
_QUI_PORT="$qui_port"
local qui_user="${QUI_USERNAME:-${AUTH_USERNAME:-}}"
local qui_pass secret_path
qui_pass=$(_qui_login_password)
secret_path=$(_qui_secret_path)
if [ -z "$qui_user" ] || [ -z "${AUTH_PASSWORD:-}" ]; then
log_step_fail "qui: auth credentials missing"
return 1
fi
# Upstream qui requires >= 8-char password for its own account; qBittorrent instance uses shared password.
if [ "${#qui_pass}" -lt 8 ]; then
if [ -t 0 ] && [ -r /dev/tty ] && [ "${ASSEMBLRR_NONINTERACTIVE:-0}" != "1" ] && type read_masked >/dev/null 2>&1; then
log_info "qui requires a login password of at least 8 characters (qBittorrent keeps your shared password)."
local confirm=""
while true; do
qui_pass=""
read_masked "qui login password (min 8 chars): " qui_pass
if [ "${#qui_pass}" -lt 8 ]; then
log_warning "Password must be at least 8 characters."
continue
fi
read_masked "Confirm qui password: " confirm
if [ "$qui_pass" != "$confirm" ]; then
log_warning "Passwords do not match. Try again."
continue
fi
break
done
if [ -n "$secret_path" ]; then
write_secret_file "$secret_path" "$qui_pass"
fi
else
log_step_fail "qui: login password must be at least 8 characters (update via '${APP_CLI_NAME:-assemblrr} config edit' -> auth or qbit-ui)"
return 1
fi
fi
if ! wait_until "Waiting for qui UI" 60 2 _qui_is_up; then
log_step_fail "qui: API not ready on port ${qui_port}"
return 1
fi
local jar
jar=$(mktemp)
local setup_payload
setup_payload=$(jq -nc --arg u "$qui_user" --arg p "$qui_pass" '{username:$u,password:$p}')
if ! http_request POST "http://${API_HOST}:${qui_port}/api/auth/setup" \
-c "$jar" -H "Content-Type: application/json" -H "X-Requested-With: XMLHttpRequest" -d "$setup_payload"; then
if ! _qui_login "$jar" "$qui_user" "$qui_pass" "$qui_port"; then
rm -f "$jar"
log_step_fail "qui: could not initialize or log in as ${qui_user} (HTTP ${HTTP_STATUS})"
return 1
fi
fi
local qbit_url="http://qbittorrent:8081"
if qbit_vpn_enabled; then
qbit_url="http://gluetun:8081"
fi
local instances="" existing_id=""
if _qui_api GET "$qui_port" "/api/instances" "$jar"; then
instances="$HTTP_BODY"
existing_id=$(printf '%s' "$instances" | jq -r \
'[.[]? | select(.name == "qBittorrent" or ((.host // "") | contains(":8081")))][0].id // empty' \
2>/dev/null || true)
fi
local payload ok=0
payload=$(qui_build_instance_payload "$qbit_url" "$AUTH_USERNAME" "$AUTH_PASSWORD")
if [ -n "$existing_id" ]; then
if _qui_api PUT "$qui_port" "/api/instances/${existing_id}" "$jar" -d "$payload"; then
ok=1
fi
else
if _qui_api POST "$qui_port" "/api/instances" "$jar" -d "$payload"; then
ok=1
fi
fi
rm -f "$jar"
if [ "$ok" -eq 1 ]; then
log_step "qui: wired qBittorrent instance (${qbit_url})"
return 0
fi
log_step_fail "qui: failed to register qBittorrent instance (HTTP ${HTTP_STATUS})"
return 1
}
qui_change_credentials() {
local old_user="$1"
local old_pass="$2"
local new_user="$3"
local new_pass="$4"
local qui_port="${5:-7476}"
qbit_qui_enabled || return 0
if [ -z "$new_pass" ]; then
log_step_fail "qui: new password missing"
return 1
fi
local secret_path cur_pass=""
secret_path=$(_qui_secret_path)
if [ -n "$secret_path" ] && [ -s "$secret_path" ]; then
cur_pass=$(cat "$secret_path" 2>/dev/null || true)
fi
cur_pass="${cur_pass:-$old_pass}"
if [ "${#new_pass}" -lt 8 ]; then
if [ "${#cur_pass}" -lt 8 ]; then
log_step_fail "qui: password must be at least 8 characters"
return 1
fi
log_info "qui: keeping separate qui login password (qui requires 8+ chars)"
QUI_USERNAME="$old_user" QUI_PASSWORD="$cur_pass" \
AUTH_USERNAME="$new_user" AUTH_PASSWORD="$new_pass" \
configure_qui "$qui_port"
return $?
fi
local jar login_pass=""
jar=$(mktemp)
if _qui_login "$jar" "$old_user" "$cur_pass" "$qui_port"; then
login_pass="$cur_pass"
elif [ "$cur_pass" != "$old_pass" ] && _qui_login "$jar" "$old_user" "$old_pass" "$qui_port"; then
login_pass="$old_pass"
else
if _qui_login "$jar" "$old_user" "$new_pass" "$qui_port" || \
_qui_login "$jar" "$new_user" "$new_pass" "$qui_port"; then
rm -f "$jar"
[ -n "$secret_path" ] && rm -f "$secret_path" 2>/dev/null || true
QUI_USERNAME="$old_user" QUI_PASSWORD="$new_pass" \
AUTH_USERNAME="$new_user" AUTH_PASSWORD="$new_pass" \
configure_qui "$qui_port" || true
log_step "qui: already using the new password"
return 0
fi
rm -f "$jar"
log_step_fail "qui: could not log in with old password"
return 1
fi
local ch_payload
ch_payload=$(jq -nc --arg c "$login_pass" --arg n "$new_pass" '{currentPassword:$c,newPassword:$n}')
if ! _qui_api PUT "$qui_port" "/api/auth/change-password" "$jar" -d "$ch_payload"; then
rm -f "$jar"
log_step_fail "qui: password change failed (HTTP ${HTTP_STATUS})"
return 1
fi
rm -f "$jar"
[ -n "$secret_path" ] && rm -f "$secret_path" 2>/dev/null || true
QUI_USERNAME="$old_user" QUI_PASSWORD="$new_pass" \
AUTH_USERNAME="$new_user" AUTH_PASSWORD="$new_pass" \
configure_qui "$qui_port" || true
log_step "qui: updated password for ${old_user}"
return 0
}

View file

@ -21,6 +21,10 @@ list_service_catalog() {
"prowlarr|Prowlarr|9696|/|ui" \
"qbittorrent|qBittorrent|8081|/|ui"
if type qbit_ui_mode >/dev/null 2>&1 && [ "$(qbit_ui_mode)" = "qui" ]; then
printf '%s\n' "qui|qui (qBit UI)|7476|/|ui"
fi
if [ "${USENET_ENABLED:-n}" = "y" ] || [ "${USENET_ENABLED:-n}" = "Y" ]; then
printf '%s\n' "sabnzbd|SABnzbd|8085|/|ui"
fi

View file

@ -7,6 +7,9 @@ if [ -n "${_ASSEMBLRR_TTY_SOURCED:-}" ]; then
fi
readonly _ASSEMBLRR_TTY_SOURCED=1
readonly PROMPT_CANCEL_RC=2
PROMPT_CANCELLED=0
# Discard a pending line on the tty (e.g., fzf's confirming Enter). Non-blocking.
flush_tty_input() {
local __ft_junk
@ -17,11 +20,138 @@ flush_tty_input() {
return 0
}
# Shared character-by-character TTY reader supporting masked output, Ctrl+U/W, and bare Esc cancel.
_tty_read_line() {
local prompt="$1"
local var_name="$2"
local masked="${3:-0}"
local allow_esc="${4:-0}"
local value=""
local charcount=0
local old_settings=""
PROMPT_CANCELLED=0
_tty_rl_clear() {
while [ "$charcount" -gt 0 ]; do
printf '\b \b' >&2
charcount=$((charcount - 1))
done
value=""
}
printf '%s' "$prompt" >&2
old_settings=$(stty -g </dev/tty 2>/dev/null || true)
_tty_rl_restore_tty() {
if [ -n "$old_settings" ]; then
stty "$old_settings" </dev/tty 2>/dev/null || stty echo </dev/tty 2>/dev/null || true
else
stty echo </dev/tty 2>/dev/null || true
fi
}
local prev_int_trap prev_term_trap
prev_int_trap=$(trap -p INT 2>/dev/null || true)
prev_term_trap=$(trap -p TERM 2>/dev/null || true)
_tty_rl_restore_traps() {
if [ -n "$prev_int_trap" ]; then
eval "$prev_int_trap"
else
trap - INT
fi
if [ -n "$prev_term_trap" ]; then
eval "$prev_term_trap"
else
trap - TERM
fi
}
trap '_tty_rl_restore_tty; printf "\n" >&2; _tty_rl_restore_traps; kill -s INT "$$"' INT
trap '_tty_rl_restore_tty; printf "\n" >&2; _tty_rl_restore_traps; kill -s TERM "$$"' TERM
stty -echo </dev/tty 2>/dev/null || true
local char="" read_rc=0
while true; do
read_rc=0
IFS= read -r -n 1 char </dev/tty || read_rc=$?
if [ "$read_rc" -ne 0 ]; then
if [ "$allow_esc" = "1" ] && [ -z "$value" ]; then
_tty_rl_restore_traps
_tty_rl_restore_tty
printf '\n' >&2
PROMPT_CANCELLED=1
printf -v "$var_name" '%s' ""
return "$PROMPT_CANCEL_RC"
fi
break
fi
if [[ $char == $'\n' ]] || [[ -z "$char" ]]; then
break
fi
if [[ $char == $'\177' ]] || [[ $char == $'\b' ]]; then
if [ "$charcount" -gt 0 ]; then
charcount=$((charcount - 1))
printf '\b \b' >&2
value="${value%?}"
fi
elif [[ $char == $'\025' ]] || [[ $char == $'\027' ]]; then
_tty_rl_clear
elif [[ $char == $'\e' ]]; then
local next="" seq="" ch=""
if IFS= read -r -s -n 1 -t 0.05 next </dev/tty 2>/dev/null; then
seq="$next"
if [ "$next" = "[" ]; then
while IFS= read -r -s -n 1 -t 0.02 ch </dev/tty 2>/dev/null; do
seq+="$ch"
[[ "$ch" == [@-~] ]] && break
[ "${#seq}" -ge 12 ] && break
done
elif [ "$next" = "O" ]; then
IFS= read -r -s -n 1 -t 0.02 ch </dev/tty 2>/dev/null && seq+="$ch" || true
fi
case "$seq" in
"[3;5~"|"[127;5u"|"[8;5~")
_tty_rl_clear
;;
esac
elif [ "$allow_esc" = "1" ]; then
_tty_rl_restore_traps
_tty_rl_restore_tty
printf '\n' >&2
PROMPT_CANCELLED=1
printf -v "$var_name" '%s' ""
return "$PROMPT_CANCEL_RC"
fi
else
charcount=$((charcount + 1))
if [ "$masked" = "1" ]; then
printf '*' >&2
else
printf '%s' "$char" >&2
fi
value+="$char"
fi
done
_tty_rl_restore_traps
_tty_rl_restore_tty
printf '\n' >&2
printf -v "$var_name" '%s' "$value"
return 0
}
# Prompt and read a line cleanly (always -r, EOF-safe under set -e; defaults to REPLY).
read_prompt() {
local prompt="$1"
local __rp_var="${2:-REPLY}"
local __rp_reply=""
PROMPT_CANCELLED=0
if [ "${PROMPT_ALLOW_ESC:-0}" = "1" ] && [ -t 0 ] && [ -r /dev/tty ]; then
_tty_read_line "$prompt" "$__rp_var" 0 1
return $?
fi
if [ -t 0 ] && [ -r /dev/tty ]; then
read -r -p "$prompt" __rp_reply </dev/tty || true
@ -36,18 +166,9 @@ read_masked() {
local prompt="$1"
local var_name="$2"
local value=""
local charcount=0
local old_settings=""
PROMPT_CANCELLED=0
_clear_masked_input() {
while [ "$charcount" -gt 0 ]; do
printf '\b \b' >&2
charcount=$((charcount - 1))
done
value=""
}
if [ ! -t 0 ]; then
if [ ! -t 0 ] || [ ! -r /dev/tty ]; then
printf '%s' "$prompt" >&2
IFS= read -r value || true
printf '\n' >&2
@ -55,71 +176,5 @@ read_masked() {
return 0
fi
printf '%s' "$prompt" >&2
old_settings=$(stty -g 2>/dev/null || true)
_restore_masked_tty() {
if [ -n "$old_settings" ]; then
stty "$old_settings" 2>/dev/null || stty echo 2>/dev/null || true
else
stty echo 2>/dev/null || true
fi
}
local prev_int_trap prev_term_trap
prev_int_trap=$(trap -p INT 2>/dev/null || true)
prev_term_trap=$(trap -p TERM 2>/dev/null || true)
_restore_masked_traps() {
if [ -n "$prev_int_trap" ]; then
eval "$prev_int_trap"
else
trap - INT
fi
if [ -n "$prev_term_trap" ]; then
eval "$prev_term_trap"
else
trap - TERM
fi
}
trap '_restore_masked_tty; printf "\n" >&2; _restore_masked_traps; kill -s INT "$$"' INT
trap '_restore_masked_tty; printf "\n" >&2; _restore_masked_traps; kill -s TERM "$$"' TERM
stty -echo 2>/dev/null || true
local char=""
while IFS= read -r -n 1 char; do
if [[ $char == $'\n' ]] || [[ -z "$char" ]]; then
break
fi
if [[ $char == $'\177' ]] || [[ $char == $'\b' ]]; then
if [ $charcount -gt 0 ]; then
charcount=$((charcount - 1))
printf '\b \b' >&2
value="${value%?}"
fi
elif [[ $char == $'\025' ]] || [[ $char == $'\027' ]]; then
_clear_masked_input
elif [[ $char == $'\e' ]]; then
local seq="" next=""
while IFS= read -r -s -n 1 -t 0.01 next; do
seq+="$next"
[[ $next == "~" ]] && break
[ ${#seq} -ge 8 ] && break
done
case "$seq" in
"[3;5~"|"[127;5u"|"[8;5~")
_clear_masked_input
;;
esac
else
charcount=$((charcount + 1))
printf '*' >&2
value+="$char"
fi
done
_restore_masked_traps
_restore_masked_tty
printf '\n' >&2
printf -v "$var_name" '%s' "$value"
_tty_read_line "$prompt" "$var_name" 1 "${PROMPT_ALLOW_ESC:-0}"
}

View file

@ -16,10 +16,10 @@ trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/compose"
touch "$tmp/compose/base.yaml" "$tmp/compose/vpn.yaml" "$tmp/compose/direct-access.yaml" \
"$tmp/compose/vuetorrent.yaml" "$tmp/compose/gpu-intel.yaml" "$tmp/compose/gpu-nvidia.yaml" \
"$tmp/compose/vuetorrent.yaml" "$tmp/compose/qui.yaml" "$tmp/compose/gpu-intel.yaml" "$tmp/compose/gpu-nvidia.yaml" \
"$tmp/compose/byparr.yaml" "$tmp/compose/usenet.yaml"
VUETORRENT_ENABLED=n GPU_TRANSCODING=none BYPARR_ENABLED=n USENET_ENABLED=n
QBIT_UI= VUETORRENT_ENABLED=n GPU_TRANSCODING=none BYPARR_ENABLED=n USENET_ENABLED=n
test_suite "build_compose_args (VPN enabled)"
build_compose_args "$tmp" "y"
@ -51,7 +51,12 @@ GPU_TRANSCODING=nvidia
build_compose_args "$tmp" "n"
assert_contains "${COMPOSE_ARGS[*]}" "-f $tmp/compose/gpu-nvidia.yaml" "includes gpu-nvidia.yaml"
VUETORRENT_ENABLED=n GPU_TRANSCODING=none BYPARR_ENABLED=n USENET_ENABLED=n
QBIT_UI=qui VUETORRENT_ENABLED=n GPU_TRANSCODING=none BYPARR_ENABLED=n USENET_ENABLED=n
build_compose_args "$tmp" "y"
assert_contains "${COMPOSE_ARGS[*]}" "-f $tmp/compose/qui.yaml" "includes qui.yaml when QBIT_UI=qui"
assert_not_contains "${COMPOSE_ARGS[*]}" "vuetorrent.yaml" "excludes vuetorrent.yaml when QBIT_UI=qui"
QBIT_UI= VUETORRENT_ENABLED=n GPU_TRANSCODING=none BYPARR_ENABLED=n USENET_ENABLED=n
rm -f "$tmp/compose/custom.yaml"
test_suite "build_compose_args (case-insensitive VPN flag)"
@ -69,7 +74,8 @@ images=$(grep -E '^\s+image:' \
"$REPO_ROOT/compose/base.yaml" \
"$REPO_ROOT/compose/vpn.yaml" \
"$REPO_ROOT/compose/byparr.yaml" \
"$REPO_ROOT/compose/usenet.yaml")
"$REPO_ROOT/compose/usenet.yaml" \
"$REPO_ROOT/compose/qui.yaml")
assert_not_contains "$images" ":latest" "no :latest in any compose file"
assert_contains "$images" "linuxserver/jellyfin:12.4ubu2604-ls60" "jellyfin 12.4 pinned"
assert_contains "$images" "linuxserver/qbittorrent:5.3.0" "qbittorrent 5.3.0 pinned"
@ -78,6 +84,7 @@ assert_contains "$images" "linuxserver/radarr:7.0.3.10918-ls328" "radarr pinned"
assert_contains "$images" "linuxserver/prowlarr:3.0.2.5780-ls169" "prowlarr pinned"
assert_contains "$images" "linuxserver/bazarr:1.6.2" "bazarr 1.6.2 pinned"
assert_contains "$images" "linuxserver/sabnzbd:5.1.3" "sabnzbd 5.1.3 pinned"
assert_contains "$images" "autobrr/qui:v1.36.0" "qui v1.36.0 pinned"
assert_contains "$images" "seerr-team/seerr:v3.5.2" "seerr v3.5.2 pinned"
assert_contains "$images" "python:3.12.16-alpine" "gateway python pinned"
assert_contains "$images" "gluetun:v3.41.3" "gluetun v3.41.3 pinned"

View file

@ -58,6 +58,13 @@ run_config "base + vpn + vuetorrent + gpu-intel + byparr + usenet" \
-f "$tmp/compose/byparr.yaml" \
-f "$tmp/compose/usenet.yaml"
run_config "base + vpn + qui + byparr + usenet" \
-f "$tmp/compose/base.yaml" \
-f "$tmp/compose/vpn.yaml" \
-f "$tmp/compose/qui.yaml" \
-f "$tmp/compose/byparr.yaml" \
-f "$tmp/compose/usenet.yaml"
run_config "base + direct-access + gpu-nvidia + usenet" \
-f "$tmp/compose/base.yaml" \
-f "$tmp/compose/direct-access.yaml" \

View file

@ -21,7 +21,7 @@ assert_contains "$ids" "providers" "lists providers"
assert_contains "$ids" "language" "lists language"
assert_contains "$ids" "profile" "lists profile"
assert_contains "$ids" "vpn" "lists vpn"
assert_contains "$ids" "vuetorrent" "lists vuetorrent"
assert_contains "$ids" "qbit-ui" "lists qbit-ui"
assert_contains "$ids" "gpu" "lists gpu"
assert_contains "$ids" "byparr" "lists byparr"
assert_contains "$ids" "usenet" "lists usenet"
@ -30,6 +30,8 @@ assert_contains "$ids" "all" "lists all (full wizard)"
test_suite "config_edit_resolve"
assert_eq "indexers" "$(config_edit_resolve indexers)" "resolves indexers"
assert_eq "all" "$(config_edit_resolve ALL)" "case-insensitive"
assert_eq "qbit-ui" "$(config_edit_resolve vuetorrent)" "legacy vuetorrent alias -> qbit-ui"
assert_eq "qbit-ui" "$(config_edit_resolve qui)" "qui alias -> qbit-ui"
assert_failure "unknown section" config_edit_resolve not-a-section
assert_failure "old CLI alias is not a shortcut" config_edit_resolve subtitles
@ -175,4 +177,122 @@ assert_eq "600" "$perm" "preserves 0600 permissions after atomic update"
picked=$(_config_edit_pick <<< "1" 2>/dev/null)
assert_eq "indexers" "$picked" "non-fzf _config_edit_pick emits only the section id on stdout"
test_suite "config_edit Esc returns to previous menu and skips no-op restarts"
loop_res=$(bash -c '
set -euo pipefail
tmp_l=$(mktemp -d)
trap "rm -rf \"\$tmp_l\"" EXIT
source "'"$SCRIPT_DIR"'/../helpers.sh"
source "'"$REPO_ROOT"'/lib/core.sh"
stub_log_error_no_exit
source "'"$REPO_ROOT"'/lib/config_edit.sh"
printf "0\n" > "$tmp_l/picks"
sec_calls=0
_config_edit_pick() {
local c
c=$(cat "$tmp_l/picks")
c=$((c + 1))
printf "%s\n" "$c" > "$tmp_l/picks"
if [ "$c" -eq 1 ]; then
echo "qbit-ui"
else
echo ""
fi
}
_config_edit_qbit_ui() {
sec_calls=$((sec_calls + 1))
return 2
}
rc=0
config_edit_run >"$tmp_l/out" || rc=$?
echo "rc=$rc pick_calls=$(cat "$tmp_l/picks") sec_calls=$sec_calls"
cat "$tmp_l/out"
')
assert_contains "$loop_res" "rc=0 pick_calls=2 sec_calls=1" "Esc (rc=2) inside section loops back to main picker then exits cleanly"
assert_contains "$loop_res" "Cancelled." "Exiting main picker prints Cancelled."
noop_res=$(bash -c '
set -euo pipefail
tmp_e=$(mktemp -d)
trap "rm -rf \"\$tmp_e\"" EXIT
mkdir -p "$tmp_e/secrets" "$tmp_e/compose"
cat > "$tmp_e/.env" <<EOF
VPN_ENABLED=n
TZ=UTC
QBIT_UI=vuetorrent
VUETORRENT_ENABLED=y
GPU_TRANSCODING=amd
BYPARR_ENABLED=n
EOF
cat > "$tmp_e/.assemblrr-config" <<EOF
INSTALL_DIRECTORY="$tmp_e"
MEDIA_DIRECTORY="$tmp_e/media"
VPN_ENABLED="n"
TZ="UTC"
QBIT_UI="vuetorrent"
VUETORRENT_ENABLED="y"
GPU_TRANSCODING="amd"
BYPARR_ENABLED="n"
EOF
source "'"$SCRIPT_DIR"'/../helpers.sh"
source "'"$REPO_ROOT"'/lib/core.sh"
stub_log_error_no_exit
source "'"$REPO_ROOT"'/lib/config_edit.sh"
INSTALL_DIR="$tmp_e"
_lib_dir="'"$REPO_ROOT"'/lib"
RADARR_API_KEY=dummy SONARR_API_KEY=dummy PROWLARR_API_KEY=dummy
ln -s "'"$REPO_ROOT"'/lib" "$tmp_e/lib"
_config_edit_load_picker
_config_edit_load
restarts=0
_config_edit_restart_stack() { restarts=$((restarts + 1)); }
write_qbittorrent_config() { :; }
qbit_set_credentials() { :; }
_config_edit_qbit_ui <<< "vuetorrent" >/dev/null
_config_edit_byparr <<< "n" >/dev/null
_config_edit_gpu <<< "2" >/dev/null
_config_edit_timezone <<< "UTC" >/dev/null
# Simulate Esc cancel in fzf_single_select_data during _config_edit_qbit_ui
fzf_single_select_data() { return 2; }
qbit_rc=0
_config_edit_qbit_ui >/dev/null || qbit_rc=$?
echo "restarts=$restarts qbit_cancel_rc=$qbit_rc"
')
assert_contains "$noop_res" "restarts=0 qbit_cancel_rc=2" "unchanged settings & Esc cancel trigger 0 stack restarts"
test_suite "_config_edit_current_status shows active state for every section"
st_dir="$tmp/status-install"
mkdir -p "$st_dir/secrets"
printf '%s' 'alice' > "$st_dir/secrets/auth_username.txt"
printf '%s' 'os_user' > "$st_dir/secrets/opensubtitles_username.txt"
cat > "$st_dir/.env" <<'EOF'
VPN_ENABLED=y
VPN_SERVICE=surfshark
TZ=Europe/Athens
EOF
cat > "$st_dir/.assemblrr-config" <<'EOF'
QBIT_UI="vuetorrent"
GPU_TRANSCODING="amd"
BYPARR_ENABLED="y"
USENET_ENABLED="y"
USENET_HOST="news.example"
QUALITY_TIER="uhd"
QUALITY_SOURCE="bluray"
SUBTITLE_LANGUAGE="eng"
SUBTITLE_LANGUAGES="eng,ell"
TZ="Europe/Athens"
EOF
assert_eq "on|vuetorrent" "$(INSTALL_DIR="$st_dir" _config_edit_current_status qbit-ui)" "qbit-ui shows vuetorrent"
assert_eq "on|amd" "$(INSTALL_DIR="$st_dir" _config_edit_current_status gpu)" "gpu shows amd"
assert_eq "on|on" "$(INSTALL_DIR="$st_dir" _config_edit_current_status byparr)" "byparr shows on"
assert_eq "on|on · surfshark" "$(INSTALL_DIR="$st_dir" _config_edit_current_status vpn)" "vpn shows provider"
assert_eq "on|on · news.example" "$(INSTALL_DIR="$st_dir" _config_edit_current_status usenet)" "usenet shows host"
assert_eq "on|4K Bluray+WEB" "$(INSTALL_DIR="$st_dir" _config_edit_current_status profile)" "profile shows 4K Bluray+WEB"
assert_eq "on|eng,ell" "$(INSTALL_DIR="$st_dir" _config_edit_current_status language)" "language shows list"
assert_eq "on|Europe/Athens" "$(INSTALL_DIR="$st_dir" _config_edit_current_status timezone)" "timezone shows TZ"
assert_eq "on|alice" "$(INSTALL_DIR="$st_dir" _config_edit_current_status auth)" "auth shows username"
assert_eq "on|set (os_user)" "$(INSTALL_DIR="$st_dir" _config_edit_current_status opensubtitles)" "opensubtitles shows configured user"
test_summary

View file

@ -358,4 +358,51 @@ assert_contains "$setup_src" "setup_on_interrupt()" "setup defines graceful inte
assert_contains "$setup_src" "trap 'setup_on_interrupt' INT TERM" "main installs INT/TERM trap"
assert_contains "$(cat "$REPO_ROOT/lib/tty.sh")" "trap -p INT" "read_masked preserves outer INT trap"
test_suite "PTY bare Esc cancel & arrow-key handling in read_prompt / read_masked"
pty_esc=$(python3 - "$REPO_ROOT/lib/tty.sh" <<'PY'
import os, pty, select, subprocess, sys, time
tty_lib = sys.argv[1]
def run_pty(cmd, send_bytes):
master, slave = pty.openpty()
p = subprocess.Popen(
["bash", "-c", f"source '{tty_lib}'; {cmd}"],
stdin=slave, stdout=slave, stderr=slave,
start_new_session=True, close_fds=True,
)
os.close(slave)
# Wait briefly for prompt to be printed, then send keystrokes
time.sleep(0.15)
os.write(master, send_bytes)
out = b""
deadline = time.time() + 3.0
while time.time() < deadline:
r, _, _ = select.select([master], [], [], 0.1)
if r:
try:
chunk = os.read(master, 4096)
if not chunk:
break
out += chunk
except OSError:
break
elif p.poll() is not None:
break
os.close(master)
rc = p.wait(timeout=3)
return rc, out.decode("utf-8", "replace")
r1, o1 = run_pty('PROMPT_ALLOW_ESC=1 read_prompt "P: " v; rc=$?; echo "RESULT:$rc:$PROMPT_CANCELLED:$v"', b'\x1b')
print("ESC_PROMPT=" + (o1.strip().splitlines()[-1] if o1.strip() else ""))
r2, o2 = run_pty('PROMPT_ALLOW_ESC=1 read_prompt "P: " v; rc=$?; echo "RESULT:$rc:$PROMPT_CANCELLED:$v"', b'\x1b[A\x1b[Bhello\n')
print("ARROW_PROMPT=" + (o2.strip().splitlines()[-1] if o2.strip() else ""))
r3, o3 = run_pty('PROMPT_ALLOW_ESC=1 read_masked "M: " v; rc=$?; echo "RESULT:$rc:$PROMPT_CANCELLED:$v"', b'\x1b')
print("ESC_MASKED=" + (o3.strip().splitlines()[-1] if o3.strip() else ""))
PY
)
assert_contains "$pty_esc" "ESC_PROMPT=RESULT:2:1:" "PTY bare Esc cancels read_prompt with rc=2"
assert_contains "$pty_esc" "ARROW_PROMPT=RESULT:0:0:hello" "PTY arrow keys do not false-cancel read_prompt"
assert_contains "$pty_esc" "ESC_MASKED=RESULT:2:1:" "PTY bare Esc cancels read_masked with rc=2"
test_summary

View file

@ -84,7 +84,7 @@ export PUID=1000 PGID=1000 \
VPN_ENABLED=n VPN_SERVICE= VPN_TYPE=openvpn \
WIREGUARD_ADDRESSES= \
PORT_FORWARD_ONLY=off VPN_PORT_FORWARDING=off \
VUETORRENT_ENABLED=n GPU_TRANSCODING=none \
QBIT_UI=vuetorrent VUETORRENT_ENABLED=y GPU_TRANSCODING=none \
BYPARR_ENABLED=n USENET_ENABLED=n \
API_HOST=127.0.0.1

View file

@ -12,28 +12,43 @@ source "$REPO_ROOT/lib/core.sh"
source "$REPO_ROOT/lib/compose.sh"
# shellcheck disable=SC1091
source "$REPO_ROOT/lib/services.sh"
# shellcheck disable=SC1091
source "$REPO_ROOT/lib/qbit.sh"
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/compose"
touch "$tmp/compose/base.yaml" "$tmp/compose/vpn.yaml" "$tmp/compose/direct-access.yaml" \
"$tmp/compose/vuetorrent.yaml" "$tmp/compose/gpu-intel.yaml" "$tmp/compose/gpu-nvidia.yaml" \
"$tmp/compose/vuetorrent.yaml" "$tmp/compose/qui.yaml" "$tmp/compose/gpu-intel.yaml" "$tmp/compose/gpu-nvidia.yaml" \
"$tmp/compose/byparr.yaml" "$tmp/compose/usenet.yaml"
test_suite "Conditional service catalog reflects feature overlays"
VPN_ENABLED=n USENET_ENABLED=n BYPARR_ENABLED=n
VPN_ENABLED=n USENET_ENABLED=n BYPARR_ENABLED=n QBIT_UI=vuetorrent VUETORRENT_ENABLED=y
cat_off=$(list_service_catalog)
assert_contains "$cat_off" "jellyfin|Jellyfin|8096" "has jellyfin"
assert_not_contains "$cat_off" "qui|" "omits qui when QBIT_UI=vuetorrent"
assert_not_contains "$cat_off" "sabnzbd|" "omits sabnzbd when USENET_ENABLED=n"
assert_not_contains "$cat_off" "byparr|" "omits byparr when BYPARR_ENABLED=n"
assert_not_contains "$cat_off" "gluetun|" "omits gluetun when VPN_ENABLED=n"
VPN_ENABLED=y USENET_ENABLED=y BYPARR_ENABLED=y
VPN_ENABLED=y USENET_ENABLED=y BYPARR_ENABLED=y QBIT_UI=qui VUETORRENT_ENABLED=n
cat_on=$(list_service_catalog)
assert_contains "$cat_on" "qui|qui (qBit UI)|7476|/|ui" "lists qui UI when QBIT_UI=qui"
assert_contains "$cat_on" "sabnzbd|SABnzbd|8085|/|ui" "lists sabnzbd UI when USENET_ENABLED=y"
assert_contains "$cat_on" "byparr|Byparr (solver)|||internal" "lists byparr when BYPARR_ENABLED=y"
assert_contains "$cat_on" "gluetun|Gluetun (VPN)|||internal" "lists gluetun when VPN_ENABLED=y"
test_suite "qbit_ui_mode & qui payload"
assert_eq "vuetorrent" "$(QBIT_UI= VUETORRENT_ENABLED=y qbit_ui_mode)" "legacy VUETORRENT_ENABLED=y -> vuetorrent"
assert_eq "qui" "$(QBIT_UI=qui VUETORRENT_ENABLED=y qbit_ui_mode)" "explicit QBIT_UI=qui overrides legacy flag"
assert_eq "stock" "$(QBIT_UI=stock VUETORRENT_ENABLED=y qbit_ui_mode)" "explicit QBIT_UI=stock"
assert_eq "stock" "$(QBIT_UI= VUETORRENT_ENABLED=n qbit_ui_mode)" "empty QBIT_UI + n -> stock"
qui_json=$(qui_build_instance_payload "http://gluetun:8081" "alice" 'p"q')
assert_eq "http://gluetun:8081" "$(printf '%s' "$qui_json" | jq -r '.host')" "qui payload sets host"
assert_eq "true" "$(printf '%s' "$qui_json" | jq -r '.hasLocalFilesystemAccess')" "qui payload enables local FS"
assert_eq 'p"q' "$(printf '%s' "$qui_json" | jq -r '.password')" "qui payload escapes password"
test_suite "service_ui_url honors API_HOST"
assert_eq "http://localhost:8085/" "$(service_ui_url 8085 / 127.0.0.1)" "127.0.0.1 -> localhost"
assert_eq "http://192.168.1.50:8085/" "$(service_ui_url 8085 / 192.168.1.50)" "preserves LAN IP host"
@ -58,10 +73,40 @@ build_compose_args "$tmp" "n"
assert_contains "${COMPOSE_ARGS[*]}" "gpu-nvidia.yaml" "nvidia overlay included"
assert_not_contains "${COMPOSE_ARGS[*]}" "gpu-intel.yaml" "intel overlay excluded"
test_suite "Express VueTorrent default is y"
test_suite "configure_qbit_ui defaults & picker selection"
# shellcheck source=/dev/null
source "$REPO_ROOT/lib/prompts.sh"
SETUP_MODE=express configure_vuetorrent
assert_eq "y" "${vuetorrent_enabled:-}" "express mode enables VueTorrent by default"
SETUP_MODE=express QBIT_UI= VUETORRENT_ENABLED= configure_qbit_ui
assert_eq "vuetorrent" "${qbit_ui:-}" "express mode defaults qbit_ui=vuetorrent"
assert_eq "y" "${vuetorrent_enabled:-}" "express mode syncs vuetorrent_enabled=y"
# Non-TTY fallback preserves selection cleanly
# shellcheck source=/dev/null
source "$REPO_ROOT/lib/fzf-tui.sh"
SETUP_MODE=manual QBIT_UI= VUETORRENT_ENABLED= configure_qbit_ui <<< "qui"
assert_eq "qui" "${qbit_ui:-}" "manual picker selects qui"
assert_eq "n" "${vuetorrent_enabled:-}" "selecting qui clears vuetorrent_enabled"
edit_qbit_out=$(ui_set_mode edit && QBIT_UI=vuetorrent SETUP_MODE=manual configure_qbit_ui <<< "vuetorrent" 2>&1)
assert_contains "$edit_qbit_out" "[active]" "edit mode marks current qBittorrent UI [active]"
test_suite "qui password precedence and <8-char validation"
# shellcheck source=/dev/null
source "$REPO_ROOT/lib/api.sh"
log_step() { :; }
log_step_fail() { echo "fail: $1" >&2; }
mkdir -p "$tmp/secrets"
assert_eq "fallback" "$(INSTALL_DIR="$tmp" QUI_PASSWORD= AUTH_PASSWORD=fallback _qui_login_password)" "falls back to AUTH_PASSWORD when no qui_password.txt"
printf '%s' 'from-secret-file' > "$tmp/secrets/qui_password.txt"
assert_eq "from-secret-file" "$(INSTALL_DIR="$tmp" QUI_PASSWORD= AUTH_PASSWORD=fallback _qui_login_password)" "prefers secrets/qui_password.txt over AUTH_PASSWORD"
assert_eq "from-env" "$(INSTALL_DIR="$tmp" QUI_PASSWORD=from-env AUTH_PASSWORD=fallback _qui_login_password)" "prefers QUI_PASSWORD env over secret file"
rm -f "$tmp/secrets/qui_password.txt"
qui_short_out=""
qui_short_rc=0
qui_short_out=$(ASSEMBLRR_NONINTERACTIVE=1 QBIT_UI=qui INSTALL_DIR="$tmp" AUTH_USERNAME=alice AUTH_PASSWORD=short configure_qui 17476 2>&1) || qui_short_rc=$?
assert_eq "1" "$qui_short_rc" "configure_qui rejects <8-char password in non-interactive mode"
assert_contains "$qui_short_out" "at least 8 characters" "failure message explains 8-character minimum"
test_summary

View file

@ -225,7 +225,7 @@ fi
rm -rf "$tmp4" "$tmp5"
test_suite "managed files include modular libs & feature overlays"
for req in lib/log.sh lib/usenet.sh lib/recyclarr.sh lib/languages.sh compose/vuetorrent.yaml compose/gpu-intel.yaml compose/gpu-nvidia.yaml compose/byparr.yaml compose/usenet.yaml docs/komodo.md NOTICE; do
for req in lib/log.sh lib/usenet.sh lib/recyclarr.sh lib/languages.sh compose/vuetorrent.yaml compose/qui.yaml compose/gpu-intel.yaml compose/gpu-nvidia.yaml compose/byparr.yaml compose/usenet.yaml docs/komodo.md NOTICE; do
assert_true "has $req" "echo \"\$list\" | grep -q '${req}|${req}'"
done