Skip to content

Commit

Permalink
Fix status page info when backup VPS is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Dec 30, 2023
1 parent 5427b7a commit c7dc600
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions omr-tracker/files/bin/omr-tracker-server
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ _check_server() {
done
}

_disable_current() {
local serv=$1
config_set $serv current "0"
}

_disable_redir() {
local redir=$1
config_get server $redir server
Expand Down Expand Up @@ -86,6 +91,8 @@ _check_master() {
set shadowsocks-rust.sss${count}.server=$ip
EOF
if [ "$count" -eq "0" ]; then
config_load openmptcprouter
config_foreach _disable_current server
uci -q batch <<-EOF >/dev/null
set xray.omrout.s_vmess_address=$ip
set xray.omrout.s_vless_address=$ip
Expand Down Expand Up @@ -225,6 +232,8 @@ _check_backup() {
set shadowsocks-rust.sss${count}.server=$ip
EOF
if [ "$count" -eq "0" ]; then
config_load openmptcprouter
config_foreach _disable_current server
uci -q batch <<-EOF >/dev/null
set xray.omrout.s_vmess_address=$ip
set xray.omrout.s_vless_address=$ip
Expand Down
4 changes: 3 additions & 1 deletion openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,10 @@ function interfaces_status()
ucic:foreach("openmptcprouter", "server", function(s)
local serverips = uci:get("openmptcprouter",s[".name"],"ip") or { "" }
local master = uci:get("openmptcprouter",s[".name"],"master") or "1"
local current = uci:get("openmptcprouter",s[".name"],"current") or "0"
for key, value in pairs(serverips) do
serverip = value
if serverip ~= "" and (master == "1" or mArray.openmptcprouter["wan_addr"] == serverip or mArray.openmptcprouter["wan_addr6"] == serverip) and mArray.openmptcprouter["vps_admin"] == false then
if serverip ~= "" and (current == "1" or mArray.openmptcprouter["wan_addr"] == serverip or mArray.openmptcprouter["wan_addr6"] == serverip) and mArray.openmptcprouter["vps_admin"] == false then
mArray.openmptcprouter["vps_omr_version"] = uci:get("openmptcprouter", s[".name"], "omr_version") or ""
mArray.openmptcprouter["vps_kernel"] = uci:get("openmptcprouter",s[".name"],"kernel") or ""
mArray.openmptcprouter["vps_machine"] = uci:get("openmptcprouter",s[".name"],"machine") or ""
Expand Down Expand Up @@ -980,6 +981,7 @@ function interfaces_status()
else
mArray.openmptcprouter["vps_admin"] = false
mArray.openmptcprouter["vps_admin_error_msg"] = "No token yet available"
uci:set("openmptcprouter",s[".name"],"token_error","1")
end
if mArray.openmptcprouter["vps_admin"] == false then
if mArray.openmptcprouter["service_addr_ip"] ~= "" then
Expand Down

0 comments on commit c7dc600

Please sign in to comment.