- render: function () {
- return Promise.all([
- L.resolveDefault(pbr.getInterfaces(), {}),
- L.resolveDefault(pbr.getPlatformSupport(), {}),
- ]).then(function (data) {
- var arrInterfaces;
- var replyPlatform;
- var status, m, s, o;
-
- if (data[0] && data[0][pkg.Name] && data[0][pkg.Name].interfaces) {
- arrInterfaces = data[0][pkg.Name].interfaces;
- }
- else {
- arrInterfaces = ["wan"];
- }
-
- if (data[1] && data[1][pkg.Name]) {
- replyPlatform = data[1][pkg.Name];
- }
- else {
- replyPlatform = {
- ipset_installed: null,
- nft_installed: null,
- adguardhome_installed: null,
- dnsmasq_installed: null,
- unbound_installed: null,
- adguardhome_ipset_support: null,
- dnsmasq_ipset_support: null,
- dnsmasq_nftset_support: null,
- };
- }
-
- status = new pbr.status();
- m = new form.Map(pkg.Name, _("Policy Based Routing - Configuration"));
-
- s = m.section(form.NamedSection, 'config', pkg.Name);
- s.tab("tab_basic", _("Basic Configuration"));
- s.tab("tab_advanced", _("Advanced Configuration"),
- _("%sWARNING:%s Please make sure to check the %sREADME%s before changing anything in this section! " +
- "Change any of the settings below with extreme caution!%s").format(
- "<br/>    <b>", "</b>",
- "<a href=\"" + pkg.URL + "#service-configuration-settings\" target=\"_blank\">", "</a>", "<br/><br/>"));
- s.tab("tab_webui", _("Web UI Configuration"))
-
- o = s.taboption("tab_basic", form.ListValue, "verbosity", _("Output verbosity"),
- _("Controls both system log and console output verbosity."));
- o.value("0", _("Suppress/No output"));
- o.value("1", _("Condensed output"));
- o.value("2", _("Verbose output"));
- o.default = "2";
-
- o = s.taboption("tab_basic", form.ListValue, "strict_enforcement", _("Strict enforcement"),
- _("See the %sREADME%s for details.").format(
- "<a href=\"" + pkg.URL + "#strict-enforcement\" target=\"_blank\">", "</a>"));
- o.value("0", _("Do not enforce policies when their gateway is down"));
- o.value("1", _("Strictly enforce policies when their gateway is down"));
- o.default = "1";
-
- var text = "";
- if (replyPlatform.adguardhome_ipset_support === null) {
- text += _("The %s support is unknown.").format("<i>adguardhome.ipset</i>") + "<br />"
- }
- else if (!(replyPlatform.adguardhome_ipset_support)) {
- text += _("The %s is not supported on this system.").format("<i>adguardhome.ipset</i>") + "<br />"
- }
- if (replyPlatform.dnsmasq_ipset_support === null) {
- text += _("The %s support is unknown.").format("<i>dnsmasq.ipset</i>") + "<br />"
- }
- else if (!(replyPlatform.dnsmasq_ipset_support)) {
- text += _("The %s is not supported on this system.").format("<i>dnsmasq.ipset</i>") + "<br />"
- }
- if (replyPlatform.dnsmasq_nftset_support === null) {
- text += _("The %s support is unknown.").format("<i>dnsmasq.nftset</i>") + "<br />"
- }
- else if (!(replyPlatform.dnsmasq_nftset_support)) {
- text += _("The %s is not supported on this system.").format("<i>dnsmasq.nftset</i>") + "<br />"
- }
- text += _("Please check the %sREADME%s before changing this option.").format(
- "<a href=\"" + pkg.URL + "#use-resolvers-set-support\" target=\"_blank\">", "</a>");
- o = s.taboption("tab_basic", form.ListValue, "resolver_set", _("Use resolver set support for domains"), text);
- o.value("none", _("Disabled"));
- if (replyPlatform.adguardhome_ipset_support) {
- o.value("adguardhome.ipset", _("AdGuardHome ipset"));
- o.default = ("adguardhome.ipset", _("AdGuardHome ipset"));
- }
- if (replyPlatform.dnsmasq_ipset_support) {
- o.value("dnsmasq.ipset", _("Dnsmasq ipset"));
- o.default = ("dnsmasq.ipset", _("Dnsmasq ipset"));
- }
- if (replyPlatform.dnsmasq_nftset_support) {
- o.value("dnsmasq.nftset", _("Dnsmasq nft set"));
- o.default = ("dnsmasq.nftset", _("Dnsmasq nft set"));
+ render: function (data) {
+ var status, m, s, o;
+ var reply = {
+ interfaces: (data[0] &&
+ data[0][pkg.Name] &&
+ data[0][pkg.Name].interfaces) || ["wan"],
+ platform: (data[1] && data[1][pkg.Name]) || {
+ ipset_installed: null,
+ nft_installed: null,
+ adguardhome_installed: null,
+ dnsmasq_installed: null,
+ unbound_installed: null,
+ adguardhome_ipset_support: null,
+ dnsmasq_ipset_support: null,
+ dnsmasq_nftset_support: null,
+ },
+ };
+
+ status = new pbr.status();
+ m = new form.Map(pkg.Name, _("Policy Based Routing - Configuration"));
+
+ s = m.section(form.NamedSection, "config", pkg.Name);
+ s.tab("tab_basic", _("Basic Configuration"));
+ s.tab(
+ "tab_advanced",
+ _("Advanced Configuration"),
+ _(
+ "%sWARNING:%s Please make sure to check the %sREADME%s before changing anything in this section! " +
+ "Change any of the settings below with extreme caution!%s"
+ ).format(
+ "<br/>    <b>",
+ "</b>",
+ '<a href="' +
+ pkg.URL +
+ '#ServiceConfigurationSettings" target="_blank">',
+ "</a>",
+ "<br/><br/>"
+ )
+ );
+
+ s.tab("tab_webui", _("Web UI Configuration"));
+
+ o = s.taboption(
+ "tab_basic",
+ form.ListValue,
+ "verbosity",
+ _("Output verbosity"),
+ _("Controls both system log and console output verbosity.")
+ );
+ o.value("0", _("Suppress/No output"));
+ o.value("1", _("Condensed output"));
+ o.value("2", _("Verbose output"));
+ o.default = "2";
+
+ o = s.taboption(
+ "tab_basic",
+ form.ListValue,
+ "strict_enforcement",
+ _("Strict enforcement"),
+ _("See the %sREADME%s for details.").format(
+ '<a href="' + pkg.URL + '#StrictEnforcement" target="_blank">',
+ "</a>"
+ )
+ );
+ o.value("0", _("Do not enforce policies when their gateway is down"));
+ o.value("1", _("Strictly enforce policies when their gateway is down"));
+ o.default = "1";
+
+ var text = "";
+ if (reply.platform.adguardhome_ipset_support === null) {
+ text +=
+ _("The %s support is unknown.").format("<i>adguardhome.ipset</i>") +
+ "<br />";
+ } else if (!reply.platform.adguardhome_ipset_support) {
+ text +=
+ _("The %s is not supported on this system.").format(
+ "<i>adguardhome.ipset</i>"
+ ) + "<br />";
+ }
+ if (reply.platform.dnsmasq_ipset_support === null) {
+ text +=
+ _("The %s support is unknown.").format("<i>dnsmasq.ipset</i>") +
+ "<br />";
+ } else if (!reply.platform.dnsmasq_ipset_support) {
+ text +=
+ _("The %s is not supported on this system.").format(
+ "<i>dnsmasq.ipset</i>"
+ ) + "<br />";
+ }
+ if (reply.platform.dnsmasq_nftset_support === null) {
+ text +=
+ _("The %s support is unknown.").format("<i>dnsmasq.nftset</i>") +
+ "<br />";
+ } else if (!reply.platform.dnsmasq_nftset_support) {
+ text +=
+ _("The %s is not supported on this system.").format(
+ "<i>dnsmasq.nftset</i>"
+ ) + "<br />";
+ }
+ text += _(
+ "Please check the %sREADME%s before changing this option."
+ ).format(
+ '<a href="' + pkg.URL + '#UseResolversSetSupport" target="_blank">',
+ "</a>"
+ );
+
+ o = s.taboption(
+ "tab_basic",
+ form.ListValue,
+ "resolver_set",
+ _("Use resolver set support for domains"),
+ text
+ );
+ o.value("none", _("Disabled"));
+ if (reply.platform.adguardhome_ipset_support) {
+ o.value("adguardhome.ipset", _("AdGuardHome ipset"));
+ o.default = "adguardhome.ipset";
+ }
+ if (reply.platform.dnsmasq_ipset_support) {
+ o.value("dnsmasq.ipset", _("Dnsmasq ipset"));
+ o.default = "dnsmasq.ipset";
+ }
+ if (reply.platform.dnsmasq_nftset_support) {
+ o.value("dnsmasq.nftset", _("Dnsmasq nft set"));
+ o.default = "dnsmasq.nftset";
+ }
+
+ o = s.taboption(
+ "tab_basic",
+ form.ListValue,
+ "ipv6_enabled",
+ _("IPv6 Support")
+ );
+ o.value("0", _("Disabled"));
+ o.value("1", _("Enabled"));
+
+ o = s.taboption(
+ "tab_advanced",
+ form.DynamicList,
+ "supported_interface",
+ _("Supported Interfaces"),
+ _(
+ "Allows to specify the list of interface names (in lower case) to be explicitly supported by the service. " +
+ "Can be useful if your OpenVPN tunnels have dev option other than tun* or tap*."
+ )
+ );
+ o.optional = false;
+
+ o = s.taboption(
+ "tab_advanced",
+ form.DynamicList,
+ "ignored_interface",
+ _("Ignored Interfaces"),
+ _(
+ "Allows to specify the list of interface names (in lower case) to be ignored by the service. " +
+ "Can be useful if running both VPN server and VPN client on the router."
+ )
+ );
+ o.optional = false;
+
+ o = s.taboption(
+ "tab_advanced",
+ form.ListValue,
+ "rule_create_option",
+ _("Rule Create option"),
+ _("Select Add for -A/add and Insert for -I/Insert.")
+ );
+ o.value("add", _("Add"));
+ o.value("insert", _("Insert"));
+ o.default = "add";
+
+ o = s.taboption(
+ "tab_advanced",
+ form.ListValue,
+ "icmp_interface",
+ _("Default ICMP Interface"),
+ _("Force the ICMP protocol interface.")
+ );
+ o.value("", _("No Change"));
+ reply.interfaces.forEach((element) => {
+ if (element.toLowerCase() !== "ignore") {
+ o.value(element);