diff --git a/luci-app-daede/Makefile b/luci-app-daede/Makefile index 80e693d4b..f6c18c31b 100644 --- a/luci-app-daede/Makefile +++ b/luci-app-daede/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-daede PKG_VERSION:=1.15 -PKG_RELEASE:=45 +PKG_RELEASE:=46 PKG_MAINTAINER:=kenzok8 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/luci-app-daede/htdocs/luci-static/resources/view/daede/log.js b/luci-app-daede/htdocs/luci-static/resources/view/daede/log.js index c39cd0b46..46c6c835b 100644 --- a/luci-app-daede/htdocs/luci-static/resources/view/daede/log.js +++ b/luci-app-daede/htdocs/luci-static/resources/view/daede/log.js @@ -295,7 +295,7 @@ return view.extend({ function applyFilter() { const f = state.filter; pane.querySelectorAll('.dd-line').forEach(function(el) { - if (matchesFilter(el.textContent, f)) + if (matchesFilter(el._rawLine, f)) el.classList.remove('dd-hidden'); else el.classList.add('dd-hidden'); @@ -309,6 +309,7 @@ return view.extend({ const ln = lines[i]; if (!ln) continue; const el = buildLine(ln); + el._rawLine = ln; if (!matchesFilter(ln, state.filter)) el.classList.add('dd-hidden'); frag.appendChild(el); diff --git a/luci-app-daede/htdocs/luci-static/resources/view/daede/updates.js b/luci-app-daede/htdocs/luci-static/resources/view/daede/updates.js index 20992cad9..4ece1ae5b 100644 --- a/luci-app-daede/htdocs/luci-static/resources/view/daede/updates.js +++ b/luci-app-daede/htdocs/luci-static/resources/view/daede/updates.js @@ -446,17 +446,19 @@ return view.extend({ healthBody.appendChild(mkRow('✓', 'dd-up-ok', _('Hot reload'), _('/etc/init.d/dae hot_reload is available'))); } - if (ctx.backend.useNetns && ns && ns.exists) { + if (ctx.backend.useNetns && ns && ns.exists && running[ctx.name]) { + healthBody.appendChild(mkRow('✓', 'dd-up-ok', _('netns daens'), HEALTH_PATHS.netns + ' · ' + _('in use by daed'))); + } else if (ctx.backend.useNetns && ns && ns.exists) { const btn = E('button', { 'class': 'dd-up-btn' }, _('Clean')); btn.addEventListener('click', function() { - const daedRunning = !!(running && running[ctx.name]); - const msg = daedRunning - ? _('%s is running. Deleting the daens netns now will break its networking until you restart it. Continue?').format(ctx.name) - : _('Delete the daens netns?'); - if (!confirm(msg)) - return; btn.disabled = true; - fs.exec('/sbin/ip', ['netns', 'del', 'daens']).finally(function() { btn.disabled = false; }); + backend.detectRunning().then(function(now) { + const msg = now[ctx.name] + ? _('%s is running. Deleting the daens netns now will break its networking until you restart it. Continue?').format(ctx.name) + : _('Delete the daens netns?'); + if (confirm(msg)) + return fs.exec('/sbin/ip', ['netns', 'del', 'daens']); + }).finally(function() { btn.disabled = false; }); }); healthBody.appendChild(mkRow('⚠', 'dd-up-warn', _('netns daens'), HEALTH_PATHS.netns + ' · ' + _('exists, may block daed start'), btn)); } else if (ctx.backend.useNetns) { diff --git a/luci-app-daede/po/zh-cn/daede.po b/luci-app-daede/po/zh-cn/daede.po index b4ec479c0..7d33bedaa 100644 --- a/luci-app-daede/po/zh-cn/daede.po +++ b/luci-app-daede/po/zh-cn/daede.po @@ -372,6 +372,9 @@ msgstr "dae 热重载可用" msgid "netns daens removed." msgstr "netns daens 已清理。" +msgid "in use by daed" +msgstr "daed 运行中,正在使用" + msgid "exists, may block daed start" msgstr "已存在,可能阻碍 daed 启动" diff --git a/luci-app-fwlive/Makefile b/luci-app-fwlive/Makefile index 1310aaabb..dc096c61b 100644 --- a/luci-app-fwlive/Makefile +++ b/luci-app-fwlive/Makefile @@ -12,7 +12,7 @@ LUCI_DEPENDS:=+luci-base +logd +jsonfilter LUCI_PKGARCH:=all PKG_VERSION:=0.1.45 -PKG_RELEASE:=37 +PKG_RELEASE:=38 # Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI). ifdef SOURCE_DATE_EPOCH diff --git a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/chips.js b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/chips.js index a48574b93..5bf346fb9 100644 --- a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/chips.js +++ b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/chips.js @@ -17,26 +17,9 @@ */ function chipFieldLabel(spec) { - switch (spec.key) { - case 'q': - return _('Search'); - case 'action': - return _('Action'); - case 'interface': - return _('Interface'); - case 'proto': - return _('Proto'); - case 'src': - return _('Source'); - case 'dst': - return _('Destination'); - case 'sport': - return _('Source port'); - case 'dport': - return _('Destination port'); - default: - return spec.label || spec.key; - } + const mapped = log.filterFieldLabel(spec.key); + if (mapped !== spec.key) return mapped; + return spec.label || spec.key; } function chipValueNodes(spec, val) { @@ -58,9 +41,7 @@ function chipValueNodes(spec, val) { if (key === 'q' || key === 'src' || key === 'dst') return [ label + ': ', - E('strong', { 'class': 'fwlive-chip-not' }, [_('not')]), - ' ', - _('contains'), + E('strong', { 'class': 'fwlive-chip-not' }, [_('does not contain')]), ' ', valueNode ]; diff --git a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/links.js b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/links.js index 84fe61157..c0133191e 100644 --- a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/links.js +++ b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/links.js @@ -60,7 +60,7 @@ function filterLink(field, value, label, onFilterClick) { { 'href': '#', 'class': 'fwlive-filter-link', - 'title': _('Filter by %s').format(field), + 'title': _('Filter by %s').format(log.filterFieldLabel(field)), 'click': function (ev) { onFilterClick(field, value, ev); } @@ -88,7 +88,7 @@ function addrFilterLink(field, ip, showHostnames, hostnameCache, onFilterClick) : hostnameCache.get(ip); } const display = name || ip; - const title = name ? ip : _('Filter by %s').format(field); + const title = name ? ip : _('Filter by %s').format(log.filterFieldLabel(field)); return E( 'a', @@ -153,7 +153,7 @@ function ifaceLink(value, onFilterClick) { { 'href': '#', 'class': 'fwlive-filter-link fwlive-iface-badge', - 'title': _('Filter by interface'), + 'title': _('Filter by %s').format(log.filterFieldLabel('interface')), 'click': function (ev) { onFilterClick('interface', value, ev); } diff --git a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js index 715981085..94f68e10d 100644 --- a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js +++ b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/log.js @@ -26,6 +26,8 @@ const CLASSIFY_SPEC = { 'PREC', 'DF' ], + /* Classify trim (not JS String#trim): ASCII space/tab/LF/CR + NBSP (U+00A0). */ + trimWhitespace: [' ', '\t', '\n', '\r', '\u00a0'], nonFirewallPrefixes: [ 'dnsmasq', 'procd', @@ -64,6 +66,15 @@ function wordPattern(words) { return new RegExp('(^|[^A-Za-z0-9_])(' + alt + ')([^A-Za-z0-9_]|$)', 'i'); } +function classifyTrim(s) { + const ws = CLASSIFY_SPEC.trimWhitespace; + let start = 0; + let end = s.length; + while (start < end && ws.indexOf(s.charAt(start)) >= 0) start++; + while (end > start && ws.indexOf(s.charAt(end - 1)) >= 0) end--; + return s.slice(start, end); +} + /* ---- spec-derived classification regexes (mirror core/fwlive-log.js) ---- */ const DENY_CLASS_WORDS = CLASSIFY_SPEC.actionWords.slice(3); const NON_FIREWALL_PREFIX = new RegExp( @@ -335,10 +346,25 @@ return baseclass.extend({ return m; }, + + filterFieldLabel: function (field) { + const labels = { + 'q': _('Search'), + 'action': _('Action'), + 'interface': _('Interface'), + 'proto': _('Proto'), + 'src': _('Source'), + 'dst': _('Destination'), + 'sport': _('Source port'), + 'dport': _('Destination port') + }; + + return labels[field] || field; + }, /* @fwlive-codegen:luci-preserve-end */ isFirewallEvent: function (entry) { - const msg = this.normalizeNetfilterMessage((entry && entry.msg) || '').trim(); + const msg = classifyTrim(this.normalizeNetfilterMessage((entry && entry.msg) || '')); if (!msg) return false; if (this.NON_FIREWALL_PREFIX.test(msg)) return false; diff --git a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/logging.js b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/logging.js index 864e2d5ac..961ec40b2 100644 --- a/luci-app-fwlive/htdocs/luci-static/resources/fwlive/logging.js +++ b/luci-app-fwlive/htdocs/luci-static/resources/fwlive/logging.js @@ -17,7 +17,7 @@ * * renderManualTestNodes(host, state, callbacks) → void * host -