luci-app-mosdns: print mosdns core version

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2024-08-15 12:48:08 +08:00
parent 5bd80872b9
commit 36ea52d10f
2 changed files with 14 additions and 3 deletions

View File

@ -37,6 +37,12 @@ function renderStatus(isRunning) {
} }
return view.extend({ return view.extend({
load: function() {
return Promise.all([
L.resolveDefault(fs.exec('/usr/bin/mosdns', ['version']), null),
]);
},
handleFlushCache: function (m, section_id, ev) { handleFlushCache: function (m, section_id, ev) {
return fs.exec('/usr/share/mosdns/mosdns.sh', ['flush']) return fs.exec('/usr/share/mosdns/mosdns.sh', ['flush'])
.then(function (lazy_cache) { .then(function (lazy_cache) {
@ -49,10 +55,14 @@ return view.extend({
}); });
}, },
render: function () { render: function (basic) {
var m, s, o; var m, s, o, v;
v = '';
m = new form.Map('mosdns', _('MosDNS'), if (basic[0] && basic[0].code === 0) {
v = basic[0].stdout.trim();
}
m = new form.Map('mosdns', _('MosDNS') + '&#160;' + v,
_('MosDNS is a plugin-based DNS forwarder/traffic splitter.')); _('MosDNS is a plugin-based DNS forwarder/traffic splitter.'));
s = m.section(form.TypedSection); s = m.section(form.TypedSection);

View File

@ -14,6 +14,7 @@
"/etc/mosdns/rule/redirect.txt": [ "read" ], "/etc/mosdns/rule/redirect.txt": [ "read" ],
"/etc/mosdns/rule/streaming.txt": [ "read" ], "/etc/mosdns/rule/streaming.txt": [ "read" ],
"/etc/mosdns/rule/whitelist.txt": [ "read" ], "/etc/mosdns/rule/whitelist.txt": [ "read" ],
"/usr/bin/mosdns": [ "exec" ],
"/usr/share/mosdns/mosdns.sh": [ "exec" ] "/usr/share/mosdns/mosdns.sh": [ "exec" ]
}, },
"ubus": { "ubus": {