From a99ddc3b31c2066b9820aa19ddae543c12f672bc Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Mon, 12 Aug 2024 00:18:03 +0330 Subject: [PATCH] Fix QrCode --- core/scripts/hysteria2/show_user_uri.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/scripts/hysteria2/show_user_uri.sh b/core/scripts/hysteria2/show_user_uri.sh index 4549733..c3269ea 100644 --- a/core/scripts/hysteria2/show_user_uri.sh +++ b/core/scripts/hysteria2/show_user_uri.sh @@ -77,6 +77,24 @@ show_uri() { fi fi + if [ "$generate_qrcode" = true ]; then + cols=$(tput cols) + if [ -n "$URI" ]; then + qr1=$(echo -n "$URI" | qrencode -t UTF8 -s 3 -m 2) + echo -e "\nIPv4 QR Code:\n" + echo "$qr1" | while IFS= read -r line; do + printf "%*s\n" $(( (${#line} + cols) / 2)) "$line" + done + fi + if [ -n "$URI6" ]; then + qr2=$(echo -n "$URI6" | qrencode -t UTF8 -s 3 -m 2) + echo -e "\nIPv6 QR Code:\n" + echo "$qr2" | while IFS= read -r line; do + printf "%*s\n" $(( (${#line} + cols) / 2)) "$line" + done + fi + fi + if [ "$generate_singbox" = true ] && systemctl is-active --quiet singbox.service; then read -r domain port < <(get_singbox_domain_and_port) if [ -n "$domain" ] && [ -n "$port" ]; then