Skip to content

Commit

Permalink
luci-mod-system: File Browser
Browse files Browse the repository at this point in the history
Add a File Browser based on the FileUpload CBI element.
It allows to browse files and directories on a router, delete and upload.
This already covers a basic needs.

Signed-off-by: Sergey Ponomarev <[email protected]>
  • Loading branch information
stokito committed Sep 21, 2023
1 parent e8351ef commit f2ed6f0
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';
'require view';
'require ui';
'require form';

var formData = {
files: {
root: null,
}
};

return view.extend({
render: function() {
var m, s, o;

m = new form.JSONMap(formData, _('File Browser'), '');

s = m.section(form.NamedSection, 'files', 'files');

o = s.option(form.FileUpload, 'root', '');
o.root_directory = '/';
o.browser = true;

return m.render();
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@
}
},


"admin/system/filebrowser": {
"title": "File Browser",
"order": 80,
"action": {
"type": "view",
"path": "system/filebrowser"
},
"depends": {
"acl": [ "luci-mod-system-filebrowser" ]
}
},

"admin/system/reboot": {
"title": "Reboot",
"order": 90,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,22 @@
}
},

"luci-mod-system-filebrowser": {
"description": "Grant access to File Browser",
"read": {
"cgi-io": [ "*" ],
"ubus": {
"file": [ "*" ]
}
},
"write": {
"cgi-io": [ "upload" ],
"ubus": {
"file": [ "*" ]
}
}
},

"luci-mod-system-reboot": {
"description": "Allow rebooting the device",
"write": {
Expand Down

0 comments on commit f2ed6f0

Please sign in to comment.