Commit graph

2848 commits

Author SHA1 Message Date
Jo-Philipp Wich
85ac64e08c luci-base: luci.js: get rid of global L references in internal classes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 616d2a61e4)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
bf4dd8e335 luci-base: luci.js: share environment object among LuCI base classes
This allows us to get rid of global `L` references in luci.js itself.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e385640505)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
bef91474bd luci-base: ensure that ubus path uses trailing slash
Without the trailing slash, probing endpoint availability will fail.

Fixes: 529bde440 ("luci-base: make rpc webserver path configurable")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 38289bc975)
2020-05-07 19:40:49 +02:00
Ansuel Smith
14a81ccb63 luci-base: make rpc webserver path configurable
Currently the ubus path that provide the webserver is hardcoded to be /ubus.
Change this to make it configurable from the luci config file.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(backported from commit 529bde4408)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
e28f94bf01 luci-base: luci.js: add LuCI.session.getToken()
Since we're already have LuCI.session.getID() we should mirror the same
interface for retrieving the session token.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 551d839f90)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
37d07f52bd luci-base: luci.js: add hasViewPermission() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b739fc17ea)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
93f9784a04 luci-base: luci.js: fix JSdoc markup issues
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 06af541c37)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
cba0bf708f luci-base: luci.js: convert various probe* functions to session data api
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b0c8221926)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
a198a32b2d luci-base: luci.js: add LuCI.session class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ef718246b1)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
87468c5731 luci-base: luci.js: add ability to add "preload" classes
Extend the LuCI bootstrap procedure to scan for class files in
/www/luci-static/preload/. Any JavaScript file found there will be
required automatically before setting up the view, allowing to stage
code that should run on every page load.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0d0ad80fd1)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
3c6dd6deec luci-base: luci.js: add LuCI.fspath() helper
The LuCI.fspath() function allows constructing absolute filesystem paths
from path segments relative to the document root.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit fde144c9be)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
2c7645b8e9 luci-base: expose effective dispatched path to client side environment
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 97f27e0d54)
2020-05-07 19:40:49 +02:00
jjm2473
f42af69363 ucitrack: fix bug for exec with params
In file `/etc/config/ucitrack`
```
config fstab
        option exec '/sbin/block mount'
```
`/sbin/block mount` never be called after fstab changed.

Signed-off-by: jjm2473 <1129525450@qq.com>
(cherry picked from commit 97780a9ce1)
2020-05-07 19:40:49 +02:00
David Lam
855264221c luci-base: add system cert bundle detection
Add detection mechanism for system cert CA bundle installed by the
ca-bundle package. Used by LuCI to detect whether the "Use system
certificates" certificate validation option should be enabled.

Signed-off-by: David Lam <david@thedavid.net>
(cherry picked from commit 27b21c2a62)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
20ddfdeb4f luci-base: dispatcher.lua: pass permission state to legacy CBI templates
Ref: https://github.com/openwrt/luci/issues/3937
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c48a8d5813)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
d122f1278b luci-base: dispatcher.lua: honour acl_depends annotations in Lua controllers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 760763a7b5)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
9ad6320876 luci-base: dispatcher.lua: add support for handling menu ACL annotations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 125916f2f4)
2020-05-07 19:40:49 +02:00
Anton Kikin
f77df82cd2 luci-base: Add missed config parameter for cbi when converting to JSON
The cbi() function has a second argument 'config' in which various
configuration parameters can be passed. When converting the lua menu
to JSON, we must also convert this parameter.

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
(cherry picked from commit 2d8299338e)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
fa534c4578 luci-base: dispatcher.lua: remove redundant check_fs_depends() call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 08eea3f93e)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
68784d4e61 luci-base: dispatcher.lua: fix filesystem dependency checks
A variable clash led to declarative `fs` dependencies being ineffective.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 7cfce56553)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
4b7fe42410 luci-base: dispatcher: remove empty firstchild nodes from menu
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit fd7961337f)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
0f83d819b8 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>
(cherry picked from commit 38c9c9e0a2)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
400e3ac4ec luci-base: dispatcher.lua: add support for loading JSON menu files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit cf1219bd07)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
4618dee211 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>
(cherry picked from commit 184ea62300)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
8059a49efc luci-base: dispatcher.lua: factor out template class init into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 1ec6e72106)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
be5116814e luci-base: dispatcher.lua: factor out language check into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a6b214f873)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
0f6af6e00d 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>
(cherry picked from commit 852d24061d)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
cecc13b9d4 luci-mod-status: use LuCI.ui.instantiateView() to load index view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f9d61213fb)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
a60ea6915c luci-base: ui.js: add instantiateView() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d9e9cf92d1)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
c2f30fbe4d treewide: import utility classes explicitly
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 3c4bc228a1)
2020-05-07 19:40:49 +02:00
Jo-Philipp Wich
28489b12eb luci-base: harmonize JS class naming and requesting
- Make builtin classes available via `require` to allow view code to
   request external and internal classes in a consistent manner without
   having to know which classes are builtin and which not

 - Make base classes request any used class explicitely instead of
   relying on implicitly set up L.{dom,view,Poll,Request,Class} aliases

 - Consistently convert class names to lower case in JSdoc to match
   the names used in `require` statements

 - Deprecate L.{dom,view,Poll,Request,Class} aliases

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 711f759278)
2020-05-07 19:40:48 +02:00
Kevin Darbyshire-Bryant
9705b53322 luci-base: Improve change application message
As a native English speaker the luci message displayed when clicking
'Save & Apply' has a somewhat uncomfortable English phrasing of "Waiting
for configuration to get applied".  It could be improved by replacing
'get' with 'be' but once you've got that far you might as well replace
this with the shorter & simpler "Applying configuration changes".  This
is also technically more correct since luci/openwrt should only be
updating/restarting processes that are related to the changed areas, not
changing the entire configuration.

