From 0d7123bebd338edb9265036dec23c2a3b751ee33 Mon Sep 17 00:00:00 2001 From: maksarsanjeev Date: Sat, 10 Oct 2026 03:10:20 +0300 Subject: [PATCH] ops installer: server list from a file when the subscription page is blocked From the homelab the subscription host times out while the VLESS node itself is reachable: ~/.brovops-nodes (the subscription content) becomes a file provider; the URL provider stays optional. take_file no longer trips set -e on a missing file. Co-Authored-By: Claude Opus 5.5 --- ops/deploy/install.sh | 49 +++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/ops/deploy/install.sh b/ops/deploy/install.sh index df10b54..41c9b89 100644 --- a/ops/deploy/install.sh +++ b/ops/deploy/install.sh @@ -44,18 +44,42 @@ USER_HOME=$(getent passwd "${SUDO_USER:-root}" | cut -d: -f6) take_file() { # ~/.brovops- → stdout, then removed f="$USER_HOME/.brovops-$1" [ -f "$f" ] && [ ! -L "$f" ] && { cat "$f"; rm -f "$f"; } + return 0 # a missing file is fine (set -e would stop the install) } ask_secret() { # prompt → stdout, input not echoed printf "%s" "$1" > /dev/tty stty -echo < /dev/tty; read -r v < /dev/tty; stty echo < /dev/tty; echo > /dev/tty printf "%s" "$v" } -if [ ! -s $PROXY_DIR/vless.sub ]; then - take_file sub > $PROXY_DIR/vless.sub - [ -s $PROXY_DIR/vless.sub ] || ask_secret "Ссылка подписки VLESS (ввод скрыт): " > $PROXY_DIR/vless.sub - [ -s $PROXY_DIR/vless.sub ] || { echo "✗ подписка не введена"; exit 1; } +# Server list: the subscription content as a file (~/.brovops-nodes — when the subscription +# page itself is blocked from here) and/or the subscription URL (~/.brovops-sub). +NODES=$(take_file nodes); [ -n "$NODES" ] && printf '%s\n' "$NODES" > $PROXY_DIR/nodes.txt +SUBURL=$(take_file sub); [ -n "$SUBURL" ] && printf '%s\n' "$SUBURL" > $PROXY_DIR/vless.sub +if [ ! -s $PROXY_DIR/nodes.txt ] && [ ! -s $PROXY_DIR/vless.sub ]; then + ask_secret "Ссылка подписки VLESS (ввод скрыт): " > $PROXY_DIR/vless.sub + [ -s $PROXY_DIR/vless.sub ] || { echo "✗ нет ни подписки, ни списка серверов"; exit 1; } +fi +PROVIDERS=""; USE="" +if [ -s $PROXY_DIR/nodes.txt ]; then + PROVIDERS="$PROVIDERS + nodes: + type: file + path: ./nodes.txt + health-check: {enable: true, url: \"https://www.gstatic.com/generate_204\", interval: 300}" + USE="nodes" +fi +if [ -s $PROXY_DIR/vless.sub ]; then + SUB=$(head -n1 $PROXY_DIR/vless.sub | tr -d '\r\n ') + PROVIDERS="$PROVIDERS + vless: + type: http + url: \"$SUB\" + path: ./vless.yaml + interval: 43200 + proxy: DIRECT + health-check: {enable: true, url: \"https://www.gstatic.com/generate_204\", interval: 300}" + USE="${USE:+$USE, }vless" fi -SUB=$(head -n1 $PROXY_DIR/vless.sub | tr -d '\r\n ') umask 077 cat > $PROXY_DIR/config.yaml </dev/null