require("lua_utils")
local template = require "template_utils"
local host_pools_utils = require "host_pools_utils"
local ifstats = interface.getStats()
local function hasBridgeConfiguration(captive_portal_active)
return captive_portal_active
or (#host_pools_utils.getPoolsList(ifstats.id, true) > 1)
or (not table.empty(getCaptivePortalUsers()))
end
local captive_portal_supported = isCaptivePortalSupported(ifstats, prefs)
local captive_portal_active = isCaptivePortalActive(ifstats, prefs)
local configuration_found = hasBridgeConfiguration(captive_portal_active)
local config_overwrite_warning = ""..string.upper(i18n("warning"))..": "..i18n("bridge_wizard.warning_configuration_exist")
local no_local_networks
if not captive_portal_supported then
no_local_networks = true
for net in pairs(ntop.getLocalNetworks()) do
if not starts(net, "127.0.0.0") then
no_local_networks = false
break
end
end
else
no_local_networks = false
end
local no_local_networks_warning = ""..string.upper(i18n("error"))..": "..i18n("bridge_wizard.no_local_networks")
local captive_portal_status
if captive_portal_active then
captive_portal_status = i18n("bridge_wizard.captive_portal_running")
elseif captive_portal_supported then
captive_portal_status = i18n("bridge_wizard.captive_portal_available")
else
captive_portal_status = i18n("bridge_wizard.captive_portal_unavailable")
end
local steps = {
{ -- Step 1
title = i18n("bridge_wizard.start"),
content = i18n("bridge_wizard.intro_1", {iface=ifstats.name}).."