As a result of that, change both the 'success' and 'rolled back'
messages to "Configuration changes have been applied" & "Configuration
changes have been rolled back"

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit 9b266d11c6)
2020-05-07 19:40:48 +02:00
Jo-Philipp Wich
c7c78291f1 luci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
This is useful to lazy-load tab contents.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bf774e4c2a)
2020-05-07 19:40:48 +02:00
Jo-Philipp Wich
ce4d8c5a9a luci-base: ui.js: allow custom validation in Dropdown and DynamicList
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90a161018c)
2020-05-07 19:40:48 +02:00
Jo-Philipp Wich
f68a32d294 luci-base: ui.js: add documentation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 1bb2717729)
2020-05-07 19:40:48 +02:00
Hannu Nyman
5e8ca2ac12 luci-base: i18n - cleanup after backport
The backport script apparently imported some stale strings.
Remove them.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-05-04 23:03:11 +03:00
Hannu Nyman
ba0b87d3ee treewide: i18n - backport translations from master
Backport updates to translations from master by using
build/i18n-merge-master.pl

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-05-04 22:47:26 +03:00
Hannu Nyman
331915272e treewide: sync translations
Sync translations.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-05-04 22:32:44 +03:00
Jo-Philipp Wich
e2aaef6eca luci-mod-network: rework signal badge disabled state
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit eb1422defe)
2020-04-02 15:28:28 +02:00
Jo-Philipp Wich
cfc55b7fd0 luci-mod-wireless: avoid signal badge wrapping in scan list
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 515069f9ec)
2020-04-02 15:28:23 +02:00
Jo-Philipp Wich
5f5f46961e luci-mod-network, luci-mod-status: allow assoclist wrapping
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a600ebb5fe14b13cb53669eb73b86f66cc699e94)
(cherry picked from commit 04c73f1613)
2020-04-02 15:28:09 +02:00
Jo-Philipp Wich
dfd0da39e2 luci-mod-network: adjust assoclist markup for easier styling
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 1b7e923cf6)
2020-04-02 15:27:43 +02:00
Jo-Philipp Wich
b572c6d82e luci-mod-network: properly handle "no signal" and "disabled" in signal badges
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit cf09705ee3)
2020-04-02 15:27:38 +02:00
Jo-Philipp Wich
50c9be16b9 luci-base: ui.js: properly handle null choices in dropdown constructor
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f1aa3f8f6e)
2020-04-01 18:45:46 +02:00
Jo-Philipp Wich
e5e71a55ab luci-mod-status: luci-bwc: skip "." and ".." when finding netdevs
Skip the "." and ".." directory entries of "/sys/class/net/" instead of
passing them on to libiwinfo's probe function. This avoids a situation
where the kernel requests a modprobe of "netdev-." and "netdev-.." over
and over again, resulting in high load on lower end systems.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 16f0997bdb)
2020-04-01 18:45:46 +02:00
Jo-Philipp Wich
f1f33c8a34 luci-mod-network: add WPA3-EAP and mixed WPA2/WPA3-EAP settings
Fixes: #3363
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit cae8045367)
2020-03-26 22:10:52 +01:00
Jo-Philipp Wich
f9a0654b54 luci-base: firewall.js: fix Firewall.removeZone()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4c55e8226d)
2020-03-26 19:16:00 +01:00
Jo-Philipp Wich
cf18bdde36 Revert "luci-base: require minimum versions of rpcd and cgi-io"
This reverts commit fb679333a5.

Version constraints are not correctly handled by luci-app-opkg.

Ref: https://forum.openwrt.org/t/something-changed-luci-compat/56959/5
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-07 10:54:59 +01:00
Jo-Philipp Wich
177f110700 Revert "luci-base: move unused tools.webadmin class to luci-compat"
This reverts commit a22e8bc2e5.

Moving the class file causes too much churn in stable due to the
need to upgrade luci-base for legacy apps.

Ref: #3726
Ref: https://forum.openwrt.org/t/package-install-issues/57010
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-06 17:35:08 +01:00
Jo-Philipp Wich
fb679333a5 luci-base: require minimum versions of rpcd and cgi-io
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-04 09:56:45 +01:00