luci-app-pbr: sync with principal package

Signed-off-by: Stan Grishin <stangri@melmac.ca>
This commit is contained in:
Stan Grishin
2025-08-01 01:40:51 +00:00
parent b7c08475e7
commit 6b4d69723c
6 changed files with 241 additions and 239 deletions

View File

@@ -1,5 +1,5 @@
# Copyright 2017-2024 MOSSDeF, Stan Grishin (stangri@melmac.ca).
# This is free software, licensed under AGPL-3.0-or-later.
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright 2017-2025 MOSSDeF, Stan Grishin (stangri@melmac.ca).
include $(TOPDIR)/rules.mk
@@ -7,7 +7,7 @@ PKG_NAME:=luci-app-pbr
PKG_LICENSE:=AGPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
PKG_VERSION:=1.1.8
PKG_RELEASE:=10
PKG_RELEASE:=32
LUCI_TITLE:=Policy Based Routing Service Web UI
LUCI_URL:=https://github.com/stangri/luci-app-pbr/

View File

@@ -1,3 +1,19 @@
# README
# LuCI App for pbr
Documentation for this project is available at [https://docs.openwrt.melmac.net/pbr/](https://docs.openwrt.melmac.net/pbr/).
[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org)
[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/pbr/)
[![License](https://img.shields.io/badge/License-GPL--3.0-lightgrey)](https://github.com/stangri/luci-app-pbr/blob/master/LICENSE)
LuCI interface for the `pbr` (policy-based routing) package.
Provides a visual way to manage traffic policies for routing over specific WAN or VPN interfaces.
## Highlights
- Intuitive Web UI with policy table
- Add/edit/delete rules by IP, port, MAC, domain
- Interface-specific status panel and logs
- Quick toggles for services and resolver settings
- Integrated with OpenWrts service management
**Full documentation:**
[https://docs.openwrt.melmac.ca/pbr/](https://docs.openwrt.melmac.ca/pbr/)

View File

@@ -10,12 +10,15 @@ var pkg = {
get Name() {
return "pbr";
},
get LuciCompat() {
return 14;
},
get ReadmeCompat() {
return "1.1.8";
},
get URL() {
return (
"https://docs.openwrt.melmac.net/" +
"https://docs.openwrt.melmac.ca/" +
pkg.Name +
"/" +
(pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "")
@@ -23,13 +26,24 @@ var pkg = {
},
get DonateURL() {
return (
"https://docs.openwrt.melmac.net/" +
"https://docs.openwrt.melmac.ca/" +
pkg.Name +
"/" +
(pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "") +
"#Donate"
);
},
isVersionMismatch: function (luci, pkg, rpcd) {
return luci !== pkg || pkg !== rpcd || luci !== rpcd;
},
formatMessage: function (info, template) {
if (!template) return _("Unknown message") + "<br />";
return (
(Array.isArray(info)
? template.format(...info)
: template.format(info || " ")) + "<br />"
);
},
};
var getGateways = rpc.declare({
@@ -62,6 +76,12 @@ var getPlatformSupport = rpc.declare({
params: ["name"],
});
var getUbusInfo = rpc.declare({
object: "luci." + pkg.Name,
method: "getUbusInfo",
params: ["name"],
});
var _setInitAction = rpc.declare({
object: "luci." + pkg.Name,
method: "setInitAction",
@@ -87,41 +107,6 @@ var RPC = {
}
});
},
getInitList: function (name) {
getInitList(name).then(
function (result) {
this.emit("getInitList", result);
}.bind(this)
);
},
getInitStatus: function (name) {
getInitStatus(name).then(
function (result) {
this.emit("getInitStatus", result);
}.bind(this)
);
},
getGateways: function (name) {
getGateways(name).then(
function (result) {
this.emit("getGateways", result);
}.bind(this)
);
},
getPlatformSupport: function (name) {
getPlatformSupport(name).then(
function (result) {
this.emit("getPlatformSupport", result);
}.bind(this)
);
},
getInterfaces: function (name) {
getInterfaces(name).then(
function (result) {
this.emit("getInterfaces", result);
}.bind(this)
);
},
setInitAction: function (name, action) {
_setInitAction(name, action).then(
function (result) {
@@ -135,17 +120,10 @@ var status = baseclass.extend({
render: function () {
return Promise.all([
L.resolveDefault(getInitStatus(pkg.Name), {}),
// L.resolveDefault(getGateways(pkg.Name), {}),
L.resolveDefault(getUbusInfo(pkg.Name), {}),
]).then(function (data) {
// var replyStatus = data[0];
// var replyGateways = data[1];
var reply;
var text;
if (data[0] && data[0][pkg.Name]) {
reply = data[0][pkg.Name];
} else {
reply = {
var reply = {
status: data[0]?.[pkg.Name] || {
enabled: null,
running: null,
running_iptables: null,
@@ -153,32 +131,59 @@ var status = baseclass.extend({
running_nft_file: null,
version: null,
gateways: null,
packageCompat: 0,
rpcdCompat: 0,
},
ubus: data[1]?.[pkg.Name]?.instances?.main?.data || {
packageCompat: 0,
errors: [],
warnings: [],
},
};
if (
pkg.isVersionMismatch(
pkg.LuciCompat,
reply.status.packageCompat,
reply.status.rpcdCompat
)
) {
reply.ubus.warnings.push({
code: "warningInternalVersionMismatch",
info: [
reply.ubus.packageCompat,
pkg.LuciCompat,
reply.status.rpcdCompat,
'<a href="' +
pkg.URL +
'#Warning:InternalVersionMismatch" target="_blank">',
"</a>",
],
});
}
var text;
var header = E("h2", {}, _("Policy Based Routing - Status"));
var statusTitle = E(
"label",
{ class: "cbi-value-title" },
_("Service Status")
);
if (reply.version) {
text = _("Version %s").format(reply.version) + " - ";
if (reply.running) {
if (reply.status.version) {
text = _("Version %s").format(reply.status.version) + " - ";
if (reply.status.running) {
text += _("Running");
if (reply.running_iptables) {
if (reply.status.running_iptables) {
text += " (" + _("iptables mode") + ").";
} else if (reply.running_nft_file) {
} else if (reply.status.running_nft_file) {
text += " (" + _("fw4 nft file mode") + ").";
} else if (reply.running_nft) {
} else if (reply.status.running_nft) {
text += " (" + _("nft mode") + ").";
} else {
text += ".";
}
} else {
if (reply.enabled) {
if (reply.status.enabled) {
text += _("Stopped.");
} else {
text += _("Stopped (Disabled).");
@@ -195,7 +200,7 @@ var status = baseclass.extend({
]);
var gatewaysDiv = [];
if (reply.gateways) {
if (reply.status.gateways) {
var gatewaysTitle = E(
"label",
{ class: "cbi-value-title" },
@@ -217,7 +222,7 @@ var status = baseclass.extend({
"</a>"
);
var gatewaysDescr = E("div", { class: "cbi-value-description" }, text);
var gatewaysText = E("div", {}, reply.gateways);
var gatewaysText = E("div", {}, reply.status.gateways);
var gatewaysField = E("div", { class: "cbi-value-field" }, [
gatewaysText,
gatewaysDescr,
@@ -229,8 +234,11 @@ var status = baseclass.extend({
}
var warningsDiv = [];
if (reply.warnings && reply.warnings.length) {
var textLabelsTable = {
if (reply.ubus.warnings && reply.ubus.warnings.length) {
var warningTable = {
warningInternalVersionMismatch: _(
"Internal version mismatch (package: %s, luci app: %s, luci rpcd: %s), you may need to update packages or reboot the device, please check the %sREADME%s."
),
warningResolverNotSupported: _(
"Resolver set (%s) is not supported on this system."
).format(L.uci.get(pkg.Name, "config", "resolver_set")),
@@ -283,14 +291,9 @@ var status = baseclass.extend({
_("Service Warnings")
);
var text = "";
reply.warnings.forEach((element) => {
if (element.id && textLabelsTable[element.id]) {
if (element.id !== "warningPolicyProcessCMD") {
text +=
(textLabelsTable[element.id] + ".").format(
element.extra || " "
) + "<br />";
}
reply.ubus.warnings.forEach((element) => {
if (element.code && warningTable[element.code]) {
text += pkg.formatMessage(element.info, warningTable[element.code]);
} else {
text += _("Unknown warning") + "<br />";
}
@@ -308,8 +311,8 @@ var status = baseclass.extend({
}
var errorsDiv = [];
if (reply.errors && reply.errors.length) {
var textLabelsTable = {
if (reply.ubus.errors && reply.ubus.errors.length) {
var errorTable = {
errorConfigValidation: _("Config (%s) validation failure").format(
"/etc/config/" + pkg.Name
),
@@ -333,7 +336,7 @@ var status = baseclass.extend({
"The %s interface not found, you need to set the 'pbr.config.procd_wan_interface' option"
),
errorNoWanInterfaceHint: _(
"Refer to https://docs.openwrt.melmac.net/pbr/#procd_wan_interface"
"Refer to https://docs.openwrt.melmac.ca/pbr/#procd_wan_interface"
),
errorIpsetNameTooLong: _(
"The ipset name '%s' is longer than allowed 31 characters"
@@ -384,6 +387,7 @@ var status = baseclass.extend({
errorPolicyProcessInsertionFailedIpv4: _(
"Insertion failed for IPv4 for policy '%s'"
),
errorPolicyProcessUnknownEntry: _("Unknown entry in policy '%s'"),
errorInterfaceRoutingEmptyValues: _(
"Received empty tid/mark or interface name when setting up routing"
),
@@ -419,16 +423,11 @@ var status = baseclass.extend({
_("Service Errors")
);
var text = "";
reply.errors.forEach((element) => {
if (element.id && textLabelsTable[element.id]) {
if (element.id !== "errorPolicyProcessCMD") {
text +=
(textLabelsTable[element.id] + "!").format(
element.extra || " "
) + "<br />";
}
reply.ubus.errors.forEach((element) => {
if (element.code && errorTable[element.code]) {
text += pkg.formatMessage(element.info, errorTable[element.code]);
} else {
text += _("Unknown error!") + "<br />";
text += _("Unknown error") + "<br />";
}
});
text += _("Errors encountered, please check the %sREADME%s").format(
@@ -545,10 +544,10 @@ var status = baseclass.extend({
_("Disable")
);
if (reply.enabled) {
if (reply.status.enabled) {
btn_enable.disabled = true;
btn_disable.disabled = false;
if (reply.running) {
if (reply.status.running) {
btn_start.disabled = true;
btn_action.disabled = false;
btn_stop.disabled = false;
@@ -582,7 +581,7 @@ var status = baseclass.extend({
btn_disable,
]);
var buttonsField = E("div", { class: "cbi-value-field" }, buttonsText);
var buttonsDiv = reply.version
var buttonsDiv = reply.status.version
? E("div", { class: "cbi-value" }, [buttonsTitle, buttonsField])
: "";
@@ -604,7 +603,7 @@ var status = baseclass.extend({
)
);
var donateDiv = reply.version
var donateDiv = reply.status.version
? E("div", { class: "cbi-value" }, [donateTitle, donateText])
: "";
@@ -632,4 +631,5 @@ return L.Class.extend({
getInitStatus: getInitStatus,
getInterfaces: getInterfaces,
getPlatformSupport: getPlatformSupport,
getUbusInfo: getUbusInfo,
});

View File

@@ -1,12 +1,12 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:240
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:358
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:248
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:361
msgid "%s"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:316
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:319
msgid "%s binary cannot be found"
msgstr ""
@@ -67,7 +67,7 @@ msgstr ""
msgid "Chain"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:405
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:409
msgid "Command failed: '%s'"
msgstr ""
@@ -75,7 +75,7 @@ msgstr ""
msgid "Condensed output"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:313
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:316
msgid "Config (%s) validation failure"
msgstr ""
@@ -87,7 +87,7 @@ msgstr ""
msgid "Custom User File Includes"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:361
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:364
msgid "Custom user file '%s' not found or empty"
msgstr ""
@@ -107,15 +107,15 @@ msgstr ""
msgid "Default ICMP Interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:410
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:414
msgid "Default fw4 chain '%s' is missing"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:409
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:413
msgid "Default fw4 table '%s' is missing"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:545
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:544
msgid "Disable"
msgstr ""
@@ -125,7 +125,7 @@ msgstr ""
msgid "Disabled"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:539
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:538
msgid "Disabling %s service"
msgstr ""
@@ -133,7 +133,7 @@ msgstr ""
msgid "Display these protocols in protocol column in Web UI."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:266
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:274
msgid ""
"Dnsmasq instance (%s) targeted in settings, but it doesn't have its own "
"confdir"
@@ -151,11 +151,11 @@ msgstr ""
msgid "Do not enforce policies when their gateway is down"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:592
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:591
msgid "Donate to the Project"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:526
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:525
msgid "Enable"
msgstr ""
@@ -167,15 +167,15 @@ msgstr ""
msgid "Enabled"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:520
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:519
msgid "Enabling %s service"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:363
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:366
msgid "Error running custom user file '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:434
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:433
msgid "Errors encountered, please check the %sREADME%s"
msgstr ""
@@ -185,31 +185,31 @@ msgid ""
"QoS. Change with caution together with"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:401
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:405
msgid "Failed to download '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:399
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:403
msgid "Failed to download '%s', HTTPS is not supported"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:394
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:398
msgid "Failed to install fw4 nft file '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:360
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:363
msgid "Failed to reload '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:390
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:394
msgid "Failed to resolve '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:359
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:362
msgid "Failed to set up '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:367
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:370
msgid "Failed to set up any gateway"
msgstr ""
@@ -237,11 +237,11 @@ msgstr ""
msgid "Inactive (Disabled)"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:407
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:411
msgid "Incompatible custom user file detected '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:263
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:271
msgid ""
"Incompatible nft calls detected in user include file, disabling fw4 nft file "
"support"
@@ -251,15 +251,15 @@ msgstr ""
msgid "Insert"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:385
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:388
msgid "Insertion failed for IPv4 for policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:382
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:385
msgid "Insertion failed for both IPv4 and IPv6 for policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:238
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:246
msgid "Installed AdGuardHome (%s) doesn't support 'ipset_file' option."
msgstr ""
@@ -267,15 +267,22 @@ msgstr ""
msgid "Interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:353
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:356
msgid "Interface '%s' has no assigned DNS"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:254
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:240
msgid ""
"Internal version mismatch (package: %s, luci app: %s, luci rpcd: %s), you "
"may need to update packages or reboot the device, please check the "
"%sREADME%s."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:262
msgid "Invalid OpenVPN config for %s interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:392
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:396
msgid "Invalid OpenVPN config for '%s' interface"
msgstr ""
@@ -288,7 +295,7 @@ msgstr ""
msgid "Local ports"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:376
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:379
msgid "Mismatched IP family between in policy '%s'"
msgstr ""
@@ -320,7 +327,7 @@ msgstr ""
msgid "No Change"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:188
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:193
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js:58
msgid "Not installed or not found"
msgstr ""
@@ -333,8 +340,8 @@ msgstr ""
msgid "Path"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:215
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:600
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:220
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:599
msgid "Please %sdonate%s to support development of this project."
msgstr ""
@@ -342,24 +349,24 @@ msgstr ""
msgid "Please check the %sREADME%s before changing this option."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:270
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:278
msgid ""
"Please set 'dhcp.%%s.force=1' to speed up service start-up %s(more info)%s"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:248
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:256
msgid "Please unset 'chain' or set 'chain' to 'PREROUTING' for policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:251
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:259
msgid "Please unset 'chain' or set 'chain' to 'prerouting' for policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:245
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:253
msgid "Please unset 'proto' or set 'proto' to 'all' for policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:242
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:250
msgid "Please unset 'src_addr', 'src_port' and 'dest_port' for policy '%s'"
msgstr ""
@@ -367,23 +374,23 @@ msgstr ""
msgid "Policies"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:356
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:359
msgid "Policy '%s' has an unknown interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:351
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:354
msgid "Policy '%s' has no assigned DNS"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:350
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:353
msgid "Policy '%s' has no assigned interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:348
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:351
msgid "Policy '%s' has no source/destination parameters"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:396
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:400
msgid ""
"Policy '%s' refers to URL which can't be downloaded in 'secure_reload' mode"
msgstr ""
@@ -396,7 +403,7 @@ msgstr ""
msgid "Policy Based Routing - Configuration"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:161
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:166
msgid "Policy Based Routing - Status"
msgstr ""
@@ -408,12 +415,12 @@ msgstr ""
msgid "Protocol"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:388
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:392
msgid "Received empty tid/mark or interface name when setting up routing"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:336
msgid "Refer to https://docs.openwrt.melmac.net/pbr/#procd_wan_interface"
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:339
msgid "Refer to https://docs.openwrt.melmac.ca/pbr/#procd_wan_interface"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:368
@@ -428,37 +435,37 @@ msgstr ""
msgid "Remote ports"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:411
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:415
msgid "Required binary '%s' is missing"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:368
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:371
msgid "Resolver '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:324
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:327
msgid "Resolver set (%s) is not supported on this system"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:235
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:243
msgid "Resolver set (%s) is not supported on this system."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:318
msgid ""
"Resolver set support (%s) requires ipset, but ipset binary cannot be found"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:321
msgid ""
"Resolver set support (%s) requires ipset, but ipset binary cannot be found"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:324
msgid ""
"Resolver set support (%s) requires nftables, but nft binary cannot be found"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:488
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:487
msgid "Restart"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:482
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:481
msgid "Restarting %s service"
msgstr ""
@@ -472,7 +479,7 @@ msgid ""
"See the %sREADME%s for details."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:170
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:175
msgid "Running"
msgstr ""
@@ -484,11 +491,11 @@ msgstr ""
msgid "Select Add for -A/add and Insert for -I/Insert."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:571
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:570
msgid "Service Control"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:419
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:423
msgid "Service Errors"
msgstr ""
@@ -497,15 +504,15 @@ msgstr ""
msgid "Service FW Mask"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:202
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:207
msgid "Service Gateways"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:165
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:170
msgid "Service Status"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:283
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:291
msgid "Service Warnings"
msgstr ""
@@ -515,15 +522,15 @@ msgid ""
"%sREADME%s for details."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:370
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:373
msgid "Skipping IPv6 policy '%s' as IPv6 support is disabled"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:469
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:468
msgid "Start"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:463
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:462
msgid "Starting %s service"
msgstr ""
@@ -537,19 +544,19 @@ msgstr ""
msgid "Status"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:507
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:506
msgid "Stop"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:184
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:189
msgid "Stopped (Disabled)."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:182
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:187
msgid "Stopped."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:501
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:500
msgid "Stopping %s service"
msgstr ""
@@ -573,29 +580,29 @@ msgstr ""
msgid "Suppress/No output"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:362
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:365
msgid "Syntax error in custom user file '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:206
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:211
msgid "The %s indicates default gateway. See the %sREADME%s for details."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:333
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:336
msgid ""
"The %s interface not found, you need to set the "
"'pbr.config.procd_wan_interface' option"
"The %s interface not found, you need to set the 'pbr.config."
"procd_wan_interface' option"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:96
msgid "The %s is not supported on this system."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:330
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:333
msgid "The %s service failed to discover WAN gateway"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:327
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:330
msgid "The %s service is currently disabled"
msgstr ""
@@ -603,51 +610,59 @@ msgstr ""
msgid "The %s support is unknown."
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:257
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:265
msgid "The WebUI application (luci-app-pbr) is outdated, please update it"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:403
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:407
msgid "The file:// schema requires curl, but it's not detected on this system"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:339
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:342
msgid "The ipset name '%s' is longer than allowed 31 characters"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:342
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:345
msgid "The nft set name '%s' is longer than allowed 255 characters"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:260
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:268
msgid "The principal package (pbr) is outdated, please update it"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:345
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:348
msgid "Unexpected exit or service termination: '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:413
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:417
msgid "Unknown IPv6 Link type for device '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:431
msgid "Unknown error!"
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:390
msgid "Unknown entry in policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:373
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:430
msgid "Unknown error"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:40
msgid "Unknown message"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:376
msgid "Unknown packet mark for interface '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:379
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:382
msgid "Unknown protocol in policy '%s'"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:295
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:298
msgid "Unknown warning"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:365
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:368
msgid ""
"Use of 'curl' is detected in custom user file '%s', but 'curl' isn't "
"installed"
@@ -665,7 +680,7 @@ msgstr ""
msgid "Version"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:168
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:173
msgid "Version %s"
msgstr ""
@@ -682,17 +697,17 @@ msgstr ""
msgid "all"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:174
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:179
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js:44
msgid "fw4 nft file mode"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:172
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:177
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js:42
msgid "iptables mode"
msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:176
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:181
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/status/include/72_pbr.js:46
msgid "nft mode"
msgstr ""

View File

@@ -8,10 +8,11 @@
# ubus -S call luci.pbr getInitList '{"name": "pbr" }'
# ubus -S call luci.pbr getInitStatus '{"name": "pbr" }'
# ubus -S call luci.pbr getPlatformSupport '{"name": "pbr" }'
# ubus -S call luci.pbr getUbusInfo '{"name": "pbr" }'
# ubus -S call luci.pbr getGateways '{"name": "pbr" }'
# ubus -S call luci.pbr getInterfaces '{"name": "pbr" }'
readonly luciCompat='11'
readonly rpcdCompat='14'
readonly pbrFunctionsFile='/etc/init.d/pbr'
if [ -s "$pbrFunctionsFile" ]; then
# shellcheck source=../../../../../pbr/files/etc/init.d/pbr
@@ -22,7 +23,7 @@ else
fi
# compatibility with old luci app versions
is_running_iptables() { iptables -t mangle -L | grep -q PBR_PREROUTING >/dev/null 2>&1; }
is_running_iptables() { iptables -t mangle -n -L | grep -q PBR_PREROUTING >/dev/null 2>&1; }
is_running() { is_running_iptables || is_running_nft; }
check_ipset() { { [ -n "$ipset" ] && "$ipset" help hash:net; } >/dev/null 2>&1; }
check_agh_ipset() {
@@ -84,13 +85,10 @@ set_init_action() {
}
get_init_status() {
local name
local name gateways
name="$(basename "$1")"
name="${name:-$packageName}"
local gateways warnings errors
gateways="$(ubus_get_status gateways | sed "s|\\\n|<br />|g;s|\(\\\033[^<]*\)|✓|g;")"
warnings="$(ubus_get_status warnings)"
errors="$(ubus_get_status errors)"
json_init
json_add_object "$packageName"
json_add_boolean 'enabled' "$(is_enabled "$packageName")"
@@ -116,53 +114,8 @@ get_init_status() {
fi
json_add_string 'version' "$PKG_VERSION"
json_add_string 'gateways' "$gateways"
json_add_array 'errors'
if [ -n "$errors" ]; then
while read -r line; do
if str_contains "$line" ' '; then
error_id="${line% *}"
error_extra="${line#* }"
else
error_id="$line"
unset error_extra
fi
json_add_object
json_add_string 'id' "$error_id"
json_add_string 'extra' "$error_extra"
json_close_object
done <<EOF
$(echo "$errors" | tr \# \\n)
EOF
fi
json_close_array
json_add_array 'warnings'
if [ -n "$warnings" ]; then
while read -r line; do
if str_contains "$line" ' '; then
warning_id="${line% *}"
warning_extra="${line#* }"
else
warning_id="$line"
unset warning_extra
fi
json_add_object
json_add_string 'id' "$warning_id"
json_add_string 'extra' "$warning_extra"
json_close_object
done <<EOF
$(echo "$warnings" | tr \# \\n)
EOF
fi
if is_greater "${packageCompat:-0}" "${luciCompat:-0}"; then
json_add_object
json_add_string 'id' 'warningOutdatedLuciPackage'
json_close_object
elif is_greater "${luciCompat:-0}" "${packageCompat:-0}"; then
json_add_object
json_add_string 'id' 'warningOutdatedPrincipalPackage'
json_close_object
fi
json_close_array
json_add_int 'packageCompat' "${packageCompat:-0}"
json_add_int 'rpcdCompat' "${rpcdCompat:-0}"
json_close_object
json_dump
json_cleanup
@@ -268,6 +221,13 @@ get_supported_interfaces() {
json_cleanup
}
get_ubus_info() {
local name
name="$(basename "$1")"
name="${name:-$packageName}"
ubus call service list '{"name":"'"$name"'"}'
}
case "$1" in
list)
json_init
@@ -286,6 +246,9 @@ case "$1" in
json_add_object "getPlatformSupport"
json_add_string 'name' 'name'
json_close_object
json_add_object "getUbusInfo"
json_add_string 'name' 'name'
json_close_object
json_add_object "setInitAction"
json_add_string 'name' 'name'
json_add_string 'action' 'action'
@@ -330,6 +293,13 @@ case "$1" in
json_cleanup
get_platform_support "$packageName"
;;
getUbusInfo)
read -r input
json_load "$input"
json_get_var name 'name'
json_cleanup
get_ubus_info "$name"
;;
setInitAction)
read -r input
json_load "$input"

View File

@@ -8,7 +8,8 @@
"getInitList",
"getInitStatus",
"getInterfaces",
"getPlatformSupport"
"getPlatformSupport",
"getUbusInfo"
]
},
"file": {