From 0657c9a9f5f4b1ced5818efb5255e708a9b7bb0a Mon Sep 17 00:00:00 2001 From: Ivan Kolesnikov Date: Sat, 25 Apr 2026 21:23:43 +0700 Subject: [PATCH 1/2] feat: update random HTML file selection range from 1-8 to 1-14 Co-authored-by: Copilot --- src/modules/selfsteal_templates.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/selfsteal_templates.sh b/src/modules/selfsteal_templates.sh index e34c25d..acade7b 100644 --- a/src/modules/selfsteal_templates.sh +++ b/src/modules/selfsteal_templates.sh @@ -67,8 +67,8 @@ randomhtml() { # Special handling for nothing-sni - select random HTML file if [[ "$selected_url" == *"nothing-sni"* ]]; then - # Randomly select one HTML file from 1-8.html - selected_number=$((RANDOM % 8 + 1)) + # Randomly select one HTML file from 1-14.html + selected_number=$((RANDOM % 14 + 1)) RandomHTML="${selected_number}.html" else mapfile -t templates < <(find . -maxdepth 1 -type d -not -path . | sed 's|./||') From e0bbae2f6733a15550c89d80c9dbc810f08f0bc5 Mon Sep 17 00:00:00 2001 From: Ivan Kolesnikov Date: Sat, 25 Apr 2026 21:37:23 +0700 Subject: [PATCH 2/2] fix: improve random HTML file selection and error handling in selfsteal_templates.sh --- src/modules/selfsteal_templates.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/modules/selfsteal_templates.sh b/src/modules/selfsteal_templates.sh index acade7b..5602e66 100644 --- a/src/modules/selfsteal_templates.sh +++ b/src/modules/selfsteal_templates.sh @@ -65,17 +65,18 @@ randomhtml() { rm -rf assets "README.md" "index.html" 2>/dev/null fi - # Special handling for nothing-sni - select random HTML file if [[ "$selected_url" == *"nothing-sni"* ]]; then - # Randomly select one HTML file from 1-14.html - selected_number=$((RANDOM % 14 + 1)) - RandomHTML="${selected_number}.html" + mapfile -t templates < <(find . -maxdepth 1 -type f -name "*.html" -printf '%P\n' | sort) else mapfile -t templates < <(find . -maxdepth 1 -type d -not -path . | sed 's|./||') + fi - RandomHTML="${templates[$RANDOM % ${#templates[@]}]}" + if [[ ${#templates[@]} -eq 0 ]]; then + echo "${LANG[UNPACK_ERROR]}" && exit 1 fi + RandomHTML="${templates[$RANDOM % ${#templates[@]}]}" + if [[ "$selected_url" == *"distillium"* && "$RandomHTML" == "503 error pages" ]]; then cd "$RandomHTML" || { echo "${LANG[UNPACK_ERROR]}"; exit 0; } versions=("v1" "v2") @@ -111,7 +112,7 @@ randomhtml() { -e "s|id=\"subscribe\"|id=\"sub_${random_id_suffix}\"|" \ -e "s|.*|${random_title}|" \ -e "s/<\/head>/\n\n<\/head>/" \ - -e "s//dev/null; then + if ! grep -Rql --include="*.html" -- "$random_meta_name" "/var/www/html" 2>/dev/null; then echo -e "${COLOR_RED}${LANG[FAILED_TO_MODIFY_HTML_FILES]}${COLOR_RESET}" return 1 fi