重构代码, 统一项目入口为install.sh

This commit is contained in:
Olia Lisa
2026-01-15 13:21:40 +08:00
parent 8d96dab146
commit 771abcf074
10 changed files with 27 additions and 56 deletions
+8 -12
View File
@@ -1,5 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
create_config_with_tls_cert() {
@@ -10,13 +9,13 @@ create_config_with_tls_cert() {
cp "$config_dir/template/tls_cert_config.json" "$config_file"
# 设置端口
bash "$script_dir/update_port.sh"
change_port
# 设置密码
bash "$script_dir/update_password.sh"
update_password
# 设置混淆密码
bash "$script_dir/update_obfs_password.sh"
update_obfs_password
# 获取邮箱
read -p "请输入你的邮箱(可留空): " user_email
@@ -57,16 +56,16 @@ create_self_tls_config() {
cp "$config_dir/template/self_cert_config.json" "$config_dir/config.json"
# 设置端口
bash "$script_dir/update_port.sh"
change_port
# 设置密码
bash "$script_dir/update_password.sh"
update_password
# 设置混淆密码
bash "$script_dir/update_obfs_password.sh"
update_obfs_password
# 生成自签名证书和设置域名
bash "$script_dir/gen_self_tls.sh" "bing.com"
gen_self_tls "bing.com"
green "创建配置成功"
}
@@ -109,6 +108,3 @@ create_config(){
;;
esac
}
create_config
-4
View File
@@ -1,5 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/jq_util.sh"
# 生成自签名证书
@@ -20,6 +19,3 @@ gen_self_tls() {
local config_file="$script_dir/../config/config.json"
modify_json_file "$config_file" "masquerade.proxy.url" "https://$domain"
}
# 调用函数,传入第一个参数作为域名
gen_self_tls "${1:-bing.com}"
-3
View File
@@ -1,5 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
print_share_link() {
@@ -55,5 +54,3 @@ print_share_link() {
echo "分享链接: $share_link"
echo -e "\033[0m"
}
print_share_link # 输出分享链接
+1 -3
View File
@@ -12,7 +12,5 @@ run() {
# 启动docker容器
docker-compose -f "$compose_file" up -d
}
run # 启动容器
}
-3
View File
@@ -23,6 +23,3 @@ update_docker_images() {
echo "正在启动容器.."
docker-compose -f "$docker_compose_file" up -d
}
# 调用函数
update_docker_images
-5
View File
@@ -1,6 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
source "$(dirname "$0")/utils/jq_util.sh"
# 修改域名
@@ -31,6 +29,3 @@ update_domain(){
echo "修改域名成功"
}
update_domain
-5
View File
@@ -1,6 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
source "$(dirname "$0")/utils/jq_util.sh"
# 更新密码的函数
update_obfs_password() {
@@ -18,6 +16,3 @@ update_obfs_password() {
echo "更新混淆密码成功"
}
# 调用函数
update_obfs_password
-5
View File
@@ -1,6 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
source "$(dirname "$0")/utils/jq_util.sh"
# 更新密码的函数
update_password() {
@@ -18,6 +16,3 @@ update_password() {
echo "设置密码成功"
}
# 调用函数
update_password
-4
View File
@@ -1,6 +1,4 @@
#!/bin/bash
source "$(dirname "$0")/utils/base.sh"
source "$(dirname "$0")/utils/jq_util.sh"
# 查找随机空闲端口
# 用途:
@@ -84,5 +82,3 @@ change_port(){
modify_json_file "$config_file" ".listen" ":$port"
echo "已分配新的空闲端口, 设置端口成功"
}
change_port