From 40c56ddd7797f9e916abe5443784b21ed9ba51cf Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 30 Jan 2020 12:08:35 +0100 Subject: luci-app-vnstat2: fully convert to client side rendering This converts the graph rendering to client side JavaScript and replaces the route registration with declarative JSON. Signed-off-by: Jo-Philipp Wich --- .../usr/share/luci/menu.d/luci-app-vnstat2.json | 33 ++++++++++++++++++++++ .../usr/share/rpcd/acl.d/luci-app-vnstat2.json | 7 +++++ 2 files changed, 40 insertions(+) create mode 100644 applications/luci-app-vnstat2/root/usr/share/luci/menu.d/luci-app-vnstat2.json (limited to 'applications/luci-app-vnstat2/root/usr/share') diff --git a/applications/luci-app-vnstat2/root/usr/share/luci/menu.d/luci-app-vnstat2.json b/applications/luci-app-vnstat2/root/usr/share/luci/menu.d/luci-app-vnstat2.json new file mode 100644 index 0000000000..0b3303c360 --- /dev/null +++ b/applications/luci-app-vnstat2/root/usr/share/luci/menu.d/luci-app-vnstat2.json @@ -0,0 +1,33 @@ +{ + "admin/status/vnstat2": { + "title": "vnStat Traffic Monitor", + "order": 90, + "action": { + "type": "firstchild" + }, + "depends": { + "fs": { + "/usr/bin/vnstat": "executable", + "/usr/bin/vnstati": "executable" + } + } + }, + + "admin/status/vnstat2/graphs": { + "title": "Graphs", + "order": 1, + "action": { + "type": "view", + "path": "vnstat2/graphs" + } + }, + + "admin/status/vnstat2/config": { + "title": "Configuration", + "order": 2, + "action": { + "type": "view", + "path": "vnstat2/config" + } + } +} diff --git a/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json b/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json index 58a2aa50c6..fb16f09c9a 100644 --- a/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json +++ b/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json @@ -1,6 +1,13 @@ { "luci-app-vnstat2": { "description": "Grant access to LuCI app vnstat2", + "read": { + "cgi-io": [ "exec" ], + "file": { + "/usr/bin/vnstat --json f 1": [ "exec" ], + "/usr/bin/vnstati -[5dhmsty] -i * -o -": [ "exec" ] + } + }, "write": { "file": { "/usr/bin/vnstat": [ "exec" ] -- cgit v1.2.3