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:
authormhsanaei <ho3ein.sanaei@gmail.com>2024-06-24 15:43:39 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2024-06-24 16:06:52 +0300
commitf481ab993ed82de27405bb0cae0eafa9f54c5bea (patch)
treecd0b5d66e3eab320307b1ac312858d89d47cde62 /install.sh
parent3ef4ab423fff37012271c33136f36881be20ec15 (diff)
bash - Reset Web Base Path
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/install.sh b/install.sh
index 894171d1..c603878c 100644
--- a/install.sh
+++ b/install.sh
@@ -121,6 +121,12 @@ install_base() {
esac
}
+gen_random_string() {
+ local length="$1"
+ local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w "$length" | head -n 1)
+ echo "$random_string"
+}
+
# This function will be called when user installed x-ui out of security
config_after_install() {
echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}"
@@ -146,7 +152,7 @@ config_after_install() {
if [[ ! -f "/etc/x-ui/x-ui.db" ]]; then
local usernameTemp=$(head -c 6 /dev/urandom | base64)
local passwordTemp=$(head -c 6 /dev/urandom | base64)
- local webBasePathTemp=$(head -c 6 /dev/urandom | base64)
+ local webBasePathTemp=$(gen_random_string 10)
/usr/local/x-ui/x-ui setting -username ${usernameTemp} -password ${passwordTemp} -webBasePath ${webBasePathTemp}
echo -e "This is a fresh installation, will generate random login info for security concerns:"
echo -e "###############################################"