import { cursor } from 'uci';
import { init_list, init_index, init_enabled, init_action, conntrack_list, process_list } from 'luci.sys';
+import { revision, branch } from 'luci.version';
import { statvfs } from 'luci.core';
import timezones from 'luci.zoneinfo';
}
const methods = {
+ getVersion: {
+ call: function(request) {
+ return { revision, branch };
+ }
+ },
+
getInitList: {
args: { name: 'name' },
call: function(request) {
'require fs';
'require rpc';
+var callLuciVersion = rpc.declare({
+ object: 'luci',
+ method: 'getVersion'
+});
+
var callSystemBoard = rpc.declare({
object: 'system',
method: 'board'
return Promise.all([
L.resolveDefault(callSystemBoard(), {}),
L.resolveDefault(callSystemInfo(), {}),
- fs.lines('/usr/lib/lua/luci/version.lua')
+ L.resolveDefault(callLuciVersion(), { revision: _('unknown version'), branch: 'LuCI' })
]);
},
systeminfo = data[1],
luciversion = data[2];
- luciversion = luciversion.filter(function(l) {
- return l.match(/^\s*(luciname|luciversion)\s*=/);
- }).map(function(l) {
- return l.replace(/^\s*\w+\s*=\s*['"]([^'"]+)['"].*$/, '$1');
- }).join(' ');
+ luciversion = luciversion.branch + ' ' + luciversion.revision;
var datestr = null;
"file": {
"/proc/sys/net/netfilter/nf_conntrack_count": [ "read" ],
"/proc/sys/net/netfilter/nf_conntrack_max": [ "read" ],
- "/usr/lib/lua/luci/version.lua": [ "read" ],
"/www/luci-static/resources/view/status/include": [ "list" ]
},
"ubus": {
+ "luci": [ "getVersion" ],
"file": [ "list", "read" ],
"system": [ "board", "info" ]
}