From: Dirk Brenken Date: Wed, 22 Oct 2025 19:02:44 +0000 (+0200) Subject: luci-app-travelmate: sync with update 2.2.1-3 X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=8c07e199e1b71bf6b47c652015a333f8a9ce2b52;p=project%2Fluci.git luci-app-travelmate: sync with update 2.2.1-3 Signed-off-by: Dirk Brenken --- diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js index fc9323aa14..425ab03895 100644 --- a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js +++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logread.js @@ -1,4 +1,4 @@ 'use strict'; -'require tools.views as views'; +'require view.travelmate.logtemplate as LogTemplate'; -return views.LogreadBox("trm-", "travelmate"); +return LogTemplate.Logview('trm-', 'travelmate'); diff --git a/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logtemplate.js b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logtemplate.js new file mode 100644 index 0000000000..23a8fbebe7 --- /dev/null +++ b/applications/luci-app-travelmate/htdocs/luci-static/resources/view/travelmate/logtemplate.js @@ -0,0 +1,48 @@ +'use strict'; +'require fs'; + +function Logview(logtag, name) { + return L.view.extend({ + load: function() { + return Promise.all([ + L.resolveDefault(fs.stat('/sbin/logread'), null), + L.resolveDefault(fs.stat('/usr/sbin/logread'), null) + ]); + }, + + render: function(stat) { + let logger = stat[0]?.path || stat[1]?.path || null; + + if (!logger) { + return E('div', { class: 'error' }, _('logread not found on system.')); + } + L.Poll.add(function() { + return L.resolveDefault(fs.exec_direct(logger, ['-e', logtag])).then(function(res) { + var log = document.getElementById('logfile'); + if (log) { + log.value = res ? res.trim() : _('No %s related logs yet!').format(name); + log.scrollTop = log.scrollHeight; + } + }); + }); + return E('div', { class: 'cbi-map' }, [ + E('div', { class: 'cbi-section' }, [ + E('div', { class: 'cbi-section-descr' }, _('The syslog output, pre-filtered for messages related to: %s').format(name)), + E('textarea', { + id: 'logfile', + style: 'min-height: 500px; max-height: 90vh; width: 100%; padding: 5px; font-family: monospace; resize: vertical;', + readonly: 'readonly', + wrap: 'off' + }) + ]) + ]); + }, + handleSaveApply: null, + handleSave: null, + handleReset: null + }); +} + +return L.Class.extend({ + Logview: Logview +}); diff --git a/applications/luci-app-travelmate/root/usr/share/rpcd/acl.d/luci-app-travelmate.json b/applications/luci-app-travelmate/root/usr/share/rpcd/acl.d/luci-app-travelmate.json index c15c0b8f39..35fe60aeb9 100644 --- a/applications/luci-app-travelmate/root/usr/share/rpcd/acl.d/luci-app-travelmate.json +++ b/applications/luci-app-travelmate/root/usr/share/rpcd/acl.d/luci-app-travelmate.json @@ -15,15 +15,14 @@ "/var/run/travelmate.scan": [ "read" ], "/var/state/travelmate.refresh": [ "read" ], "/tmp/trm_runtime.json": [ "read" ], + "/sbin/logread -e trm-": [ "exec" ], + "/usr/sbin/logread -e trm-": [ "exec" ], "/sbin/ifup *": [ "exec" ], "/etc/init.d/travelmate start" : [ "exec" ], "/etc/init.d/travelmate stop" : [ "exec" ], "/etc/init.d/travelmate setup [0-9a-z_]* [0-9a-z_]* [0-9]*" : [ "exec" ], "/etc/init.d/travelmate scan radio[0-1]" : [ "exec" ] }, - "ubus": { - "log": [ "read" ] - }, "uci": [ "travelmate", "wireless" ] } }