From b6b4e57a8bfccef9c648afb2d5b1070c8b19a599 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Wed, 22 Feb 2023 17:27:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E4=BC=98=E5=8C=96p?= =?UTF-8?q?ath=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index dc1b749..14dab9b 100644 --- a/install.sh +++ b/install.sh @@ -448,8 +448,8 @@ readConfigHostPathUUID() { if [[ $(echo "${fallback}" | jq -r .dest) == 31297 ]]; then currentPath=$(echo "${path}" | awk -F "[w][s]" '{print $1}') - elif [[ $(echo "${fallback}" | jq -r .dest) == 31298 ]]; then - currentPath=$(echo "${path}" | awk -F "[t][c][p]" '{print $1}') + # elif [[ $(echo "${fallback}" | jq -r .dest) == 31298 ]]; then + # currentPath=$(echo "${path}" | awk -F "[t][c][p]" '{print $1}') elif [[ $(echo "${fallback}" | jq -r .dest) == 31299 ]]; then currentPath=$(echo "${path}" | awk -F "[v][w][s]" '{print $1}') fi @@ -1386,6 +1386,16 @@ server { } EOF } +# 初始化随机字符串 +initRandomPath() { + local chars="abcdefghijklmnopqrtuxyz" + local initCustomPath= + for i in {1..4}; do + echo "${i}" >/dev/null + initCustomPath+="${chars:RANDOM%${#chars}:1}" + done + customPath=${initCustomPath} +} # 自定义/随机路径 randomPathFunction() { @@ -1405,13 +1415,17 @@ randomPathFunction() { read -r -p '路径:' customPath if [[ -z "${customPath}" ]]; then - customPath=$(head -n 50 /dev/urandom | sed 's/[^a-z]//g' | strings -n 4 | tr '[:upper:]' '[:lower:]' | head -1) - currentPath=${customPath:0:4} - customPath=${currentPath} - else + customPath=$(initRandomPath) currentPath=${customPath} + else + if [[ "${customPath: -2}" == "ws" ]]; then + echo + echoContent red " ---> 自定义path结尾不可用ws结尾,否则无法区分分流路径" + randomPathFunction "$1" + else + currentPath=${customPath} + fi fi - fi echoContent yellow "\n path:${currentPath}" echoContent skyBlue "\n----------------------------" @@ -5513,7 +5527,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.7.2" + echoContent green "当前版本:v2.7.3" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus