summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-pbr/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-pbr/htdocs/luci-static/resources/view')
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js74
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js18
2 files changed, 47 insertions, 45 deletions
diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js
index 99f8a502fa..0b35268ec3 100644
--- a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js
+++ b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js
@@ -7,15 +7,7 @@
"require view";
"require pbr.status as pbr";
-var pkg = {
- get Name() {
- return "pbr";
- },
-
- get URL() {
- return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
- },
-};
+var pkg = pbr.pkg;
return view.extend({
load: function () {
@@ -95,26 +87,6 @@ return view.extend({
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>") +
@@ -279,7 +251,10 @@ return view.extend({
_(
"Name, interface and at least one other field are required. Multiple local and remote " +
"addresses/devices/domains and ports can be space separated. Placeholders below represent just " +
- "the format/syntax and will not be used if fields are left blank."
+ "the format/syntax and will not be used if fields are left blank. For more information on options, check the %sREADME%s."
+ ).format(
+ '<a href="' + pkg.URL + '#PolicyOptions" target="_blank">',
+ "</a>"
)
);
s.rowcolors = true;
@@ -351,6 +326,45 @@ return view.extend({
o.rmempty = false;
s = m.section(
+ form.GridSection,
+ "dns_policy",
+ _("DNS Policies"),
+ _(
+ "Name, local address and remote DNS fields are required. Multiple local " +
+ "addresses/devices can be space separated. For more information on options, check the %sREADME%s."
+ ).format(
+ '<a href="' + pkg.URL + '#DNSPolicyOptions" target="_blank">',
+ "</a>"
+ )
+ );
+ s.rowcolors = true;
+ s.sortable = true;
+ s.anonymous = true;
+ s.addremove = true;
+
+ o = s.option(form.Flag, "enabled", _("Enabled"));
+ o.default = "1";
+ o.editable = true;
+
+ o = s.option(form.Value, "name", _("Name"));
+ o.optional = false;
+
+ o = s.option(form.Value, "src_addr", _("Local addresses / devices"));
+ o.optional = false;
+ o.datatype =
+ "list(neg(or(cidr,host,ipmask,ipaddr,macaddr,network,string)))";
+ o.rmempty = true;
+ o.default = "";
+
+ o = s.option(form.Value, "dest_dns", _("Remote DNS"));
+ o.optional = false;
+ o.rmempty = false;
+ o.datatype = "list(or(cidr,host,network,ipaddr))";
+ reply.interfaces.forEach((element) => {
+ element === "ignore" || o.value(element);
+ });
+
+ s = m.section(
form.NamedSection,
"config",
pkg.Name,
diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js b/applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js
index 536c3983c3..b0654976b3 100644
--- a/applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js
+++ b/applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js
@@ -2,27 +2,15 @@
"require rpc";
"require form";
"require baseclass";
+"require pbr.status as pbr";
-var pkg = {
- get Name() {
- return "pbr";
- },
- get URL() {
- return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
- },
-};
-
-var getInitStatus = rpc.declare({
- object: "luci." + pkg.Name,
- method: "getInitStatus",
- params: ["name"],
-});
+var pkg = pbr.pkg;
return baseclass.extend({
title: _("Policy Based Routing"),
load: function () {
- return Promise.all([getInitStatus(pkg.Name)]);
+ return Promise.all([pbr.getInitStatus(pkg.Name)]);
},
render: function (data) {