From bab350bb29783365e42781a9c40832db857b056e Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:33:47 +0330 Subject: [PATCH 01/14] Change pinSHA256 to Hex --- core/scripts/hysteria2/install.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/core/scripts/hysteria2/install.sh b/core/scripts/hysteria2/install.sh index ed2e466..88462de 100644 --- a/core/scripts/hysteria2/install.sh +++ b/core/scripts/hysteria2/install.sh @@ -19,27 +19,27 @@ install_hysteria() { wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1 wget -O /etc/hysteria/geoip.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat >/dev/null 2>&1 - fingerprint=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s/://g') + # fingerprint=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s/://g') echo "Generating base64 encoded SHA-256 fingerprint..." - cat < generate.py -import base64 -import binascii +# cat < generate.py +# import base64 +# import binascii -# Hexadecimal string -hex_string = "$fingerprint" +# # Hexadecimal string +# hex_string = "$fingerprint" -# Convert hex to binary -binary_data = binascii.unhexlify(hex_string) +# # Convert hex to binary +# binary_data = binascii.unhexlify(hex_string) -# Encode binary data to base64 -base64_encoded = base64.b64encode(binary_data).decode('utf-8') +# # Encode binary data to base64 +# base64_encoded = base64.b64encode(binary_data).decode('utf-8') -# Print the result prefixed with 'sha256/' -print('sha256/' + base64_encoded) -EOF +# # Print the result prefixed with 'sha256/' +# print('sha256/' + base64_encoded) +# EOF - sha256=$(python3 generate.py) + sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt) if [[ $port =~ ^[0-9]+$ ]] && (( port >= 1 && port <= 65535 )); then if ss -tuln | grep -q ":$port\b"; then From 060b1b77f3e3751caf19aedc0c0a57fed93596f0 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:34:40 +0330 Subject: [PATCH 02/14] Clone beta --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 5bdefb8..bd2b6d0 100644 --- a/install.sh +++ b/install.sh @@ -53,7 +53,7 @@ else echo "All required packages are already installed." fi -git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria +git clone -b beta https://github.com/ReturnFI/Hysteria2 /etc/hysteria cd /etc/hysteria python3 -m venv hysteria2_venv From e7603ae75637b6f1cbfcae8252b59f7f680ddac8 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:49:10 +0330 Subject: [PATCH 03/14] Remove "SHA256 Fingerprint=" prefix from certificate SHA256 output --- core/scripts/hysteria2/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/hysteria2/install.sh b/core/scripts/hysteria2/install.sh index 88462de..38af5b5 100644 --- a/core/scripts/hysteria2/install.sh +++ b/core/scripts/hysteria2/install.sh @@ -39,7 +39,7 @@ install_hysteria() { # print('sha256/' + base64_encoded) # EOF - sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt) + sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s///g') if [[ $port =~ ^[0-9]+$ ]] && (( port >= 1 && port <= 65535 )); then if ss -tuln | grep -q ":$port\b"; then From 7a89de8bbdec82ee384d8f0db20e78a276db3bd1 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:24:03 +0330 Subject: [PATCH 04/14] Convert pinSHA256 from base64 to hex in config.json --- upgrade.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/upgrade.sh b/upgrade.sh index 5c1f67d..c1d7957 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -117,6 +117,23 @@ else echo "$NORMALSUB_ENV not found. Skipping SUBPATH check." fi +CONFIG_FILE="/etc/hysteria/config.json" +if [ -f "$CONFIG_FILE" ]; then + echo "Checking and converting pinSHA256 format in config.json" + + if grep -q "pinSHA256.*=" "$CONFIG_FILE"; then + echo "Converting pinSHA256 from base64 to hex format" + + HEX_FINGERPRINT=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in /etc/hysteria/ca.crt | sed 's/.*=//;s///g') + + sed -i "s|\"pinSHA256\": \"sha256/.*\"|\"pinSHA256\": \"$HEX_FINGERPRINT\"|" "$CONFIG_FILE" + + echo "pinSHA256 converted to hex format: $HEX_FINGERPRINT" + else + echo "pinSHA256 appears to already be in hex format or not present, no conversion needed" + fi +fi + echo "Setting ownership and permissions" chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt chmod 640 /etc/hysteria/ca.key /etc/hysteria/ca.crt From 44942e3b707865c1b1e12719e98f1916bb767778 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:44:23 +0330 Subject: [PATCH 05/14] Fix: simplify SNI fingerprint generation using OpenSSL only --- core/scripts/hysteria2/change_sni.sh | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/core/scripts/hysteria2/change_sni.sh b/core/scripts/hysteria2/change_sni.sh index 533f046..2f590ea 100644 --- a/core/scripts/hysteria2/change_sni.sh +++ b/core/scripts/hysteria2/change_sni.sh @@ -19,25 +19,26 @@ update_sni() { openssl req -new -x509 -days 36500 -key ca.key -out ca.crt -subj "/CN=$sni" >/dev/null 2>&1 chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt chmod 640 /etc/hysteria/ca.key /etc/hysteria/ca.crt - fingerprint=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s/://g') + sha256=$(openssl x509 -noout -fingerprint -sha256 -inform pem -in ca.crt | sed 's/.*=//;s///g') - sha256=$(python3 - < Date: Fri, 11 Apr 2025 21:17:30 +0330 Subject: [PATCH 06/14] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 076d18f..c712838 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Language](https://img.shields.io/badge/Language-Persian-009688?logo=google-translate&logoColor=white)](README-fa.md) [![Latest Release](https://img.shields.io/badge/Release-Latest-brightgreen?logo=github)](https://github.com/ReturnFI/Hysteria2/releases) -[![License](https://img.shields.io/badge/License-MIT-blueviolet?logo=open-source-initiative&logoColor=white)](LICENSE) +[![License](https://img.shields.io/badge/License-GPL-blueviolet?logo=open-source-initiative&logoColor=white)](LICENSE) [![Made with ❤️](https://img.shields.io/badge/Made%20with-%E2%9D%A4-red)](#) From 90aa03ee16883059644051d61239c148cce521c1 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:18:22 +0330 Subject: [PATCH 07/14] typo --- README-fa.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-fa.md b/README-fa.md index 36f1f65..c3fb3b3 100644 --- a/README-fa.md +++ b/README-fa.md @@ -5,7 +5,7 @@ [![Lang_Eglish](https://img.shields.io/badge/Language-English-009688?logo=google-translate&logoColor=white)](README.md) [![Latest Release](https://img.shields.io/badge/Release-Latest-brightgreen?logo=github)](https://github.com/ReturnFI/Hysteria2/releases) -[![License](https://img.shields.io/badge/License-MIT-blueviolet?logo=open-source-initiative&logoColor=white)](LICENSE) +[![License](https://img.shields.io/badge/License-GPL-blueviolet?logo=open-source-initiative&logoColor=white)](LICENSE) [![Made with ❤️](https://img.shields.io/badge/Made%20with-%E2%9D%A4-red)](#) From 9297cf246735ffeadbd35ef94a7e9e95bbeca739 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:33:28 +0330 Subject: [PATCH 08/14] Remove SingBox --- core/scripts/webpanel/templates/settings.html | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/core/scripts/webpanel/templates/settings.html b/core/scripts/webpanel/templates/settings.html index 23ebf5c..44a3363 100644 --- a/core/scripts/webpanel/templates/settings.html +++ b/core/scripts/webpanel/templates/settings.html @@ -68,19 +68,13 @@
-
- -
+ -
+
@@ -467,7 +461,7 @@ function updateServiceUI(data) { const servicesMap = { "hysteria_telegram_bot": "#telegram", - "hysteria_singbox": "#singbox", + // "hysteria_singbox": "#singbox", // singbox removed "hysteria_normal_sub": "#normal", "hysteria_iplimit": "#ip-limit-service" }; @@ -483,9 +477,9 @@ $(selector).prepend(`
Service is running. You can stop it if needed.
`); $(selector + " .btn-danger").show(); - if (service === "hysteria_singbox") { - $("#singbox_start").prop('disabled', true); - } + // if (service === "hysteria_singbox") { // singbox removed + // $("#singbox_start").prop('disabled', true); + // } if(service === "hysteria_telegram_bot"){ $("#telegram_start").prop('disabled', true); } @@ -508,9 +502,9 @@ $(selector + " .btn-success").show(); $(selector + " .btn-danger").hide(); $(selector + " .alert-info").remove(); - if (service === "hysteria_singbox") { - $("#singbox_start").prop('disabled', false); - } + // if (service === "hysteria_singbox") { // singbox removed + // $("#singbox_start").prop('disabled', false); + // } if(service === "hysteria_telegram_bot"){ $("#telegram_start").prop('disabled', false); } @@ -598,32 +592,32 @@ }); } - function startSingbox() { - if (!validateForm('singbox')) return; - const domain = $("#singbox_domain").val(); - const port = $("#singbox_port").val(); - confirmAction("start SingBox", function () { - sendRequest( - "{{ url_for('singbox_start_api') }}", - "POST", - { domain: domain, port: port }, - "SingBox started successfully!", - "#singbox_start" - ); - }); - } + // function startSingbox() { // singbox removed + // if (!validateForm('singbox')) return; + // const domain = $("#singbox_domain").val(); + // const port = $("#singbox_port").val(); + // confirmAction("start SingBox", function () { + // sendRequest( + // "{{ url_for('singbox_start_api') }}", + // "POST", + // { domain: domain, port: port }, + // "SingBox started successfully!", + // "#singbox_start" + // ); + // }); + // } - function stopSingbox() { - confirmAction("stop SingBox", function () { - sendRequest( - "{{ url_for('singbox_stop_api') }}", - "DELETE", - null, - "SingBox stopped successfully!", - null - ); - }); - } + // function stopSingbox() { // singbox removed + // confirmAction("stop SingBox", function () { + // sendRequest( + // "{{ url_for('singbox_stop_api') }}", + // "DELETE", + // null, + // "SingBox stopped successfully!", + // null + // ); + // }); + // } function startNormal() { if (!validateForm('normal')) return; @@ -792,8 +786,8 @@ $("#telegram_start").on("click", startTelegram); $("#telegram_stop").on("click", stopTelegram); - $("#singbox_start").on("click", startSingbox); - $("#singbox_stop").on("click", stopSingbox); + // $("#singbox_start").on("click", startSingbox); // singbox removed + // $("#singbox_stop").on("click", stopSingbox); // singbox removed $("#normal_start").on("click", startNormal); $("#normal_stop").on("click", stopNormal); $("#port_change").on("click", changePort); @@ -806,7 +800,8 @@ $("#ip_limit_change_config").on("click", configIPLimit); - $('#singbox_domain, #normal_domain, #sni_domain').on('input', function () { + // $('#singbox_domain, #normal_domain, #sni_domain').on('input', function () { // singbox removed + $('#normal_domain, #sni_domain').on('input', function () { if (isValidDomain($(this).val())) { $(this).removeClass('is-invalid'); } else { @@ -814,7 +809,8 @@ } }); - $('#singbox_port, #normal_port, #hysteria_port').on('input', function () { + // $('#singbox_port, #normal_port, #hysteria_port').on('input', function () { // singbox removed + $('#normal_port, #hysteria_port').on('input', function () { if (isValidPort($(this).val())) { $(this).removeClass('is-invalid'); } else { From ae182ee46d663354b8f1edc76106bd4338cbabc1 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:40:32 +0330 Subject: [PATCH 09/14] Deprecated SingBox SubLink --- menu.sh | 55 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/menu.sh b/menu.sh index ccd2d06..e7bc1e7 100644 --- a/menu.sh +++ b/menu.sh @@ -485,39 +485,40 @@ telegram_bot_handler() { singbox_handler() { while true; do - echo -e "${cyan}1.${NC} Start Singbox service" + echo -e "${cyan}Merged with Normal-Sub sublink.${NC}" + # echo -e "${cyan}1.${NC} Start Singbox service" echo -e "${red}2.${NC} Stop Singbox service" echo "0. Back" read -p "Choose an option: " option case $option in - 1) - if systemctl is-active --quiet hysteria-singbox.service; then - echo "The hysteria-singbox.service is already active." - else - while true; do - read -e -p "Enter the domain name for the SSL certificate: " domain - if [ -z "$domain" ]; then - echo "Domain name cannot be empty. Please try again." - else - break - fi - done + # 1) + # if systemctl is-active --quiet hysteria-singbox.service; then + # echo "The hysteria-singbox.service is already active." + # else + # while true; do + # read -e -p "Enter the domain name for the SSL certificate: " domain + # if [ -z "$domain" ]; then + # echo "Domain name cannot be empty. Please try again." + # else + # break + # fi + # done - while true; do - read -e -p "Enter the port number for the service: " port - if [ -z "$port" ]; then - echo "Port number cannot be empty. Please try again." - elif ! [[ "$port" =~ ^[0-9]+$ ]]; then - echo "Port must be a number. Please try again." - else - break - fi - done + # while true; do + # read -e -p "Enter the port number for the service: " port + # if [ -z "$port" ]; then + # echo "Port number cannot be empty. Please try again." + # elif ! [[ "$port" =~ ^[0-9]+$ ]]; then + # echo "Port must be a number. Please try again." + # else + # break + # fi + # done - python3 $CLI_PATH singbox -a start -d "$domain" -p "$port" - fi - ;; + # python3 $CLI_PATH singbox -a start -d "$domain" -p "$port" + # fi + # ;; 2) if ! systemctl is-active --quiet hysteria-singbox.service; then echo "The hysteria-singbox.service is already inactive." @@ -1011,7 +1012,7 @@ display_advance_menu() { echo -e "${cyan}[3] ${NC}↝ Configure WARP" echo -e "${red}[4] ${NC}↝ Uninstall WARP" echo -e "${green}[5] ${NC}↝ Telegram Bot" - echo -e "${green}[6] ${NC}↝ SingBox SubLink" + echo -e "${green}[6] ${NC}↝ SingBox SubLink(${red}Deprecated${NC})" echo -e "${green}[7] ${NC}↝ Normal-SUB SubLink" echo -e "${green}[8] ${NC}↝ Web Panel" echo -e "${cyan}[9] ${NC}↝ Change Port Hysteria2" From 4e08a632d101ac214cbf872e3a54d93fc6a074cb Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:45:21 +0330 Subject: [PATCH 10/14] Remove the Singbox subscription --- core/scripts/telegrambot/utils/edituser.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/scripts/telegrambot/utils/edituser.py b/core/scripts/telegrambot/utils/edituser.py index db5c61d..537084c 100644 --- a/core/scripts/telegrambot/utils/edituser.py +++ b/core/scripts/telegrambot/utils/edituser.py @@ -87,15 +87,15 @@ def process_show_user(message): result_lines = combined_result.strip().split('\n') uri_v4 = "" - singbox_sublink = "" + # singbox_sublink = "" normal_sub_sublink = "" for line in result_lines: line = line.strip() if line.startswith("hy2://"): uri_v4 = line - elif line.startswith("Singbox Sublink:"): - singbox_sublink = result_lines[result_lines.index(line) + 1].strip() + # elif line.startswith("Singbox Sublink:"): + # singbox_sublink = result_lines[result_lines.index(line) + 1].strip() elif line.startswith("Normal-SUB Sublink:"): normal_sub_sublink = result_lines[result_lines.index(line) + 1].strip() @@ -119,8 +119,8 @@ def process_show_user(message): types.InlineKeyboardButton("Block User", callback_data=f"block_user:{actual_username}")) caption = f"{formatted_details}\n\n**IPv4 URI:**\n\n`{uri_v4}`" - if singbox_sublink: - caption += f"\n\n**SingBox SUB:**\n{singbox_sublink}" + # if singbox_sublink: + # caption += f"\n\n**SingBox SUB:**\n{singbox_sublink}" if normal_sub_sublink: caption += f"\n\n**Normal SUB:**\n{normal_sub_sublink}" From 13f3fd92737cd01453aff0e1ae5684d9d6cb07fd Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:48:42 +0330 Subject: [PATCH 11/14] Remove SingBox Status --- core/scripts/services_status.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/scripts/services_status.sh b/core/scripts/services_status.sh index 38f3f73..f9b0679 100644 --- a/core/scripts/services_status.sh +++ b/core/scripts/services_status.sh @@ -6,7 +6,7 @@ declare -a services=( "hysteria-caddy.service" "hysteria-telegram-bot.service" "hysteria-normal-sub.service" - "hysteria-singbox.service" + # "hysteria-singbox.service" "hysteria-ip-limit.service" "wg-quick@wgcf.service" ) From 10dc20ad8ee8acfb1f32da8f7dd2441c90d75292 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 21:57:40 +0330 Subject: [PATCH 12/14] Remove SingBox Service Status --- core/scripts/webpanel/routers/api/v1/schema/server.py | 2 +- core/scripts/webpanel/routers/api/v1/server.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/scripts/webpanel/routers/api/v1/schema/server.py b/core/scripts/webpanel/routers/api/v1/schema/server.py index 33ea6dd..bb3ba4b 100644 --- a/core/scripts/webpanel/routers/api/v1/schema/server.py +++ b/core/scripts/webpanel/routers/api/v1/schema/server.py @@ -20,7 +20,7 @@ class ServerServicesStatusResponse(BaseModel): hysteria_server: bool hysteria_webpanel: bool hysteria_iplimit: bool - hysteria_singbox: bool + # hysteria_singbox: bool hysteria_normal_sub: bool hysteria_telegram_bot: bool hysteria_warp: bool diff --git a/core/scripts/webpanel/routers/api/v1/server.py b/core/scripts/webpanel/routers/api/v1/server.py index 543ff61..5de4753 100644 --- a/core/scripts/webpanel/routers/api/v1/server.py +++ b/core/scripts/webpanel/routers/api/v1/server.py @@ -141,8 +141,8 @@ def __parse_services_status(services_status: dict[str, bool]) -> ServerServicesS parsed_services_status['hysteria_telegram_bot'] = status elif 'hysteria-normal-sub' in service: parsed_services_status['hysteria_normal_sub'] = status - elif 'hysteria-singbox' in service: - parsed_services_status['hysteria_singbox'] = status + # elif 'hysteria-singbox' in service: + # parsed_services_status['hysteria_singbox'] = status elif 'wg-quick' in service: parsed_services_status['hysteria_warp'] = status return ServerServicesStatusResponse(**parsed_services_status) From 3486607f3411ef18c54fe25a6b9eb3dc130a19f4 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 22:01:04 +0330 Subject: [PATCH 13/14] Update changelog --- changelog | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/changelog b/changelog index 614253c..7e343a7 100644 --- a/changelog +++ b/changelog @@ -1,7 +1,5 @@ -## [1.5.0] - 2025-04-11 -### Added -- Integrated Hysteria2-API package (https://github.com/ReturnFI/Hysteria2-API) -- Added support for managing traffic file via API +## [1.5.1] - 2025-04-11 ### Changed -- Refactored traffic-related logic to use the new API package +- Deprecated SingBox SubLink +- Change pinSHA256 to Hex From 3d4f07146bf2e78a940854fea4cf44ff5fff4da2 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Apr 2025 22:28:34 +0330 Subject: [PATCH 14/14] Clone Main --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index bd2b6d0..5bdefb8 100644 --- a/install.sh +++ b/install.sh @@ -53,7 +53,7 @@ else echo "All required packages are already installed." fi -git clone -b beta https://github.com/ReturnFI/Hysteria2 /etc/hysteria +git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria cd /etc/hysteria python3 -m venv hysteria2_venv