diff --git a/ct/hev-socks5-server.sh b/ct/hev-socks5-server.sh index 9d28e2709..ce2712fc6 100644 --- a/ct/hev-socks5-server.sh +++ b/ct/hev-socks5-server.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-1}" var_ram="${var_ram:-512}" var_disk="${var_disk:-2}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -29,26 +29,18 @@ function update_script() { exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/heiher/${APP}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + + if check_for_gh_release "hev-socks5-server" "heiher/hev-socks5-server"; then msg_info "Stopping Service" systemctl stop hev-socks5-server msg_ok "Stopped Service" - msg_info "Updating $APP to v${RELEASE}" - curl -L -o "${APP}" "https://github.com/heiher/${APP}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64" - mv ${APP} /opt/${APP} - chmod +x /opt/${APP} - msg_ok "Updated hev-socks5-server to v${RELEASE}" + fetch_and_deploy_gh_release "hev-socks5-server" "heiher/hev-socks5-server" "singlefile" "latest" "/opt" "hev-socks5-server-linux-x86_64" msg_info "Starting Service" systemctl start hev-socks5-server msg_ok "Started Service" - - echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated successfully!" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" fi exit } diff --git a/frontend/public/json/hev-socks5-server.json b/frontend/public/json/hev-socks5-server.json index 2680991f2..9bb8ff1e6 100644 --- a/frontend/public/json/hev-socks5-server.json +++ b/frontend/public/json/hev-socks5-server.json @@ -23,7 +23,7 @@ "ram": 512, "hdd": 2, "os": "debian", - "version": "12" + "version": "13" } } ], @@ -35,10 +35,6 @@ { "text": "Default credentials: `cat /root/hev.creds`", "type": "info" - }, - { - "text": "Config stored at `/etc/hev-socks5-server/main.yml`", - "type": "info" } ] } diff --git a/install/hev-socks5-server-install.sh b/install/hev-socks5-server-install.sh index fa9d627a6..ee58634b5 100644 --- a/install/hev-socks5-server-install.sh +++ b/install/hev-socks5-server-install.sh @@ -13,36 +13,30 @@ setting_up_container network_check update_os -msg_info "Setup ${APPLICATION}" -RELEASE=$(curl -fsSL https://api.github.com/repos/heiher/${APPLICATION}/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -L -o "${APPLICATION}" "https://github.com/heiher/${APPLICATION}/releases/download/${RELEASE}/hev-socks5-server-linux-x86_64" -mv ${APPLICATION} /opt/${APPLICATION} -chmod +x /opt/${APPLICATION} -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt -curl -L -o "main.yml" "https://raw.githubusercontent.com/heiher/${APPLICATION}/refs/heads/main/conf/main.yml" -sed -i 's/^#auth:/auth:/; s/^# file: conf\/auth.txt/ file: \/root\/hev.creds/' main.yml -mkdir -p /etc/${APPLICATION} -USERNAME="admin" +fetch_and_deploy_gh_release "hev-socks5-server" "heiher/hev-socks5-server" "singlefile" "latest" "/opt" "hev-socks5-server-linux-x86_64" + +msg_info "Setup hev-socks5-server" +mkdir -p /etc/hev-socks5-server +download_file "https://raw.githubusercontent.com/heiher/hev-socks5-server/refs/heads/main/conf/main.yml" "/etc/hev-socks5-server/main.yml" +sed -i 's/^#auth:/auth:/; s/^# file: conf\/auth.txt/ file: \/root\/hev.creds/' /etc/hev-socks5-server/main.yml PASSWORD=$(openssl rand -base64 16) -MARK="0" -echo "$USERNAME $PASSWORD $MARK" >/root/hev.creds -mv main.yml /etc/${APPLICATION}/main.yml -msg_ok "Setup ${APPLICATION}" +echo "admin $PASSWORD 0" >/root/hev.creds +msg_ok "Setup hev-socks5-server" msg_info "Creating Service" -cat </etc/systemd/system/${APPLICATION}.service +cat </etc/systemd/system/hev-socks5-server.service [Unit] -Description=${APPLICATION} Service +Description=hev-socks5-server Service After=network.target [Service] -ExecStart=/opt/${APPLICATION} /etc/${APPLICATION}/main.yml +ExecStart=/opt/hev-socks5-server /etc/hev-socks5-server/main.yml Restart=always [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now ${APPLICATION} +systemctl enable -q --now hev-socks5-server msg_ok "Created Service" motd_ssh