summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-pbr/htdocs/luci-static/resources
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-pbr/htdocs/luci-static/resources')
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js82
-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
3 files changed, 117 insertions, 57 deletions
diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
index 0367512836..184e1285b1 100644
--- a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
+++ b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
@@ -10,8 +10,25 @@ var pkg = {
get Name() {
return "pbr";
},
+ get ReadmeCompat() {
+ return "1.1.6-16";
+ },
get URL() {
- return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
+ return (
+ "https://docs.openwrt.melmac.net/" +
+ pkg.Name +
+ "/" +
+ (pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "")
+ );
+ },
+ get DonateURL() {
+ return (
+ "https://docs.openwrt.melmac.net/" +
+ pkg.Name +
+ "/" +
+ (pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "") +
+ "#Donate"
+ );
},
};
@@ -184,13 +201,21 @@ var status = baseclass.extend({
{ class: "cbi-value-title" },
_("Service Gateways")
);
- text = _(
- "The %s indicates default gateway. See the %sREADME%s for details."
- ).format(
- "<strong>✓</strong>",
- '<a href="' + pkg.URL + '#AWordAboutDefaultRouting" target="_blank">',
- "</a>"
- );
+ text =
+ _(
+ "The %s indicates default gateway. See the %sREADME%s for details."
+ ).format(
+ "<strong>✓</strong>",
+ '<a href="' +
+ pkg.URL +
+ '#AWordAboutDefaultRouting" target="_blank">',
+ "</a>"
+ ) +
+ "<br />" +
+ _("Please %sdonate%s to support development of this project.").format(
+ "<a href='" + pkg.DonateURL + "' target='_blank'>",
+ "</a>"
+ );
var gatewaysDescr = E("div", { class: "cbi-value-description" }, text);
var gatewaysText = E("div", {}, reply.gateways);
var gatewaysField = E("div", { class: "cbi-value-field" }, [
@@ -228,8 +253,11 @@ var status = baseclass.extend({
warningInvalidOVPNConfig: _(
"Invalid OpenVPN config for %s interface"
),
- warningOutdatedWebUIApp: _(
- "The WebUI application is outdated (version %s), please update it"
+ warningOutdatedLuciPackage: _(
+ "The WebUI application (luci-app-pbr) is outdated, please update it"
+ ),
+ warningOutdatedPrincipalPackage: _(
+ "The principal package (pbr) is outdated, please update it"
),
warningBadNftCallsInUserFile: _(
"Incompatible nft calls detected in user include file, disabling fw4 nft file support."
@@ -310,6 +338,10 @@ var status = baseclass.extend({
"Policy '%s' has no source/destination parameters"
),
errorPolicyNoInterface: _("Policy '%s' has no assigned interface"),
+ errorPolicyNoDns: _("Policy '%s' has no assigned DNS"),
+ errorPolicyProcessNoInterfaceDns: _(
+ "Interface '%s' has no assigned DNS"
+ ),
errorPolicyUnknownInterface: _(
"Policy '%s' has an unknown interface"
),
@@ -380,9 +412,9 @@ var status = baseclass.extend({
text += _("Unknown error!") + "<br />";
}
});
- text += _("Errors encountered, please check the %sREADME%s!").format(
+ text += _("Errors encountered, please check the %sREADME%s").format(
'<a href="' + pkg.URL + '" target="_blank">',
- "</a><br />"
+ "</a>!<br />"
);
var errorsText = E("div", {}, text);
var errorsField = E("div", { class: "cbi-value-field" }, errorsText);
@@ -534,6 +566,29 @@ var status = baseclass.extend({
var buttonsDiv = reply.version
? E("div", { class: "cbi-value" }, [buttonsTitle, buttonsField])
: "";
+
+ var donateTitle = E(
+ "label",
+ { class: "cbi-value-title" },
+ _("Donate to the Project")
+ );
+ var donateText = E(
+ "div",
+ { class: "cbi-value-field" },
+ E(
+ "div",
+ { class: "cbi-value-description" },
+ _("Please %sdonate%s to support development of this project.").format(
+ "<a href='" + pkg.DonateURL + "' target='_blank'>",
+ "</a>"
+ )
+ )
+ );
+
+ var donateDiv = reply.version
+ ? E("div", { class: "cbi-value" }, [donateTitle, donateText])
+ : "";
+
return E("div", {}, [
header,
statusDiv,
@@ -541,6 +596,7 @@ var status = baseclass.extend({
warningsDiv,
errorsDiv,
buttonsDiv,
+ // donateDiv,
]);
});
},
@@ -553,6 +609,8 @@ RPC.on("setInitAction", function (reply) {
return L.Class.extend({
status: status,
+ pkg: pkg,
+ getInitStatus: getInitStatus,
getInterfaces: getInterfaces,
getPlatformSupport: getPlatformSupport,
});
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) {