Commit graph

388 commits

Author SHA1 Message Date
Jo-Philipp Wich
fd7961337f luci-base: dispatcher: remove empty firstchild nodes from menu
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-10 22:13:27 +01:00
Jo-Philipp Wich
38c9c9e0a2 luci-base: dispatcher: fix rpc controller regression
When testing the luci-rpc authnetication, avoid clobbering the HTTP
post request body.

Fixes: #3470
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-07 09:10:19 +01:00
Jo-Philipp Wich
09b2d8a8ac luci-base: move tools.webadmin to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 10:37:48 +01:00
Jo-Philipp Wich
6591b48f8e luci-base: drop unused tools.webadmin.proto class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 10:37:25 +01:00
Jo-Philipp Wich
16853bcd2e luci-base: convert menu nodes to JSON
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
cf1219bd07 luci-base: dispatcher.lua: add support for loading JSON menu files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
184ea62300 luci-base: dispatcher.lua: refactor dispatch logic
Refactor the dispatch logic to operate on the internal JSON representation
of the menu tree.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
1ec6e72106 luci-base: dispatcher.lua: factor out template class init into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
a6b214f873 luci-base: dispatcher.lua: factor out language check into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
97f27e0d54 luci-base: expose effective dispatched path to client side environment
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
852d24061d luci-base: dispatcher.lua: introduce dispatch tree JSON conversion
Introduce a new method menu_json() which converts the current dispatch
tree into JSON structure.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
d5dff8f9a5 treewide: move server side CBI support to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:49:31 +01:00
Jo-Philipp Wich
284918bfaf treewide: move templates and libraries not used by the core to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Jo-Philipp Wich
1b835a50aa luci-base: sys.lua: lazy-load luci.model.network
This allows using luci.sys without installed luci.model.network class.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-02 20:14:25 +01:00
Jo-Philipp Wich
790005cdfa luci-base: dispatcher.lua: support declarative node dependencies
Introduce two new properties for page nodes to allow for declaratively
specifiying system dependencies which is useful to e.g. make certain
views depend on specific uci values or the presence of certain files.

The recognized properties are:

 - `uci_depends` - a nested table in one of the following forms:

     1) `{ config = { section = { option = "exact_value" } }`
     2) `{ config = { section = { option = true } }`
     3) `{ config = { section = "exact_type" } }`
     4) `{ config = { section = true } }`
     5) `{ config = true }`

   Depending on the declaration, the uci option or section type must either
   match the given "exact_value" or "exact_type" values or be a non-nil value
   in case boolean "true" is specified.

 - `file_depends` - a flat lists of file paths that must be accessible

   If a path listed in `file_depends` points to a directory, that directory
   must be not empty, otherwise it suffices if the path exists.

Examples:

 - Only display the node if an /etc/config/wireless file exists with
   a "config wifi-device radio0" section.

    node = page(...)
    node.uci_depends = { wireless = { radio0 = "wifi-device" } }

 - Only display the node when swconfig is installed.

    node = page(...)
    node.file_depends = { "/sbin/swconfig" }

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
650d7f64d5 luci-base: remove unused Lua code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
f8c6eb67cd luci-base: fix CSRF prevention for arcombine targets
The dispatcher failed to propagate the child target post security
requirements to the arcombine() dispatch target so far - fix this
by recursively testing the post security requirements.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-09 09:55:44 +02:00
Hannu Nyman
cf887ba62f timezone data: update to 2019c
Update timezone data to 2019c

http://mm.icann.org/pipermail/tz-announce/2019-September/000057.html

2019c:
* Fiji observes DST from 2019-11-10 to 2020-01-12.
* Norfolk Island starts observing Australian-style DST.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-09-28 21:51:35 +03:00
Jo-Philipp Wich
2a5c5f47f9 luci-mod-system: reimplement flashops as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-24 14:21:08 +02:00
Jo-Philipp Wich
fad01ae1a4 luci-base: sys.lua: fix init script enable action
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 18:56:24 +02:00
Jo-Philipp Wich
cc81d5a0d4 luci-base: fix list method handling in ubus-rpc protocol proxy
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 14:00:47 +02:00
Jo-Philipp Wich
2cc6ff7f6b luci-base: drop unused tools.status.switch_status() call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 11:09:57 +02:00
Jo-Philipp Wich
34f2c0acdb luci-base: view.htm: catch and render exceptions on view instantiation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 12:21:51 +02:00
Jo-Philipp Wich
3f93650901 luci-base: use cgi-io and rpcd-mod-file to handle file upload and browsing
Remove the old server side support for file browsing and file uploading
and switch to a client side widget instead which uses XMLHTTPRequests to
upload files via cgi-io and RPC calls for file listing and status queries.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
06f4feca1d protocols: drop server side cbi implementations of protocol handlers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
acc2c8d277 luci-base: use native ubus-rpc authorization protocol
Instead of granting complete ubus access under the active sysauth session,
implement the ubus-rpc authorization mechanism and make the ubus proxy
endpoint unauthenticated.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-15 16:10:42 +02:00
Florian Eckert
d3e060ae6c luci-base: add vpn menu section
There is always more vpn services. To make the LuCI menu look cleaner, a
new top level menu "VPN" will be added with this commit. All luci-app-*
that have something to do with VPN should move to this new menu entry.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-08-06 16:20:17 +02:00
Jo-Philipp Wich
2d3470b700 luci-base: don't treat .rmempty flag as optional for ListValue widgets
Restore the old CBI behaviour of not automatically rendering empty
selection choices in ListValue select dropdowns when .rmempty is
specified.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-27 22:33:36 +02:00
Anton Kikin
aeba90032f luci-base: fix multiple parameter in cbi templates
In the dc0211803e commit, the parameter "multi" in ui.js is
replaced with "multiple" everywhere. Thus, it must also be changed
in the cbi templates.

