mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
bash - Access URL
I will add https with domain later
This commit is contained in:
parent
0e3691fdbd
commit
13f7e07128
2 changed files with 13 additions and 2 deletions
|
@ -142,6 +142,8 @@ config_after_install() {
|
||||||
local existing_username=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'username: .+' | awk '{print $2}')
|
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_password=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'password: .+' | awk '{print $2}')
|
||||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | 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_webBasePath} -lt 4 ]]; then
|
||||||
if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
|
if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
|
||||||
|
@ -149,7 +151,7 @@ config_after_install() {
|
||||||
local config_username=$(gen_random_string 10)
|
local config_username=$(gen_random_string 10)
|
||||||
local config_password=$(gen_random_string 10)
|
local config_password=$(gen_random_string 10)
|
||||||
|
|
||||||
read -p "Would you like to customize the Panel Port settings? (If not, random port will be applied) [y/n]: " config_confirm
|
read -p "Would you like to customize the Panel Port settings? (If not, a random port will be applied) [y/n]: " config_confirm
|
||||||
if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then
|
if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then
|
||||||
read -p "Please set up the panel port: " config_port
|
read -p "Please set up the panel port: " config_port
|
||||||
echo -e "${yellow}Your Panel Port is: ${config_port}${plain}"
|
echo -e "${yellow}Your Panel Port is: ${config_port}${plain}"
|
||||||
|
@ -165,6 +167,7 @@ config_after_install() {
|
||||||
echo -e "${green}Password: ${config_password}${plain}"
|
echo -e "${green}Password: ${config_password}${plain}"
|
||||||
echo -e "${green}Port: ${config_port}${plain}"
|
echo -e "${green}Port: ${config_port}${plain}"
|
||||||
echo -e "${green}WebBasePath: ${config_webBasePath}${plain}"
|
echo -e "${green}WebBasePath: ${config_webBasePath}${plain}"
|
||||||
|
echo -e "${green}Access URL: http://${server_ip}:${config_port}${config_webBasePath}${plain}"
|
||||||
echo -e "###############################################"
|
echo -e "###############################################"
|
||||||
echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}"
|
echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}"
|
||||||
else
|
else
|
||||||
|
@ -172,6 +175,7 @@ config_after_install() {
|
||||||
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
|
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
|
||||||
/usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}"
|
/usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}"
|
||||||
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
||||||
|
echo -e "${green}Access URL: http://${server_ip}:${existing_port}${config_webBasePath}${plain}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
|
if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then
|
||||||
|
|
9
x-ui.sh
9
x-ui.sh
|
@ -308,12 +308,19 @@ reset_config() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_config() {
|
check_config() {
|
||||||
info=$(/usr/local/x-ui/x-ui setting -show true)
|
local info=$(/usr/local/x-ui/x-ui setting -show true)
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
LOGE "get current settings error, please check logs"
|
LOGE "get current settings error, please check logs"
|
||||||
show_menu
|
show_menu
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
LOGI "${info}"
|
LOGI "${info}"
|
||||||
|
|
||||||
|
local existing_webBasePath=$(echo "$info" | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
||||||
|
local existing_port=$(echo "$info" | grep -Eo 'port: .+' | awk '{print $2}')
|
||||||
|
local server_ip=$(curl -s https://api.ipify.org)
|
||||||
|
|
||||||
|
echo -e "${green}Access URL: http://${server_ip}:${existing_port}${existing_webBasePath}${plain}"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_port() {
|
set_port() {
|
||||||
|
|
Loading…
Reference in a new issue