Hello,
I am trying to add a button to LuCI in OpenWrt for direct downloading of logs and implement its functionality. I found some reference material in flash.js
and other questions on the forum. However, I am encountering an issue where I receive the message “Access to path denied by ACL” and it does not work.
This is the code I am working with, located in
*/www/luci-static/resources/view/system/flash.js*
:
...
o = ss.option(form.Button, 'dl_download', _('Download log')); o.inputstyle = 'action important'; o.inputtitle = _('Download log...'); o.onclick = L.bind(this.handleDownloadLogConfirm, this);
...
handleDownloadLogConfirm: function (ev) {
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': rpc.getSessionID() }),
E('input', { 'type': 'hidden', 'name': 'path', 'value': '/logs/router_log.gz' }),
E('input', { 'type': 'hidden', 'name': 'filename', 'value': 'router_log.gz' })
]);
ev.target.parentNode.appendChild(form);
form.submit();
form.parentNode.removeChild(form);
},
...
*I'm not sure what "dl_download" refers to; in the case of backup, it's "dl_backup", so I wrote this code based on that assumption.
The file exists in the path. (/logs/router_log.gz)
I wondered if the path was the problem, so I also granted permission to the path.
I also tested it by putting the file in the tmp folder, but it still doesn't work.
It says “Access to path denied by ACL”.
Please teach me how to download files from luci.
Waiting for help.