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