mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-10 12:16:18 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
a24892e2fa
2 changed files with 58 additions and 11 deletions
|
@ -59,6 +59,53 @@
|
||||||
address: "localhost",
|
address: "localhost",
|
||||||
domains: [],
|
domains: [],
|
||||||
queryStrategy: 'UseIP',
|
queryStrategy: 'UseIP',
|
||||||
|
|
||||||
|
},
|
||||||
|
ok() {
|
||||||
|
domains = dnsModal.dnsServer.domains.filter(d => d.length>0);
|
||||||
|
dnsModal.dnsServer.domains = domains;
|
||||||
|
newDnsServer = domains.length > 0 ? dnsModal.dnsServer : dnsModal.dnsServer.address;
|
||||||
|
ObjectUtil.execute(dnsModal.confirm, newDnsServer);
|
||||||
|
},
|
||||||
|
show({ title='', okText='{{ i18n "confirm" }}', dnsServer, confirm=(dnsServer)=>{}, isEdit=false }) {
|
||||||
|
this.title = title;
|
||||||
|
this.okText = okText;
|
||||||
|
this.confirm = confirm;
|
||||||
|
this.visible = true;
|
||||||
|
if(isEdit) {
|
||||||
|
if (typeof dnsServer == 'object'){
|
||||||
|
this.dnsServer = dnsServer;
|
||||||
|
} else {
|
||||||
|
this.dnsServer = {
|
||||||
|
address: dnsServer ?? "",
|
||||||
|
domains: [],
|
||||||
|
queryStrategy: 'UseIP',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.dnsServer = {
|
||||||
|
address: "localhost",
|
||||||
|
domains: [],
|
||||||
|
queryStrategy: 'UseIP',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.isEdit = isEdit;
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
dnsModal.visible = false;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
delimiters: ['[[', ']]'],
|
||||||
|
el: '#dns-modal',
|
||||||
|
data: {
|
||||||
|
dnsModal: dnsModal,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isAdvanced: {
|
||||||
|
get: function () { return dnsModal.dnsServer.domains.length>0 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.isEdit = isEdit;
|
this.isEdit = isEdit;
|
||||||
|
|
22
x-ui.sh
22
x-ui.sh
|
@ -591,8 +591,9 @@ open_ports() {
|
||||||
|
|
||||||
# Check if the firewall is inactive
|
# Check if the firewall is inactive
|
||||||
if ufw status | grep -q "Status: active"; then
|
if ufw status | grep -q "Status: active"; then
|
||||||
echo "firewall is already active"
|
echo "Firewall is already active"
|
||||||
else
|
else
|
||||||
|
echo "Activating firewall..."
|
||||||
# Open the necessary ports
|
# Open the necessary ports
|
||||||
ufw allow ssh
|
ufw allow ssh
|
||||||
ufw allow http
|
ufw allow http
|
||||||
|
@ -619,17 +620,18 @@ open_ports() {
|
||||||
# Split the range into start and end ports
|
# Split the range into start and end ports
|
||||||
start_port=$(echo $port | cut -d'-' -f1)
|
start_port=$(echo $port | cut -d'-' -f1)
|
||||||
end_port=$(echo $port | cut -d'-' -f2)
|
end_port=$(echo $port | cut -d'-' -f2)
|
||||||
# Loop through the range and open each port
|
ufw allow $start_port:$end_port
|
||||||
for ((i = start_port; i <= end_port; i++)); do
|
|
||||||
ufw allow $i
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
ufw allow "$port"
|
ufw allow "$port"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Confirm that the ports are open
|
# Confirm that the ports are open
|
||||||
ufw status | grep $ports
|
echo "The following ports are now open:"
|
||||||
|
ufw status | grep "ALLOW" | grep -Eo "[0-9]+(/[a-z]+)?"
|
||||||
|
|
||||||
|
echo "Firewall status:"
|
||||||
|
ufw status verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_ports() {
|
delete_ports() {
|
||||||
|
@ -649,10 +651,8 @@ delete_ports() {
|
||||||
# Split the range into start and end ports
|
# Split the range into start and end ports
|
||||||
start_port=$(echo $port | cut -d'-' -f1)
|
start_port=$(echo $port | cut -d'-' -f1)
|
||||||
end_port=$(echo $port | cut -d'-' -f2)
|
end_port=$(echo $port | cut -d'-' -f2)
|
||||||
# Loop through the range and delete each port
|
# Delete the port range
|
||||||
for ((i = start_port; i <= end_port; i++)); do
|
ufw delete allow $start_port:$end_port
|
||||||
ufw delete allow $i
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
ufw delete allow "$port"
|
ufw delete allow "$port"
|
||||||
fi
|
fi
|
||||||
|
@ -660,7 +660,7 @@ delete_ports() {
|
||||||
|
|
||||||
# Confirm that the ports are deleted
|
# Confirm that the ports are deleted
|
||||||
echo "Deleted the specified ports:"
|
echo "Deleted the specified ports:"
|
||||||
ufw status | grep $ports
|
ufw status | grep "ALLOW" | grep -Eo "[0-9]+(/[a-z]+)?"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_geo() {
|
update_geo() {
|
||||||
|
|
Loading…
Reference in a new issue