mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 09:32:34 +00:00
luci-mod-ucentral: add diagnostic download button
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -20,7 +20,6 @@ var callReboot = rpc.declare({
|
||||
expect: { result: 0 }
|
||||
});
|
||||
|
||||
|
||||
var mapdata = { actions: {}, config: {} };
|
||||
|
||||
return view.extend({
|
||||
@@ -45,6 +44,26 @@ return view.extend({
|
||||
ui.awaitReconnect('192.168.1.1', 'openwrt.lan');
|
||||
},
|
||||
|
||||
handleDiagnostics: function(ev) {
|
||||
return fs.exec('/sbin/diagnostic-bundle').then(function(result) {
|
||||
var form = E('form', {
|
||||
method: 'post',
|
||||
action: L.env.cgi_base + '/cgi-download',
|
||||
enctype: 'application/x-www-form-urlencoded'
|
||||
}, [
|
||||
E('input', { 'type': 'hidden', 'name': 'sessionid', 'value': L.env.sessionid }),
|
||||
E('input', { 'type': 'hidden', 'name': 'path', 'value': '/tmp/bundle.maverick.tar.gz' }),
|
||||
E('input', { 'type': 'hidden', 'name': 'filename', 'value': 'bundle.maverick.tar.gz' }),
|
||||
E('input', { 'type': 'hidden', 'name': 'mimetype', 'value': 'application/gzip' })
|
||||
]);
|
||||
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.submit();
|
||||
form.parentNode.removeChild(form);
|
||||
});
|
||||
},
|
||||
|
||||
handleSysupgrade: function(ev) {
|
||||
return ui.uploadFile('/tmp/firmware.bin', ev.target.firstChild)
|
||||
.then(L.bind(function(btn, reply) {
|
||||
@@ -171,6 +190,16 @@ return view.extend({
|
||||
o.inputtitle = _('Flash image…');
|
||||
o.onclick = L.bind(this.handleSysupgrade, this);
|
||||
|
||||
o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Diagnostic bundle'),
|
||||
_('Download the default diagnostic bundle from the AP.'));
|
||||
|
||||
ss = o.subsection;
|
||||
|
||||
o = ss.option(form.Button, 'Diagnostic');
|
||||
o.inputstyle = 'action important';
|
||||
o.inputtitle = _('Download Diagnostics');
|
||||
o.onclick = L.bind(this.handleDiagnostics, this);
|
||||
|
||||
|
||||
return m.render();
|
||||
},
|
||||
|
||||
@@ -5,4 +5,4 @@ let bundle = require('bundle');
|
||||
bundle.init('maverick');
|
||||
include('/usr/share/ucentral/diagnostic.uc', { bundle });
|
||||
bundle.complete();
|
||||
system('ln -s /tmp/bundle.maverick.tar.gz /www');
|
||||
system('chmod +r /tmp/bundle.maverick.tar.gz');
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
"luci-mod-ucentral": {
|
||||
"description": "Grant access to ucentral configuration",
|
||||
"read": {
|
||||
"cgi-io": [ "download" ],
|
||||
"file": {
|
||||
"/etc/ucentral/profile.json": [ "read" ],
|
||||
"/proc/mounts": [ "read" ],
|
||||
"/proc/mtd": [ "read" ]
|
||||
"/proc/mtd": [ "read" ],
|
||||
"/tmp/bundle.maverick.tar.gz": [ "read" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "read" ],
|
||||
@@ -17,6 +19,7 @@
|
||||
"file": {
|
||||
"/etc/ucentral/profile.json": [ "write" ],
|
||||
"/sbin/certupdate": [ "exec" ],
|
||||
"/sbin/diagnostic-bundle": [ "exec" ],
|
||||
"/sbin/firstboot -r -y": [ "exec" ],
|
||||
"/sbin/profileupdate": [ "exec" ],
|
||||
"/sbin/sysupgrade -n /tmp/firmware.bin": [ "exec" ],
|
||||
|
||||
Reference in New Issue
Block a user