Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-05-06 05:05:32 +0300
committerGitHub <noreply@github.com>2025-05-06 05:05:32 +0300
commit13cf7271d6350a883a124d809b969321934abb7a (patch)
treea822f006abd9afcebe82b052feeb5b1bb7fc5032
parent63edc63ab0c1b2ec679dde0292d5e557da8e350e (diff)
fix: check default credentials during a fresh installation
-rw-r--r--README.ar_EG.md2
-rw-r--r--README.es_ES.md2
-rw-r--r--README.fa_IR.md2
-rw-r--r--README.md2
-rw-r--r--README.ru_RU.md2
-rw-r--r--README.zh_CN.md2
-rw-r--r--install.sh9
-rw-r--r--main.go7
8 files changed, 16 insertions, 12 deletions
diff --git a/README.ar_EG.md b/README.ar_EG.md
index 2a309545..f42df1e1 100644
--- a/README.ar_EG.md
+++ b/README.ar_EG.md
@@ -33,7 +33,7 @@
لتثبيت المشروع أو تحديثه، نفذ الأمر ده:
```bash
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## تثبيت النسخة القديمة (مش موصى بيها)
diff --git a/README.es_ES.md b/README.es_ES.md
index afa1b8e3..60dbd305 100644
--- a/README.es_ES.md
+++ b/README.es_ES.md
@@ -32,7 +32,7 @@
## Instalar y Actualizar
```
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## Instalar versión antigua (no recomendamos)
diff --git a/README.fa_IR.md b/README.fa_IR.md
index 806f9e69..f69f54fa 100644
--- a/README.fa_IR.md
+++ b/README.fa_IR.md
@@ -32,7 +32,7 @@
## نصب و ارتقا
```
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## نصب نسخه‌های قدیمی (توصیه نمی‌شود)
diff --git a/README.md b/README.md
index 0cace84a..cb8fef8c 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@
## Install & Upgrade
```
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## Install legacy Version (we don't recommend)
diff --git a/README.ru_RU.md b/README.ru_RU.md
index bc0170bb..c75dba91 100644
--- a/README.ru_RU.md
+++ b/README.ru_RU.md
@@ -32,7 +32,7 @@
## Установка и обновление
```
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## Установить старую версию (мы не рекомендуем)
diff --git a/README.zh_CN.md b/README.zh_CN.md
index 995a6ee1..703b6733 100644
--- a/README.zh_CN.md
+++ b/README.zh_CN.md
@@ -32,7 +32,7 @@
## 安装 & 升级
```
-bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
+bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/refs/tags/v2.5.8/install.sh)
```
## 安装旧版本 (我们不建议)
diff --git a/install.sh b/install.sh
index 92f62417..0398285d 100644
--- a/install.sh
+++ b/install.sh
@@ -82,14 +82,13 @@ gen_random_string() {
}
config_after_install() {
- local existing_username=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'username: .+' | awk '{print $2}')
- local existing_password=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'password: .+' | awk '{print $2}')
+ local existing_hasDefaultCredential=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
local server_ip=$(curl -s https://api.ipify.org)
if [[ ${#existing_webBasePath} -lt 4 ]]; then
- if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
+ if [[ "$existing_hasDefaultCredential" == "true" ]]; then
local config_webBasePath=$(gen_random_string 15)
local config_username=$(gen_random_string 10)
local config_password=$(gen_random_string 10)
@@ -112,7 +111,6 @@ config_after_install() {
echo -e "${green}WebBasePath: ${config_webBasePath}${plain}"
echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}"
echo -e "###############################################"
- echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}"
else
local config_webBasePath=$(gen_random_string 15)
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
@@ -121,7 +119,7 @@ config_after_install() {
echo -e "${green}Access URL: http://${server_ip}:${existing_port}/${config_webBasePath}${plain}"
fi
else
- if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
+ if [[ "$existing_hasDefaultCredential" == "true" ]]; then
local config_username=$(gen_random_string 10)
local config_password=$(gen_random_string 10)
@@ -132,7 +130,6 @@ config_after_install() {
echo -e "${green}Username: ${config_username}${plain}"
echo -e "${green}Password: ${config_password}${plain}"
echo -e "###############################################"
- echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}"
else
echo -e "${green}Username, Password, and WebBasePath are properly set. Exiting...${plain}"
fi
diff --git a/main.go b/main.go
index e0b83969..ed30a11f 100644
--- a/main.go
+++ b/main.go
@@ -16,6 +16,7 @@ import (
"x-ui/web"
"x-ui/web/global"
"x-ui/web/service"
+ "x-ui/util/crypto"
"github.com/op/go-logging"
)
@@ -161,6 +162,12 @@ func showSetting(show bool) {
} else {
fmt.Println("Panel is secure with SSL")
}
+
+ hasDefaultCredential := func() bool {
+ return userModel.Username == "admin" && crypto.CheckPasswordHash(userModel.Password, "admin")
+ }()
+
+ fmt.Println("hasDefaultCredential:", hasDefaultCredential)
fmt.Println("port:", port)
fmt.Println("webBasePath:", webBasePath)
}