Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.05] luci-app-pbr: prepare migration to APK #7017

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/luci-app-pbr/Makefile
Expand Up @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk

PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
PKG_VERSION:=1.1.1-7
PKG_VERSION:=1.1.4-r7

LUCI_TITLE:=Policy Based Routing Service Web UI
LUCI_DESCRIPTION:=Provides Web UI for Policy Based Routing Service.
Expand Down
40 changes: 21 additions & 19 deletions applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr
Expand Up @@ -82,10 +82,7 @@ get_init_status() {
local name
name="$(basename "$1")"
name="${name:-$packageName}"
local version gateways warnings errors
[ -z "$version" ] && version="$(get_version "$name")"
[ -z "$version" ] && version="$(get_version "${name}-iptables")"
[ -z "$version" ] && version="$(get_version "${name}-netifd")"
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)"
Expand All @@ -107,7 +104,12 @@ get_init_status() {
else
json_add_boolean 'running_nft' '0'
fi
json_add_string 'version' "$version"
if is_running_nft_file "$packageName"; then
json_add_boolean 'running_nft_file' '1'
else
json_add_boolean 'running_nft_file' '0'
fi
json_add_string 'version' "$PKG_VERSION"
json_add_string 'gateways' "$gateways"
json_add_array 'errors'
if [ -n "$errors" ]; then
Expand Down Expand Up @@ -146,12 +148,12 @@ EOF
$(echo "$warnings" | tr \# \\n)
EOF
fi
if is_greater "$(opkg_get_version "${name}")" "$(opkg_get_version "luci-app-${name}")"; then
json_add_object
json_add_string 'id' 'warningOutdatedWebUIApp'
json_add_string 'extra' "$(opkg_get_version "luci-app-${name}")"
json_close_object
fi
# if is_greater "$(opkg_get_version "${name}")" "$(opkg_get_version "luci-app-${name}")"; then
# json_add_object
# json_add_string 'id' 'warningOutdatedWebUIApp'
# json_add_string 'extra' "$(opkg_get_version "luci-app-${name}")"
# json_close_object
# fi
json_close_array
json_close_object
json_dump
Expand Down Expand Up @@ -285,23 +287,23 @@ _find_firewall_wan_zone() { [ "$(uci -q get "firewall.${1}.name")" = "wan" ] &&
_build_ifaces_all() { ifacesAll="${ifacesAll}${1} "; }
_build_ifaces_supported() { is_supported_interface "$1" && ! str_contains "$ifacesSupported" "$1" && ifacesSupported="${ifacesSupported}${1} "; }
get_supported_interfaces() {
local name i
name="$(basename "$1")"
name="${name:-$packageName}"
_build_ifaces_supported() { is_supported_interface "$1" && ! str_contains "$ifacesSupported" "$1" && ifacesSupported="${ifacesSupported}${1} "; }
_find_firewall_wan_zone() { [ "$(uci_get 'firewall' "$1" 'name')" = "wan" ] && firewallWanZone="$1"; }
local i
local firewallWanZone
local ifacesAll ifacesSupported
local ifacesSupported
local webui_show_ignore_target
local ignored_interface supported_interface
local wanIface4 wanIface6
config_load "$packageName"
config_get_bool webui_show_ignore_target 'config' 'webui_show_ignore_target' '0'
config_get ignored_interface 'config' 'ignored_interface'
config_get supported_interface 'config' 'supported_interface'
config_get procd_wan_interface 'config' 'procd_wan_interface' 'wan'
config_get procd_wan6_interface 'config' 'procd_wan6_interface' 'wan6'
local i
config_load 'network'
config_foreach _build_ifaces_all 'interface'
pbr_find_iface wanIface4 'wan'
pbr_find_iface wanIface6 'wan6'
wanIface4="$procd_wan_interface"
wanIface6="$procd_wan6_interface"
config_load 'firewall'
config_foreach _find_firewall_wan_zone 'zone'
for i in $(uci -q get "firewall.${firewallWanZone}.network"); do
Expand Down