mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-14 03:59:13 +00:00
Merge branch 'main' into update-script
This commit is contained in:
commit
3bad8a985c
3 changed files with 53 additions and 60 deletions
20
install.sh
20
install.sh
|
@ -148,12 +148,16 @@ install_x-ui() {
|
||||||
# Download resources
|
# Download resources
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/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/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
|
||||||
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 -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
|
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
|
||||||
|
@ -170,13 +174,17 @@ install_x-ui() {
|
||||||
|
|
||||||
url="https://github.com/MHSanaei/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 -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
|
||||||
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
wget -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/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
|
||||||
|
fi
|
||||||
|
|
||||||
# Stop x-ui service and remove old resources
|
# Stop x-ui service and remove old resources
|
||||||
if [[ -e /usr/local/x-ui/ ]]; then
|
if [[ -e /usr/local/x-ui/ ]]; then
|
||||||
|
@ -209,7 +217,11 @@ install_x-ui() {
|
||||||
config_after_install
|
config_after_install
|
||||||
|
|
||||||
if [[ $release == "alpine" ]]; then
|
if [[ $release == "alpine" ]]; then
|
||||||
wget -O /etc/init.d/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/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
|
||||||
|
fi
|
||||||
chmod +x /etc/init.d/x-ui
|
chmod +x /etc/init.d/x-ui
|
||||||
rc-update add x-ui
|
rc-update add x-ui
|
||||||
rc-service x-ui start
|
rc-service x-ui start
|
||||||
|
|
|
@ -108,17 +108,11 @@
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
themeSwitcher,
|
themeSwitcher,
|
||||||
loadingStates: {
|
loadingStates: { fetched: false, spinning: false },
|
||||||
fetched: false,
|
user: { username: "", password: "", twoFactorCode: "" },
|
||||||
spinning: false
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
twoFactorCode: ""
|
|
||||||
},
|
|
||||||
twoFactorEnable: false,
|
twoFactorEnable: false,
|
||||||
lang: ""
|
lang: "",
|
||||||
|
animationStarted: false
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.lang = LanguageManager.getLanguage();
|
this.lang = LanguageManager.getLanguage();
|
||||||
|
@ -127,63 +121,50 @@
|
||||||
methods: {
|
methods: {
|
||||||
async login() {
|
async login() {
|
||||||
this.loadingStates.spinning = true;
|
this.loadingStates.spinning = true;
|
||||||
|
|
||||||
const msg = await HttpUtil.post('/login', this.user);
|
const msg = await HttpUtil.post('/login', this.user);
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
location.href = basePath + 'panel/';
|
location.href = basePath + 'panel/';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingStates.spinning = false;
|
this.loadingStates.spinning = false;
|
||||||
},
|
},
|
||||||
async getTwoFactorEnable() {
|
async getTwoFactorEnable() {
|
||||||
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
this.twoFactorEnable = msg.obj;
|
this.twoFactorEnable = msg.obj;
|
||||||
this.loadingStates.fetched = true;
|
this.loadingStates.fetched = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (!this.animationStarted) {
|
||||||
|
this.animationStarted = true;
|
||||||
|
this.initHeadline();
|
||||||
|
}
|
||||||
|
});
|
||||||
return msg.obj;
|
return msg.obj;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
initHeadline() {
|
||||||
|
const animationDelay = 2000;
|
||||||
|
const headlines = this.$el.querySelectorAll('.headline');
|
||||||
|
headlines.forEach((headline) => {
|
||||||
|
const first = headline.querySelector('.is-visible');
|
||||||
|
if (!first) return;
|
||||||
|
setTimeout(() => this.hideWord(first, animationDelay), animationDelay);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
hideWord(word, delay) {
|
||||||
|
const nextWord = this.takeNext(word);
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
this.switchWord(word, nextWord);
|
||||||
var animationDelay = 2000;
|
setTimeout(() => this.hideWord(nextWord, delay), delay);
|
||||||
initHeadline();
|
},
|
||||||
|
takeNext(word) {
|
||||||
function initHeadline() {
|
return word.nextElementSibling || word.parentElement.firstElementChild;
|
||||||
animateHeadline(document.querySelectorAll('.headline'));
|
},
|
||||||
}
|
switchWord(oldWord, newWord) {
|
||||||
|
|
||||||
function animateHeadline(headlines) {
|
|
||||||
var duration = animationDelay;
|
|
||||||
headlines.forEach(function (headline) {
|
|
||||||
setTimeout(function () {
|
|
||||||
hideWord(headline.querySelector('.is-visible'));
|
|
||||||
}, duration);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideWord(word) {
|
|
||||||
var nextWord = takeNext(word);
|
|
||||||
switchWord(word, nextWord);
|
|
||||||
setTimeout(function () {
|
|
||||||
hideWord(nextWord);
|
|
||||||
}, animationDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
function takeNext(word) {
|
|
||||||
return word.nextElementSibling ? word.nextElementSibling : word.parentElement.firstElementChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchWord(oldWord, newWord) {
|
|
||||||
oldWord.classList.remove('is-visible');
|
oldWord.classList.remove('is-visible');
|
||||||
oldWord.classList.add('is-hidden');
|
oldWord.classList.add('is-hidden');
|
||||||
newWord.classList.remove('is-hidden');
|
newWord.classList.remove('is-hidden');
|
||||||
newWord.classList.add('is-visible');
|
newWord.classList.add('is-visible');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const pm_input_selector = 'input.ant-input, textarea.ant-input';
|
const pm_input_selector = 'input.ant-input, textarea.ant-input';
|
||||||
|
|
|
@ -648,7 +648,7 @@
|
||||||
"ips" = "🔢 IP-адреса:\r\n{{ .IPs }}\r\n"
|
"ips" = "🔢 IP-адреса:\r\n{{ .IPs }}\r\n"
|
||||||
"serverUpTime" = "⏳ Время работы сервера: {{ .UpTime }} {{ .Unit }}\r\n"
|
"serverUpTime" = "⏳ Время работы сервера: {{ .UpTime }} {{ .Unit }}\r\n"
|
||||||
"serverLoad" = "📈 Нагрузка сервера: {{ .Load1 }}, {{ .Load2 }}, {{ .Load3 }}\r\n"
|
"serverLoad" = "📈 Нагрузка сервера: {{ .Load1 }}, {{ .Load2 }}, {{ .Load3 }}\r\n"
|
||||||
"serverMemory" = "📋 Диск сервера: {{ .Current }}/{{ .Total }}\r\n"
|
"serverMemory" = "📋 ОЗУ сервера: {{ .Current }}/{{ .Total }}\r\n"
|
||||||
"tcpCount" = "🔹 Количество TCP-соединений: {{ .Count }}\r\n"
|
"tcpCount" = "🔹 Количество TCP-соединений: {{ .Count }}\r\n"
|
||||||
"udpCount" = "🔸 Количество UDP-соединений: {{ .Count }}\r\n"
|
"udpCount" = "🔸 Количество UDP-соединений: {{ .Count }}\r\n"
|
||||||
"traffic" = "🚦 Трафик: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
|
"traffic" = "🚦 Трафик: {{ .Total }} (↑{{ .Upload }},↓{{ .Download }})\r\n"
|
||||||
|
|
Loading…
Reference in a new issue