added new endpoint /active_iface for determining which wan interface is currently primary
Skyweave Test, Lint, and Deploy Ritual / Test and Lint Code (push) Failing after 31s
Skyweave Test, Lint, and Deploy Ritual / Deploy to Roof Unit (push) Has been skipped

This commit is contained in:
wes
2025-06-30 07:22:25 -04:00
parent 7d43a3d488
commit 48116eb42c
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -49,6 +49,7 @@ local success, load_result = pcall(function()
local router = Router:new() local router = Router:new()
router:add_route("GET", "/network_config", network_handlers.get_network_config) router:add_route("GET", "/network_config", network_handlers.get_network_config)
router:add_route("GET", "/active_iface", network_handlers.get_active_iface)
router:add_route("POST", "/connect_wifi", network_handlers.set_connect_wifi) router:add_route("POST", "/connect_wifi", network_handlers.set_connect_wifi)
router:add_route("GET", "/SOS", network_handlers.set_connect_wifi_sos) router:add_route("GET", "/SOS", network_handlers.set_connect_wifi_sos)
router:add_route("GET", "/wifi_scan", wifi_handlers.get_wifi_scan) router:add_route("GET", "/wifi_scan", wifi_handlers.get_wifi_scan)
+10
View File
@@ -4,6 +4,16 @@ local utils = require("skyweave.utils") -- Updated path
local network_handler = {} local network_handler = {}
function network_handler.get_active_iface(request_context)
local live_gateway_ip, live_gateway_iface = utils.get_active_default_gateway()
local response_data = {
active_gateway_ip = live_gateway_ip,
active_interface = live_gateway_iface,
errCode = 0,
errMsg = "OK"
}
end
-- Original: function handlers.get_network_config(params) -- Original: function handlers.get_network_config(params)
function network_handler.get_network_config(request_context) function network_handler.get_network_config(request_context)
local wan_iface_name = request_context.query.interface or "wan" -- Default to "wan" local wan_iface_name = request_context.query.interface or "wan" -- Default to "wan"