Fixes: dc0211803e
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-26 18:18:42 +03:00
Jo-Philipp Wich
5510bdae39 luci-base: render default values for all server side cbi map widgets
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19 17:28:36 +02:00
Jo-Philipp Wich
f4c87f4dc4 luci-base: mvalue.htm: fix reading back multi value options
Fixes: 2a229e50c ("luci-base: fix cbi mvalue templates")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 21:27:00 +02:00
Jo-Philipp Wich
2a229e50cf luci-base: fix cbi mvalue templates
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 21:13:02 +02:00
Jo-Philipp Wich
1fad6c0eed
Merge pull request #2806 from dibdot/magic
system-wide: fix escaping of magic chars
2019-07-07 15:39:56 +02:00
Jo-Philipp Wich
c5b6f42943 luci-base: fix handling of large ubus HTTP requests
Properly handle ubus POST requests exceeding the default chunk size
and fix a possible nil dereference when rejecting incoming requests
due to bad JSON message framing.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
c7a9900c87 luci-base: add sys.init.reload() and sys.init.restart() actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
9c7eb1decd luci-base: switch from server side to client side widget markup
Do not render standard widgets like checkboxes, select boxes,
text input fields etc. on the server side anymore but utilize
the ui.js primitives instead.

This avoids logic duplication between server side cbi templates
and JS widgets in the future.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
2beb9fa16f luci-base: add client based view actions
Introduce a new view() target for CBI dispatch nodes, as long with the
required template and plumbing work in luci.js to allow requiring view
classes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
fda4ba598c luci-base: replace uci change pages with client side modal dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
c89bbd50fd luci-base: add ubus-http gateway
Add an admin/ubus route mimicking the native uhttpd-mod-ubus protocol.

The main difference to the native protocol is that this gateway requires
no additional per-object/procedure ACL setup on the router side and that
it is located under the same prefix as LuCI itself, allowing the reuse
of the session login cookie.

This route is meant to be a transitional mechanism until client side
RPC calls are eventually migrated to uhttpd-mod-ubus completely.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
9be6bb0577 luci-base: add ES6 Promise polyfill for IE < Edge
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Yousong Zhou
3a24c2dbaa luci-base: hide autocomplete-preventing password input with bigger offset
Fixes openwrt/luci#2624

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-07-06 22:48:10 +08:00
Yousong Zhou
609f5290c8 luci-base: nowrap for password input and reveal button
Fixes openwrt/luci#2624

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-07-06 22:48:10 +08:00
Hannu Nyman
2f769ee087 timezone data: update to 2019b
Update timezone data to 2019b

http://mm.icann.org/pipermail/tz-announce/2018-December/000055.html
http://mm.icann.org/pipermail/tz/2019-July/028249.html

2019a:
* Palestine "springs forward" on 2019-03-30 instead of 2019-03-23.
* Brazil no longer observes DST.

2019b:
* Palestine's 2019 spring-forward transition was on 03-29, not 03-30.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-07-05 17:56:04 +03:00
Dirk Brenken
f73da9ca82
system-wide: fix escaping of magic chars
* fix escaping of magic lua chars (#2800)
* fix redundant second gsub line in shellstartsqescape function
* fix return value of shellstartsqescape function

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-06-29 19:26:07 +02:00
Hannu Nyman
1c80eb1962 luci-base: show niced processes on Status/Processes page
Modify the process status filter to allow also the processes
with a nice value to be visible on the Status/Processes page.

Filter out the top process itself.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-06-28 18:56:53 +03:00
Dirk Brenken
64fb538568
luci-base: fix duid_to_mac reference in status.lua
* fix for openwrt/packages#9148

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-06-04 16:54:24 +02:00
Ansuel Smith
bb34a31e81
luci-base: handle dhcp lease from odhcpd
Currently only the dnsmasq lease file is read for hostname hint. If someone use only odhcpd as dhcp daemon the hostname resolution on wifi_assoc list is broken.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2019-06-03 12:51:33 +02:00
Ansuel Smith
525d62ff33
luci-base: adds duid_to_mac to sys.lua
Move duid_to_mac function from status.lua to sys.lua.
Implement translation from DUID-LL without header to MAC

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2019-06-03 12:48:48 +02:00
Florian Eckert
d1d5471137
Merge pull request #2174 from rosysong/lease-status
luci-base: drop ipv6 lease status when IPV6 is not support
2019-05-25 21:43:50 +02:00
Jo-Philipp Wich
444f06b1b0
Merge pull request #2687 from HenryGiraldo/master
luci-mod-admin-full: add dependency for channel auto
2019-05-09 13:26:10 +02:00