From d0b1b1c8f9cc70753c467d74d8d7bd828f969af2 Mon Sep 17 00:00:00 2001 From: climberomes Date: Thu, 11 Dec 2025 17:30:24 -0800 Subject: [PATCH 1/8] Check vpn provider then execute if valid --- installers/common.sh | 20 ++++++++++++++++++++ installers/raspbian.sh | 1 + 2 files changed, 21 insertions(+) diff --git a/installers/common.sh b/installers/common.sh index c4b8052a..8eaca706 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -422,9 +422,29 @@ function _prompt_install_feature() { if [ "$answer" != "${answer#[Nn]}" ]; then _install_status 0 "(Skipped)" else + echo -e $function fi + elif [ "$opt" == "pv_option" ]; then + # Iterate over the VPN provider options + valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) + # check if pv_option is defined + local value=${!opt} + local found=0 + for id in "${valid_ids[@]}"; do + if [ "$id" == "$value" ]; then + found=1 + break # we found a match + fi + done + if [ $found == 1 ]; then + echo -e + $function + else + _install_status 0 "Invalid VPN provider ID ${!opt} - (Skipped)" + fi elif [ "${!opt}" == 1 ]; then + echo -e $function else echo "(Skipped)" diff --git a/installers/raspbian.sh b/installers/raspbian.sh index fe368670..2b196bbd 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -106,6 +106,7 @@ function _parse_params() { restapi_option=1 adblock_option=1 wg_option=1 + pv_option=0 insiders=0 ssh=0 minwrite=0 From 08d4443c02b19600edec98c8e25d61b7cad67add Mon Sep 17 00:00:00 2001 From: climberomes Date: Thu, 11 Dec 2025 17:55:18 -0800 Subject: [PATCH 2/8] Error on bad input --- installers/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index 8eaca706..e58c12ca 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -441,7 +441,7 @@ function _prompt_install_feature() { echo -e $function else - _install_status 0 "Invalid VPN provider ID ${!opt} - (Skipped)" + _install_status 1 "Invalid VPN provider ID ${!opt} - (Skipped)" fi elif [ "${!opt}" == 1 ]; then echo -e From 1dde68ff889b8dcc362f3c944dcb0dbfa5ccdd63 Mon Sep 17 00:00:00 2001 From: climberomes Date: Thu, 11 Dec 2025 19:42:59 -0800 Subject: [PATCH 3/8] Remove my extra echo. I think from the user input they will give the carriage return --- installers/common.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/installers/common.sh b/installers/common.sh index e58c12ca..cf604c6a 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -422,7 +422,6 @@ function _prompt_install_feature() { if [ "$answer" != "${answer#[Nn]}" ]; then _install_status 0 "(Skipped)" else - echo -e $function fi elif [ "$opt" == "pv_option" ]; then From 98b55ad10b15109546cb4917c90f7557a5192eae Mon Sep 17 00:00:00 2001 From: climberomes Date: Sat, 13 Dec 2025 12:39:42 -0800 Subject: [PATCH 4/8] PR Feedback + general clarity cleanup --- installers/common.sh | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index cf604c6a..ba1c4a87 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -425,22 +425,26 @@ function _prompt_install_feature() { $function fi elif [ "$opt" == "pv_option" ]; then - # Iterate over the VPN provider options - valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) - # check if pv_option is defined - local value=${!opt} - local found=0 - for id in "${valid_ids[@]}"; do - if [ "$id" == "$value" ]; then - found=1 - break # we found a match - fi - done - if [ $found == 1 ]; then - echo -e - $function + local opt_value=${!opt} + # Skip silently if not requested (opt_value is 0) + if [ "$opt_value" == 0 ]; then + echo "(Skipped)" else - _install_status 1 "Invalid VPN provider ID ${!opt} - (Skipped)" + # Iterate over the VPN provider options + local valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) + local found=0 + for id in "${valid_ids[@]}"; do + if [ "$id" == "$opt_value" ]; then + found=1 + break + fi + done + if [ $found == 1 ]; then + echo -e + $function + else + _install_status 1 "Invalid VPN provider ID $opt_value - (Skipped)" + fi fi elif [ "${!opt}" == 1 ]; then echo -e @@ -500,8 +504,8 @@ function _install_adblock() { function _install_provider() { _install_log "Installing VPN provider support" json="$webroot_dir/config/"vpn-providers.json - while IFS='|' read -r key value; do - options["$key"]="$value" + while IFS='|' read -r key opt_value; do + options["$key"]="$opt_value" done< <(jq -r '.providers[] | "\(.id)|\(.name)|\(.bin_path)"' "$json") if [ -n "$pv_option" ]; then @@ -808,9 +812,9 @@ function _default_configuration() { if [ ${OS,,} = "ubuntu" ] && [[ ${RELEASE} =~ ^(22.04|20.04|19.10|18.04) ]]; then conf="/etc/default/hostapd" key="DAEMON_CONF" - value="/etc/hostapd/hostapd.conf" - echo "Setting default ${key} path to ${value}" - sudo sed -i -E "/^#?$key/ { s/^#//; s%=.*%=\"$value\"%; }" "$conf" || _install_status 1 "Unable to set value in ${conf}" + opt_value="/etc/hostapd/hostapd.conf" + echo "Setting default ${key} path to ${opt_value}" + sudo sed -i -E "/^#?$key/ { s/^#//; s%=.*%=\"$opt_value\"%; }" "$conf" || _install_status 1 "Unable to set opt_value in ${conf}" fi _install_log "Unmasking and enabling hostapd service" From 206e23213ac4d01da6635a7d9fc09ac5284df549 Mon Sep 17 00:00:00 2001 From: climberomes Date: Sun, 14 Dec 2025 02:23:58 -0800 Subject: [PATCH 5/8] revert. ide rename went too far --- installers/common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index ba1c4a87..0eaf97fa 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -504,8 +504,8 @@ function _install_adblock() { function _install_provider() { _install_log "Installing VPN provider support" json="$webroot_dir/config/"vpn-providers.json - while IFS='|' read -r key opt_value; do - options["$key"]="$opt_value" + while IFS='|' read -r key value; do + options["$key"]="$value" done< <(jq -r '.providers[] | "\(.id)|\(.name)|\(.bin_path)"' "$json") if [ -n "$pv_option" ]; then @@ -812,9 +812,9 @@ function _default_configuration() { if [ ${OS,,} = "ubuntu" ] && [[ ${RELEASE} =~ ^(22.04|20.04|19.10|18.04) ]]; then conf="/etc/default/hostapd" key="DAEMON_CONF" - opt_value="/etc/hostapd/hostapd.conf" - echo "Setting default ${key} path to ${opt_value}" - sudo sed -i -E "/^#?$key/ { s/^#//; s%=.*%=\"$opt_value\"%; }" "$conf" || _install_status 1 "Unable to set opt_value in ${conf}" + value="/etc/hostapd/hostapd.conf" + echo "Setting default ${key} path to ${value}" + sudo sed -i -E "/^#?$key/ { s/^#//; s%=.*%=\"$value\"%; }" "$conf" || _install_status 1 "Unable to set value in ${conf}" fi _install_log "Unmasking and enabling hostapd service" From 1d2a22397ef1249013f7e6207a5acf495172479a Mon Sep 17 00:00:00 2001 From: climberomes Date: Sun, 21 Dec 2025 00:06:11 -0800 Subject: [PATCH 6/8] Specifically assign 0 when not provider passed in --- installers/common.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 0eaf97fa..5c2fbea9 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -425,12 +425,13 @@ function _prompt_install_feature() { $function fi elif [ "$opt" == "pv_option" ]; then - local opt_value=${!opt} - # Skip silently if not requested (opt_value is 0) + # pv_option has multiple options and is not a normal binary flag [enabled(1)/disabled(0)]. + # We must evaluate the input flag and its value in this block + local opt_value=${!opt:-0} # Default to zero if somehow pv_option is still assigned as to null. if [ "$opt_value" == 0 ]; then - echo "(Skipped)" + echo "(Skipped)" # Skip if VPN Provider not selected / assigned else - # Iterate over the VPN provider options + # Iterate over the defined VPN providers by pulling the valid providers from the config file local valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) local found=0 for id in "${valid_ids[@]}"; do @@ -440,14 +441,14 @@ function _prompt_install_feature() { fi done if [ $found == 1 ]; then - echo -e + echo -e # Newline for UI / clean output $function else _install_status 1 "Invalid VPN provider ID $opt_value - (Skipped)" fi fi elif [ "${!opt}" == 1 ]; then - echo -e + echo -e # Newline for UI / clean output $function else echo "(Skipped)" From 83783ae056f006eef48514f3604889e4e121236b Mon Sep 17 00:00:00 2001 From: climberomes Date: Sun, 21 Dec 2025 00:15:09 -0800 Subject: [PATCH 7/8] nit typo code comment --- installers/common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 5c2fbea9..fef66013 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -427,11 +427,11 @@ function _prompt_install_feature() { elif [ "$opt" == "pv_option" ]; then # pv_option has multiple options and is not a normal binary flag [enabled(1)/disabled(0)]. # We must evaluate the input flag and its value in this block - local opt_value=${!opt:-0} # Default to zero if somehow pv_option is still assigned as to null. + local opt_value=${!opt:-0} # Default to zero if somehow pv_option is still unassigned. if [ "$opt_value" == 0 ]; then - echo "(Skipped)" # Skip if VPN Provider not selected / assigned + echo "(Skipped)" # Skip if VPN Provider not selected / unassigned else - # Iterate over the defined VPN providers by pulling the valid providers from the config file + # Iterate over the defined VPN Providers by pulling the valid providers from the config file local valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) local found=0 for id in "${valid_ids[@]}"; do From 8cdbfe44fdc38aab0d20951c2aa2d528f447bc1e Mon Sep 17 00:00:00 2001 From: climberomes Date: Mon, 22 Dec 2025 17:40:58 -0800 Subject: [PATCH 8/8] Remove comments --- installers/common.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index fef66013..a48e1082 100644 --- a/installers/common.sh +++ b/installers/common.sh @@ -425,13 +425,10 @@ function _prompt_install_feature() { $function fi elif [ "$opt" == "pv_option" ]; then - # pv_option has multiple options and is not a normal binary flag [enabled(1)/disabled(0)]. - # We must evaluate the input flag and its value in this block - local opt_value=${!opt:-0} # Default to zero if somehow pv_option is still unassigned. + local opt_value=${!opt:-0} if [ "$opt_value" == 0 ]; then - echo "(Skipped)" # Skip if VPN Provider not selected / unassigned + echo "(Skipped)" else - # Iterate over the defined VPN Providers by pulling the valid providers from the config file local valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json")) local found=0 for id in "${valid_ids[@]}"; do @@ -441,14 +438,14 @@ function _prompt_install_feature() { fi done if [ $found == 1 ]; then - echo -e # Newline for UI / clean output + echo -e $function else _install_status 1 "Invalid VPN provider ID $opt_value - (Skipped)" fi fi elif [ "${!opt}" == 1 ]; then - echo -e # Newline for UI / clean output + echo -e $function else echo "(Skipped)"