From 2b1a2dae0bf20116a7d52200e862a5c9a6de963c Mon Sep 17 00:00:00 2001 From: libm Date: Fri, 22 Aug 2025 15:58:18 +0800 Subject: [PATCH] fix: set secret during installation. --- install.sh | 4 +++- script/common.sh | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1c0a61f..e0886ca 100755 --- a/install.sh +++ b/install.sh @@ -51,8 +51,10 @@ systemctl daemon-reload systemctl enable "$BIN_KERNEL_NAME" >&/dev/null || _failcat '💥' "设置自启失败" && _okcat '🚀' "已设置开机自启" clashui -_okcat '🎉' 'enjoy 🎉' +clashsecret "$(_get_random_val)" >/dev/null +clashsecret clash # shellcheck disable=SC2016 [ "$SUDO_USER" != 'root' ] && _okcat '请执行 clashon 开启代理环境' +_okcat '🎉' 'enjoy 🎉' _quit diff --git a/script/common.sh b/script/common.sh index be7e1c3..a3705d4 100644 --- a/script/common.sh +++ b/script/common.sh @@ -174,6 +174,10 @@ _get_color_msg() { printf "%b%s%b\n" "$color" "$msg" "$reset" } +_get_random_val() { + cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 6 +} + function _okcat() { local color=#c8d6e5 local emoji=😼