-- -- (C) 2013-23 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path local template = require "template_utils" local system_setup_ui_utils = require "system_setup_ui_utils" require "lua_utils" require "prefs_utils" prefsSkipRedis(true) local is_nedge = ntop.isnEdge() local is_appliance = ntop.isAppliance() if not (is_nedge or is_appliance) or not isAdministrator() then return end local sys_config if is_nedge then package.path = dirs.installdir .. "/pro/scripts/lua/nedge/modules/system_config/?.lua;" .. package.path sys_config = require("nf_config"):create(true) else -- ntop.isAppliance() package.path = dirs.installdir .. "/scripts/lua/modules/system_config/?.lua;" .. package.path sys_config = require("appliance_config"):create(true) end local info = ntop.getInfo(false) system_setup_ui_utils.process_apply_discard_config(sys_config) if table.len(_POST) > 0 then if (_POST["factory_reset"] ~= nil) then sys_config:prepareFactoryReset() elseif (_POST["data_reset"] ~= nil) then sys_config:prepareDataReset() else local changed = false if (_POST["lan_recovery_ip"] ~= nil) and (_POST["lan_recovery_netmask"] ~= nil) then local lan_recovery = sys_config:getLanRecoveryIpConfig() lan_recovery.ip = _POST["lan_recovery_ip"] lan_recovery.netmask = _POST["lan_recovery_netmask"] sys_config:setLanRecoveryIpConfig(lan_recovery) changed = true end local mdns_repeater = _POST["toggle_mdns_repeater"] if mdns_repeater ~= nil then local mdns_repeater_enabled = ternary(mdns_repeater == "1", true, false) sys_config:setMDNSRepeaterEnabled(mdns_repeater_enabled) changed = true end if changed then sys_config:save() end end end local function print_page_body() printPageSection(i18n("prefs.network_interfaces")) local lan_recovery = sys_config:getLanRecoveryIpConfig() local descr = i18n("nedge.lan_recovery_ip_descr", {product=info["product"]}) .. "
" .. i18n("nedge.lan_recovery_warning") .. "" system_setup_ui_utils.printPrivateAddressSelector(i18n("nedge.lan_recovery_ip"), descr, "lan_recovery_ip", "lan_recovery_netmask", lan_recovery.ip, true) local mdns_repeater_enabled = sys_config:isMDNSRepeaterEnabled() prefsToggleButton(subpage_active, { title = i18n("prefs.toggle_mdns_repeater_title"), description = i18n("prefs.toggle_mdns_repeater_description"), content = "", field = "toggle_mdns_repeater", default = "0", pref = "", redis_prefix = "", default = ternary(mdns_repeater_enabled, "1", "0"), }) print('') if is_nedge then print('') print('') end print('') print('') end if not system_setup_ui_utils.print_page_before() then return end if is_nedge then print( template.gen("modal_confirm_dialog.html", { dialog={ id = "factoryResetDialog", action = "$('#factoryResetForm').submit()", title = i18n("nedge.factory_reset"), message = i18n("nedge.factory_reset_msg"), confirm = i18n("nedge.reset_and_reboot"), confirm_button = "btn-danger", } }) ) print( template.gen("modal_confirm_dialog.html", { dialog = { id = "dataResetDialog", action = "$('#dataResetForm').submit()", title = i18n("nedge.data_reset"), message = i18n("nedge.data_reset_msg", {product = ntop.getInfo()["product"]}), confirm = i18n("nedge.reset_and_restart_self"), confirm_button = "btn-danger", } }) ) print[[
]] print[[
]] end system_setup_ui_utils.print_page_after(print_page_body, sys_config, {})