From 28aa1907b276b50af4dda8b46b335378350e8320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=A1=D0=B0?= =?UTF-8?q?=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Fri, 31 Oct 2025 22:11:13 +0300 Subject: [PATCH] revert trash --- .github/workflows/docker.yml | 13 +++---- .github/workflows/release.yml | 12 +++---- .vscode/launch.json | 64 +++++++++++++++++------------------ install.sh | 23 ++++++------- main.go | 2 +- x-ui.sh | 33 ++++-------------- 6 files changed, 63 insertions(+), 84 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 30b6734d..39ddf2e0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,7 +24,8 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ghcr.io/dimasmir03/3x-ui + hsanaeii/3x-ui + ghcr.io/mhsanaei/3x-ui tags: | type=ref,event=branch type=ref,event=tag @@ -38,11 +39,11 @@ jobs: with: install: true - # - name: Login to Docker Hub - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKER_HUB_USERNAME }} - # password: ${{ secrets.DOCKER_HUB_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Login to GHCR uses: docker/login-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35a0b47e..7d56cfdf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -136,9 +136,9 @@ jobs: - name: Upload files to GH release uses: svenstaro/upload-release-action@v2 - # if: | - # (github.event_name == 'release' && github.event.action == 'published') || - # (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) + if: | + (github.event_name == 'release' && github.event.action == 'published') || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) with: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} @@ -212,9 +212,9 @@ jobs: - name: Upload files to GH release uses: svenstaro/upload-release-action@v2 - # if: | - # (github.event_name == 'release' && github.event.action == 'published') || - # (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) + if: | + (github.event_name == 'release' && github.event.action == 'published') || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) with: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} diff --git a/.vscode/launch.json b/.vscode/launch.json index 903a5af2..6958c553 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,35 +1,35 @@ { - "$schema": "vscode://schemas/launch", - "version": "0.2.0", - "configurations": [ - { - "name": "Run 3x-ui (Debug)", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${workspaceFolder}", - "cwd": "${workspaceFolder}", - "env": { - "XUI_DEBUG": "true" + "$schema": "vscode://schemas/launch", + "version": "0.2.0", + "configurations": [ + { + "name": "Run 3x-ui (Debug)", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}", + "cwd": "${workspaceFolder}", + "env": { + "XUI_DEBUG": "true" + }, + "console": "integratedTerminal" }, - "console": "integratedTerminal" - }, - { - "name": "Run 3x-ui (Debug, custom env)", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${workspaceFolder}", - "cwd": "${workspaceFolder}", - "env": { - // Set to true to serve assets/templates directly from disk for development - "XUI_DEBUG": "true", - // Uncomment to override DB folder location (by default uses working dir on Windows when debug) - "XUI_DB_FOLDER": "..\\debug", - // Example: override log level (debug|info|notice|warn|error) - // "XUI_LOG_LEVEL": "debug" - }, - "console": "integratedTerminal" - } - ] + { + "name": "Run 3x-ui (Debug, custom env)", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}", + "cwd": "${workspaceFolder}", + "env": { + // Set to true to serve assets/templates directly from disk for development + "XUI_DEBUG": "true" + // Uncomment to override DB folder location (by default uses working dir on Windows when debug) + // "XUI_DB_FOLDER": "${workspaceFolder}", + // Example: override log level (debug|info|notice|warn|error) + // "XUI_LOG_LEVEL": "debug" + }, + "console": "integratedTerminal" + } + ] } diff --git a/install.sh b/install.sh index bbdd96d0..182db90c 100644 --- a/install.sh +++ b/install.sh @@ -53,7 +53,7 @@ install_base() { arch | manjaro | parch) pacman -Syu && pacman -Syu --noconfirm wget curl tar tzdata ;; - opensuse-tumbleweed | opensuse-leap) + opensuse-tumbleweed) zypper refresh && zypper -q install -y wget curl tar timezone ;; alpine) @@ -141,7 +141,7 @@ config_after_install() { /usr/local/x-ui/x-ui migrate - local existing_apiKey=$(/usr/local/x-ui/x-ui setting -show true | grep -oP 'apikey: \K.*') + local existing_apiKey=$(/usr/local/x-ui/x-ui setting -show true | grep -oP 'apiKey: \K.*') if [[ -z "$existing_apiKey" ]]; then local config_apiKey=$(gen_random_string 32) /usr/local/x-ui/x-ui setting -apiKey "${config_apiKey}" @@ -154,19 +154,17 @@ install_x-ui() { # Download resources if [ $# == 0 ]; then - # bash <(curl -Ls https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/install.sh) - # wget --inet4-only -O /etc/init.d/x-ui https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/x-ui.rc - tag_version=$(curl -Ls "https://api.github.com/repos/dimasmir03/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') if [[ ! -n "$tag_version" ]]; then echo -e "${yellow}Trying to fetch version with IPv4...${plain}" - tag_version=$(curl -4 -Ls "https://api.github.com/repos/dimasmir03/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + tag_version=$(curl -4 -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') if [[ ! -n "$tag_version" ]]; then echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}" exit 1 fi fi echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..." - wget --inet4-only -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/dimasmir03/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz + wget --inet4-only -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz if [[ $? -ne 0 ]]; then echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}" exit 1 @@ -181,7 +179,7 @@ install_x-ui() { exit 1 fi - url="https://github.com/dimasmir03/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz" + url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz" echo -e "Beginning to install x-ui $1" wget --inet4-only -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url} if [[ $? -ne 0 ]]; then @@ -189,7 +187,7 @@ install_x-ui() { exit 1 fi fi - wget --inet4-only -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/x-ui.sh + wget --inet4-only -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh if [[ $? -ne 0 ]]; then echo -e "${red}Failed to download x-ui.sh${plain}" exit 1 @@ -226,7 +224,7 @@ install_x-ui() { config_after_install if [[ $release == "alpine" ]]; then - wget --inet4-only -O /etc/init.d/x-ui https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/x-ui.rc + wget --inet4-only -O /etc/init.d/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.rc if [[ $? -ne 0 ]]; then echo -e "${red}Failed to download x-ui.rc${plain}" exit 1 @@ -260,10 +258,9 @@ install_x-ui() { │ ${blue}x-ui legacy${plain} - legacy version │ │ ${blue}x-ui install${plain} - Install │ │ ${blue}x-ui uninstall${plain} - Uninstall │ -│ ${blue}x-ui v${plain} - Show x-ui version │ └───────────────────────────────────────────────────────┘" } -# bash <(curl -Ls https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/install.sh) + echo -e "${green}Running...${plain}" install_base -install_x-ui $1 \ No newline at end of file +install_x-ui $1 diff --git a/main.go b/main.go index e356c4f4..9360607d 100644 --- a/main.go +++ b/main.go @@ -183,7 +183,7 @@ func showSetting(show bool) { fmt.Println("hasDefaultCredential:", hasDefaultCredential) fmt.Println("port:", port) fmt.Println("webBasePath:", webBasePath) - fmt.Println("apikey:", apikey) + fmt.Println("apiKey:", apikey) } } diff --git a/x-ui.sh b/x-ui.sh index 7044d2e2..6038db7d 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -74,7 +74,7 @@ before_show_menu() { } install() { - bash <(curl -Ls https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/install.sh) + bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh) if [[ $? == 0 ]]; then if [[ $# == 0 ]]; then start @@ -93,14 +93,13 @@ update() { fi return 0 fi - bash <(curl -Ls https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/install.sh) + bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh) if [[ $? == 0 ]]; then LOGI "Update is complete, Panel has automatically restarted " before_show_menu fi } - update_menu() { echo -e "${yellow}Updating Menu${plain}" confirm "This function will update the menu to the latest changes." "y" @@ -112,7 +111,7 @@ update_menu() { return 0 fi - wget -O /usr/bin/x-ui https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/x-ui.sh + wget -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh chmod +x /usr/local/x-ui/x-ui.sh chmod +x /usr/bin/x-ui @@ -134,7 +133,7 @@ legacy_version() { exit 1 fi # Use the entered panel version in the download link - install_command="bash <(curl -Ls "https://raw.githubusercontent.com/dimasmir03/3x-ui/v$tag_version/install.sh") v$tag_version" + install_command="bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/v$tag_version/install.sh") v$tag_version" echo "Downloading and installing panel version $tag_version..." eval $install_command @@ -173,7 +172,7 @@ uninstall() { echo "" echo -e "Uninstalled Successfully.\n" echo "If you need to install this panel again, you can use below command:" - echo -e "${green}bash <(curl -Ls https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/install.sh)${plain}" + echo -e "${green}bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)${plain}" echo "" # Trap the SIGTERM signal trap delete_script SIGTERM @@ -357,13 +356,6 @@ restart() { fi } -apikey() { - /usr/local/x-ui/x-ui setting -apiKey - if [[ $# == 0 ]]; then - before_show_menu - fi -} - status() { if [[ $release == "alpine" ]]; then rc-service x-ui status @@ -551,7 +543,7 @@ enable_bbr() { } update_shell() { - wget -O /usr/bin/x-ui -N https://raw.githubusercontent.com/dimasmir03/3x-ui/feature/multi-server-support/x-ui.sh + wget -O /usr/bin/x-ui -N https://github.com/MHSanaei/3x-ui/raw/main/x-ui.sh if [[ $? != 0 ]]; then echo "" LOGE "Failed to download script, Please check whether the machine can connect Github" @@ -1870,23 +1862,16 @@ SSH_port_forwarding() { esac } -show_version() { - version=$(/usr/local/x-ui/x-ui -v true) - echo -e "x-ui Version: ${version}" - before_show_menu -} - show_usage() { echo -e "┌───────────────────────────────────────────────────────┐ │ ${blue}x-ui control menu usages (subcommands):${plain} │ -│ │ +│ │ │ ${blue}x-ui${plain} - Admin Management Script │ │ ${blue}x-ui start${plain} - Start │ │ ${blue}x-ui stop${plain} - Stop │ │ ${blue}x-ui restart${plain} - Restart │ │ ${blue}x-ui status${plain} - Current Status │ │ ${blue}x-ui settings${plain} - Current Settings │ -│ ${blue}x-ui apikey${plain} - Current API Key │ │ ${blue}x-ui enable${plain} - Enable Autostart on OS Startup │ │ ${blue}x-ui disable${plain} - Disable Autostart on OS Startup │ │ ${blue}x-ui log${plain} - Check logs │ @@ -1895,7 +1880,6 @@ show_usage() { │ ${blue}x-ui legacy${plain} - legacy version │ │ ${blue}x-ui install${plain} - Install │ │ ${blue}x-ui uninstall${plain} - Uninstall │ -│ ${blue}x-ui v${plain} - Show x-ui version │ └───────────────────────────────────────────────────────┘" } @@ -2066,9 +2050,6 @@ if [[ $# > 0 ]]; then "uninstall") check_install 0 && uninstall 0 ;; - "v") - check_install 0 && show_version 0 - ;; *) show_usage ;; esac else