project/luci.git
4 years agoluci-base: Import latest version of jsmin
Howard Su [Sat, 29 Feb 2020 15:30:15 +0000 (23:30 +0800)]
luci-base: Import latest version of jsmin

Signed-off-by: Howard Su <howard0su@gmail.com>
(cherry picked from commit 9935a5c735b271f59e3c6c95248c64e4b089d7f0)

4 years agoluci-base: po2lmo: refactor code
Jo-Philipp Wich [Sat, 1 Feb 2020 13:29:23 +0000 (14:29 +0100)]
luci-base: po2lmo: refactor code

Refactor the po2lmo conversion code to be more robust and to properly
handle input files without location comments.

Ref: https://github.com/openwrt/luci/commit/9c1bac4168d151c2a3a5a1f957adbd68b6ae0746#commitcomment-37036663
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2a1245a4970c2655fda10c51a6be4973f3e2ce84)

4 years agoluci-base: add support for plural translations and contexts in Lua api
Jo-Philipp Wich [Thu, 23 Jan 2020 20:53:26 +0000 (21:53 +0100)]
luci-base: add support for plural translations and contexts in Lua api

 - Introduce a new luci.template.parser.ntranslate() function which
   takes a count, a singular and a plural translation string as well
   as an optional context argument and returns the appropriate,
   language specific plural translation.

 - Introduce an optional translation context argument in the existing
   luci.template.parser.translate() function

 - Support translation contexts in LuCI template directives.
   Translation messages are split on the first unescaped pipe
   character and the reamining string after the pipe is treated
   as context.

Examples:

 - `string.format(p.ntranslate(n, "1 apple", "%d apples"), n)` will
   return an appropriate plural translation for the given amount.

 - `translate("Load", "The system load")` will return an appropiate
   translation for `Load`, using `The system load` as disambiguation
   context (a `msgctxt` directive in *.po files).

 - Likewise `<%:Load|The system load%>` will translate the word
   `Load` while using the remainder of the string as context.

 - To use pipes in translations strings literally, they must be
   escaped: `<%:Use the "\|" character%>` will translate the literal
   string `Use the "|" character`.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9939fc5a26d07da4756497bb6a7dc51dcf379e98)

4 years agoluci-base: handle more po format features in po2lmo
Jo-Philipp Wich [Wed, 22 Jan 2020 17:44:15 +0000 (18:44 +0100)]
luci-base: handle more po format features in po2lmo

 - Extract and store the plural calculation function in .lmo files
 - Handle plural translation messages
 - Handle translation contexts

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9c1bac4168d151c2a3a5a1f957adbd68b6ae0746)

4 years agoluci-base: correct rpcd bad access mode
David Lam [Thu, 16 Jan 2020 22:49:42 +0000 (14:49 -0800)]
luci-base: correct rpcd bad access mode

Corrects the bad access mode from a previous commit that did not allow rpcd luci to execute.

Signed-off-by: David Lam <david@thedavid.net>
(cherry picked from commit cbb1c3cf932e4f5d6d56b63ba2e87bd761bfcc54)

4 years agoluci-base: move tools.webadmin to luci-compat
Jo-Philipp Wich [Mon, 30 Dec 2019 09:37:48 +0000 (10:37 +0100)]
luci-base: move tools.webadmin to luci-compat

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 09b2d8a8ac6ca14cfa91168e3f3d1a102e6b62fb)

4 years agoluci-base: drop unused tools.webadmin.proto class
Jo-Philipp Wich [Mon, 30 Dec 2019 09:37:25 +0000 (10:37 +0100)]
luci-base: drop unused tools.webadmin.proto class

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 6591b48f8ec938b4f76dd52cba3293338329cd36)

4 years agoluci-base: firewall.js: fix Zone.addRule()
Jo-Philipp Wich [Mon, 4 May 2020 19:29:01 +0000 (21:29 +0200)]
luci-base: firewall.js: fix Zone.addRule()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 28cf5cd576a7d502bcbfc55c1418dd116f2210e0)

4 years agoluci-base: firewall.js: gracefully handle missing uci configuration
Jo-Philipp Wich [Tue, 28 Apr 2020 07:44:11 +0000 (09:44 +0200)]
luci-base: firewall.js: gracefully handle missing uci configuration

Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a8d85ed71a14c85bbfca0532bb721f5f89a39845)

4 years agoluci-base: uci.js: fix section deletion logic
Jo-Philipp Wich [Sun, 26 Apr 2020 16:41:19 +0000 (18:41 +0200)]
luci-base: uci.js: fix section deletion logic

 - Process deletions before additions or changes, allowing user code to
   remove and recreate a section with the same name.

 - Only record section deletions when the section to be removed actually
   existed in the original config or when it was staged for creation
   earlier. This avoids stray ubus not found exception when saving.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 49c6a810e9a705217f4543099d8188f0f3158f6c)

4 years agoluci-base: network.js: don't fail loading network config on missing wireless
Jo-Philipp Wich [Wed, 15 Apr 2020 07:27:10 +0000 (09:27 +0200)]
luci-base: network.js: don't fail loading network config on missing wireless

Fixes: #3914
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0e22d4d87e9965a2ff74707d309a1bbb3c8334a2)

4 years agoluci-base: tools/widgets.js: honour map readonly property too
Jo-Philipp Wich [Tue, 14 Apr 2020 15:12:47 +0000 (17:12 +0200)]
luci-base: tools/widgets.js: honour map readonly property too

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c89fd0a7f324bb6c0ebd803f542bb63d49e41984)

4 years agoluci-base: tools/widgets.js: honour readonly property
Jo-Philipp Wich [Mon, 13 Apr 2020 14:55:49 +0000 (16:55 +0200)]
luci-base: tools/widgets.js: honour readonly property

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0f8e5b2536d1226b98ff14c78663bd21736e08a3)

4 years agoluci-base: uci.js: do not issue malformed uci/delete requests
Jo-Philipp Wich [Tue, 14 Apr 2020 15:02:42 +0000 (17:02 +0200)]
luci-base: uci.js: do not issue malformed uci/delete requests

Fixes: #3912
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7)
(cherry picked from commit 6ae1cd8fdbd438574270fa9586f40e223fec40e6)

4 years agoluci-base: uci.js: fix variable clash
Jo-Philipp Wich [Mon, 13 Apr 2020 10:22:13 +0000 (12:22 +0200)]
luci-base: uci.js: fix variable clash

Don't overwrite the `r` variable which is supposed to refer to the reordered
uci sections with temporary data for collecting uci add parameters.

Fixes stray uci/get permission errors caused by an attempt to load
nonsensical uci package names.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 55cb5a753b94e2eee049546a2af374bb6129d4c4)

4 years agoluci-base: network.js: gracefully handle missing wireless config
Jo-Philipp Wich [Sat, 11 Apr 2020 19:24:21 +0000 (21:24 +0200)]
luci-base: network.js: gracefully handle missing wireless config

Ref: https://github.com/openwrt/luci/issues/3895
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 65d673f4671215f2907baebc8d6860f64ba13307)

4 years agoluci-base: rpc.js: add ability to reject nonzero ubus statuses
Jo-Philipp Wich [Fri, 10 Apr 2020 20:50:41 +0000 (22:50 +0200)]
luci-base: rpc.js: add ability to reject nonzero ubus statuses

Add a new declare option `reject` which makes the generated RPC call
function reject with an error in case the remote ubus call returned
a non-zero status.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bd713f870a974d46b214d07d85ac4a895d85a122)

4 years agoluci-base: cbi.js: handle translation contexts in _()
Jo-Philipp Wich [Fri, 14 Feb 2020 07:42:04 +0000 (08:42 +0100)]
luci-base: cbi.js: handle translation contexts in _()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5258080ce32b973e80111abd41fec82bf9b5e31e)

4 years agoluci-base: cbi.js: support plural translations and disambiguation contexts
Jo-Philipp Wich [Wed, 22 Jan 2020 20:56:28 +0000 (21:56 +0100)]
luci-base: cbi.js: support plural translations and disambiguation contexts

 - Implement `N_(count, "String singular", "String plural" [, "Context"])`
   plural translation function.

 - Extend `_()` to optionally accept a second disambiguation context
   argument.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 894752610d80a2fa1cdb6a845526728eeb0bc984)

4 years agoluci-base: form.js: forward section ID in CBISectionValue methods
Jo-Philipp Wich [Mon, 4 May 2020 19:34:12 +0000 (21:34 +0200)]
luci-base: form.js: forward section ID in CBISectionValue methods

This is useful for custom subclasses that want to perform conditional
rendering of contents, depending on the parent section ID.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f0a0d28fdd22b7904ea9a4efb53a7b791dc6dead)

4 years agoluci-base: form.js: toggle inactive CSS class on unsatisfied field cells
Jo-Philipp Wich [Tue, 28 Apr 2020 07:51:54 +0000 (09:51 +0200)]
luci-base: form.js: toggle inactive CSS class on unsatisfied field cells

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 428e3bd6dc0afcc1ff1c2a62506d66bebc59976f)

4 years agoluci-base: form.js: ListValue: support widget and orientation properties
Jo-Philipp Wich [Tue, 28 Apr 2020 07:50:28 +0000 (09:50 +0200)]
luci-base: form.js: ListValue: support widget and orientation properties

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit daa318c1b2cde1be9df370b1794d660902feab6b)

4 years agoluci-base: form.js: allow to disable descriptions row in TableSection
Anton Kikin [Sun, 19 Apr 2020 02:54:15 +0000 (05:54 +0300)]
luci-base: form.js: allow to disable descriptions row in TableSection

Add 'nodescriptions' property to the TableSection class that allows
to disable displaying table header row with descriptions.

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
(cherry picked from commit 7585e5c95adc69a6e86ae19dda5dfb60557cefdb)

4 years agoluci-base: form.js: fix TableSection descriptions row rendering
Anton Kikin [Sun, 19 Apr 2020 02:55:03 +0000 (05:55 +0300)]
luci-base: form.js: fix TableSection descriptions row rendering

In some cases, a table cell at actions column of a descriptions row
may not be rendered. For example, this happens for GridSection when
sorting is disabled:

    s = m.section(form.GridSection, 'section_type');
    s.sortable = false;

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
(cherry picked from commit da0e974db5865daf6d634ae5f7649f5b5fc2ef31)

4 years agoluci-base: form.js: implement readonly property for forms and options
Jo-Philipp Wich [Mon, 13 Apr 2020 14:53:10 +0000 (16:53 +0200)]
luci-base: form.js: implement readonly property for forms and options

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9279448148052950121d7ce205bdd6a1ee353b2e)

4 years agoluci-base: form.js: improve save error handling
Jo-Philipp Wich [Fri, 10 Apr 2020 18:38:58 +0000 (20:38 +0200)]
luci-base: form.js: improve save error handling

Fixes: #3552
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2dfcca23e4f3edaea2fa5a68a7626a3ab65d3d65)

4 years agoluci-base: form.js: add documentation
Jo-Philipp Wich [Tue, 7 Apr 2020 14:33:09 +0000 (16:33 +0200)]
luci-base: form.js: add documentation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 698c8ff843253c9785bec9dfdff3774db0eae661)

4 years agoform.js: use CSS .btn class for drag handles
Jo-Philipp Wich [Mon, 23 Mar 2020 20:47:35 +0000 (21:47 +0100)]
form.js: use CSS .btn class for drag handles

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5d8970d76c7b2dcb415e849553dc09fc58d611c5)

4 years agoluci-base: form.js: rendering fixes for grid sections
Jo-Philipp Wich [Wed, 12 Feb 2020 07:16:06 +0000 (08:16 +0100)]
luci-base: form.js: rendering fixes for grid sections

 - Ensure that last header cell is rendered for grid sections without
   sorting or addremove actions
 - Don't skip header cells for optional options

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9bb78b5cd842f94cbcaf00cc5b19c1e3b9669d93)

4 years agoluci-base: ui.js: reset scroll position when opening modal overlay
Jo-Philipp Wich [Sat, 2 May 2020 21:52:36 +0000 (23:52 +0200)]
luci-base: ui.js: reset scroll position when opening modal overlay

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4df3a90b3d638e18b9607a5332033df7ceb0ec55)

4 years agoluci-base: ui.js: fix input value reading for select widgets
Jo-Philipp Wich [Sat, 2 May 2020 21:51:22 +0000 (23:51 +0200)]
luci-base: ui.js: fix input value reading for select widgets

Fixes: #3989
Fixes: 81effc111 ("luci-base: ui.js: assume select widget by default for ListValue widget")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e3ef463ccdd7d32eef1717203bd872272c57793d)

4 years agoluci-base: ui.js: assume select widget by default for ListValue widget
Jo-Philipp Wich [Tue, 28 Apr 2020 13:37:02 +0000 (15:37 +0200)]
luci-base: ui.js: assume select widget by default for ListValue widget

Fixes: #3973
Fixes: 2fb55e1ab ("luci-base: ui.js: fixes for radio widget type of select element")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 81effc111227bc65cb974829f17a45515fbe9807)

4 years agoluci-base: ui.js: fixes for radio widget type of select element
Jo-Philipp Wich [Tue, 28 Apr 2020 07:48:34 +0000 (09:48 +0200)]
luci-base: ui.js: fixes for radio widget type of select element

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2fb55e1ab5a28c1000a8de6710b6f586f5b88329)

4 years agoluci-base: ui.js: fix textarea width
Jo-Philipp Wich [Sun, 19 Apr 2020 17:34:27 +0000 (19:34 +0200)]
luci-base: ui.js: fix textarea width

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit acae1378a80ca0f87ec3f29de585a6b6328a2c64)

4 years agoluci-base: ui.js: order indicators by ID value
Jo-Philipp Wich [Fri, 17 Apr 2020 07:30:20 +0000 (09:30 +0200)]
luci-base: ui.js: order indicators by ID value

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 01d8283ecea730191ce41302acb7ecd1aaf0631f)

4 years agoluci-base: ui.js: apply disabled attribute to toplevel dynlist node
Jo-Philipp Wich [Thu, 16 Apr 2020 11:19:35 +0000 (13:19 +0200)]
luci-base: ui.js: apply disabled attribute to toplevel dynlist node

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 46d31efc7351231def16be1024eff95c5b792f94)

4 years agoluci-base: ui.js: use session data api to persist tab selection state
Jo-Philipp Wich [Wed, 15 Apr 2020 20:18:13 +0000 (22:18 +0200)]
luci-base: ui.js: use session data api to persist tab selection state

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 51186355ea168dfc6fb1363ace5c57b178f0331e)

4 years agoluci-base: ui.js: add disabled property to widgets
Jo-Philipp Wich [Mon, 13 Apr 2020 14:11:35 +0000 (16:11 +0200)]
luci-base: ui.js: add disabled property to widgets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 86c797041af0b52c17aa10db977f039b28a9444a)

4 years agoluci-base: ui.js: add generic indicator handling functions
Jo-Philipp Wich [Tue, 31 Mar 2020 19:29:28 +0000 (21:29 +0200)]
luci-base: ui.js: add generic indicator handling functions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4250f99d7f061e47d24e18db26bf6dffc98cc72e)

4 years agoluci-base: ui.js: improve mobile dropdown scroll behaviour
Jo-Philipp Wich [Wed, 25 Mar 2020 11:34:46 +0000 (12:34 +0100)]
luci-base: ui.js: improve mobile dropdown scroll behaviour

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0fb2f8f1d1d8748b56522cc81cf68d5aa04b9f50)

4 years agoluci-base: form.js / ui.js: tie form labels to widgets
Jo-Philipp Wich [Tue, 24 Mar 2020 20:57:21 +0000 (21:57 +0100)]
luci-base: form.js / ui.js: tie form labels to widgets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 22ba6fc40933bee02c3ea93bbda952bb44bf3af1)
(cherry picked from commit 82fb5a67d39d965595d2ad833dbf930e559c0202)

4 years agoluci-base: ui.js: various tweaks
Jo-Philipp Wich [Mon, 23 Mar 2020 20:36:59 +0000 (21:36 +0100)]
luci-base: ui.js: various tweaks

 - emit checkbox markup suitable for CSS styling
 - use .btn CSS class where appropriate
 - dispatch events when updating uci change indicator
 - use correct target node when handling events in createHandlerFn()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 993b4f79506c99357dc77eeaa74b0fd9149b1cf1)

4 years agoluci-base: luci.js: get rid of global `L` references in internal classes
Jo-Philipp Wich [Thu, 16 Apr 2020 11:17:57 +0000 (13:17 +0200)]
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 616d2a61e40ff2c19f38804f08c5b9ccf156639f)

4 years agoluci-base: luci.js: share environment object among LuCI base classes
Jo-Philipp Wich [Thu, 16 Apr 2020 08:46:45 +0000 (10:46 +0200)]
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 e385640505352efe8e470d5b723e8b467a0d6fb6)

4 years agoluci-base: ensure that ubus path uses trailing slash
Jo-Philipp Wich [Fri, 13 Mar 2020 22:57:19 +0000 (23:57 +0100)]
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 38289bc97512e758e5a20f348dc13d5018f98188)

4 years agoluci-base: make rpc webserver path configurable
Ansuel Smith [Thu, 16 Jan 2020 14:16:09 +0000 (15:16 +0100)]
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 529bde44081d0bc07a064e9dfb1f0b3f35e61061)

4 years agoluci-base: luci.js: add LuCI.session.getToken()
Jo-Philipp Wich [Sun, 26 Apr 2020 16:44:48 +0000 (18:44 +0200)]
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 551d839f90853b58f81d124c77442009d4df0cb4)

4 years agoluci-base: luci.js: add hasViewPermission() helper
Jo-Philipp Wich [Wed, 15 Apr 2020 20:14:44 +0000 (22:14 +0200)]
luci-base: luci.js: add hasViewPermission() helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b739fc17eabe9905889017127ac1de8f4e194819)

4 years agoluci-base: luci.js: fix JSdoc markup issues
Jo-Philipp Wich [Wed, 15 Apr 2020 20:03:20 +0000 (22:03 +0200)]
luci-base: luci.js: fix JSdoc markup issues

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 06af541c376ddab7303ea4294b17e8be91458d05)

4 years agoluci-base: luci.js: convert various probe* functions to session data api
Jo-Philipp Wich [Wed, 15 Apr 2020 20:01:55 +0000 (22:01 +0200)]
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 b0c822192628f3346721810212b0770cc16ff6ea)

4 years agoluci-base: luci.js: add LuCI.session class
Jo-Philipp Wich [Wed, 15 Apr 2020 19:50:26 +0000 (21:50 +0200)]
luci-base: luci.js: add LuCI.session class

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ef718246b17d322ae001129c04e117d17e2373a0)

4 years agoluci-base: luci.js: add ability to add "preload" classes
Jo-Philipp Wich [Sun, 12 Apr 2020 20:54:02 +0000 (22:54 +0200)]
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 0d0ad80fd1b96ff2c33392387320ad518640782b)

4 years agoluci-base: luci.js: add LuCI.fspath() helper
Jo-Philipp Wich [Sun, 12 Apr 2020 20:27:16 +0000 (22:27 +0200)]
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 fde144c9be61d7886e81240233328a61d7088d08)

4 years agoluci-base: expose effective dispatched path to client side environment
Jo-Philipp Wich [Sun, 1 Dec 2019 19:21:04 +0000 (20:21 +0100)]
luci-base: expose effective dispatched path to client side environment

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 97f27e0d54fd1a1534b99421aa0e930fbe274db8)

4 years agoucitrack: fix bug for exec with params
jjm2473 [Sun, 22 Mar 2020 16:58:46 +0000 (00:58 +0800)]
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 97780a9ce158097e17ed7842ae01e765d5da4955)

4 years agoluci-base: add system cert bundle detection
David Lam [Thu, 16 Jan 2020 09:15:40 +0000 (01:15 -0800)]
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 27b21c2a6262a8c383c783e98320746f22fe8f6f)

4 years agoluci-base: dispatcher.lua: pass permission state to legacy CBI templates
Jo-Philipp Wich [Mon, 20 Apr 2020 07:33:30 +0000 (09:33 +0200)]
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 c48a8d58132b4f175ec0a4b4ec4e15eb199edeb8)

4 years agoluci-base: dispatcher.lua: honour acl_depends annotations in Lua controllers
Jo-Philipp Wich [Sun, 19 Apr 2020 15:13:49 +0000 (17:13 +0200)]
luci-base: dispatcher.lua: honour acl_depends annotations in Lua controllers

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 760763a7b5da42860c6c2d63478859bb02fa9104)

4 years agoluci-base: dispatcher.lua: add support for handling menu ACL annotations
Jo-Philipp Wich [Wed, 15 Apr 2020 20:12:39 +0000 (22:12 +0200)]
luci-base: dispatcher.lua: add support for handling menu ACL annotations

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 125916f2f4603acf980acd074aca55d0b528f34b)

4 years agoluci-base: Add missed config parameter for cbi when converting to JSON
Anton Kikin [Tue, 18 Feb 2020 11:00:01 +0000 (14:00 +0300)]
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 2d8299338e6c77fb15c457f5cf7f34dc0278db60)

4 years agoluci-base: dispatcher.lua: remove redundant check_fs_depends() call
Jo-Philipp Wich [Wed, 5 Feb 2020 16:42:58 +0000 (17:42 +0100)]
luci-base: dispatcher.lua: remove redundant check_fs_depends() call

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 08eea3f93e9f2e9a2940df2e3a7afbe04c40f4b6)

4 years agoluci-base: dispatcher.lua: fix filesystem dependency checks
Jo-Philipp Wich [Thu, 30 Jan 2020 11:19:27 +0000 (12:19 +0100)]
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 7cfce565530cbf6103275002ad20af57a509ad7b)

4 years agoluci-base: dispatcher: remove empty firstchild nodes from menu
Jo-Philipp Wich [Fri, 10 Jan 2020 21:12:03 +0000 (22:12 +0100)]
luci-base: dispatcher: remove empty firstchild nodes from menu

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit fd7961337f44ebe8aa71e6ae0925cb70a8c53b21)

4 years agoluci-base: dispatcher: fix rpc controller regression
Jo-Philipp Wich [Tue, 7 Jan 2020 08:08:49 +0000 (09:08 +0100)]
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 38c9c9e0a2564b9644a56f1143f6acf0c9e272c8)

4 years agoluci-base: dispatcher.lua: add support for loading JSON menu files
Jo-Philipp Wich [Fri, 6 Dec 2019 20:19:02 +0000 (21:19 +0100)]
luci-base: dispatcher.lua: add support for loading JSON menu files

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit cf1219bd0790506279b14007595e8389e5eb99ff)

4 years agoluci-base: dispatcher.lua: refactor dispatch logic
Jo-Philipp Wich [Wed, 4 Dec 2019 18:19:45 +0000 (19:19 +0100)]
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 184ea6230076bf4dd3abf6669bde17f87a051146)

4 years agoluci-base: dispatcher.lua: factor out template class init into own function
Jo-Philipp Wich [Wed, 4 Dec 2019 18:04:50 +0000 (19:04 +0100)]
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 1ec6e72106218e11871dd8ee563f7673c2d1f7dc)

4 years agoluci-base: dispatcher.lua: factor out language check into own function
Jo-Philipp Wich [Wed, 4 Dec 2019 18:00:27 +0000 (19:00 +0100)]
luci-base: dispatcher.lua: factor out language check into own function

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a6b214f87332471b8210d05b02ae59ea6b0c16b7)

4 years agoluci-base: dispatcher.lua: introduce dispatch tree JSON conversion
Jo-Philipp Wich [Sun, 1 Dec 2019 19:06:43 +0000 (20:06 +0100)]
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 852d24061d236048a8c2c886787eede2586b10b4)

4 years agoluci-mod-status: use LuCI.ui.instantiateView() to load index view
Jo-Philipp Wich [Fri, 3 Apr 2020 11:27:20 +0000 (13:27 +0200)]
luci-mod-status: use LuCI.ui.instantiateView() to load index view

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f9d61213fbfde66ffc6f8ca0e112d6445c6c4695)

4 years agoluci-base: ui.js: add instantiateView() helper
Jo-Philipp Wich [Fri, 3 Apr 2020 11:21:09 +0000 (13:21 +0200)]
luci-base: ui.js: add instantiateView() helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d9e9cf92d15c81284000c7c97c6f7bf2b5953c2d)

4 years agotreewide: import utility classes explicitly
Jo-Philipp Wich [Fri, 3 Apr 2020 08:00:06 +0000 (10:00 +0200)]
treewide: import utility classes explicitly

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 3c4bc228a1f7b5731cf464f3f407c9ed9ace3cd2)

4 years agoluci-base: harmonize JS class naming and requesting
Jo-Philipp Wich [Thu, 2 Apr 2020 19:40:50 +0000 (21:40 +0200)]
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 711f75927849fade74f79e4b198b3a839d9d4fbc)

4 years agoluci-base: Improve change application message
Kevin Darbyshire-Bryant [Thu, 14 Nov 2019 10:53:56 +0000 (10:53 +0000)]
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 9b266d11c6b5082c733f101326160cef797f6edf)

4 years agoluci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
Jo-Philipp Wich [Wed, 12 Feb 2020 07:14:22 +0000 (08:14 +0100)]
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 bf774e4c2a6a03aa01d4bcd9f5ce4f960cd91874)

4 years agoluci-base: ui.js: allow custom validation in Dropdown and DynamicList
Jo-Philipp Wich [Mon, 16 Dec 2019 16:44:27 +0000 (17:44 +0100)]
luci-base: ui.js: allow custom validation in Dropdown and DynamicList

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90a161018c9c7650a27a66f8e0a4f060d1ccebd6)

4 years agoluci-base: ui.js: add documentation
Jo-Philipp Wich [Tue, 31 Mar 2020 19:27:42 +0000 (21:27 +0200)]
luci-base: ui.js: add documentation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 1bb27177296cbfc4ad4a07dc59edf31fb8f92c7a)

4 years agoluci-app-statistics: remove quotemark from comment
Hannu Nyman [Thu, 7 May 2020 16:17:42 +0000 (19:17 +0300)]
luci-app-statistics: remove quotemark from comment

Having quote " in a comment may cause error with non-minified code.
(explanation: caused by 'require' function's parsing behaviour)

Remove also ";" just in case.

Reference to issue 4020

(backported from 4f80f9542)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
4 years agoMerge pull request #4009 from stangri/19.07-luci-app-vpn-policy-routing
Stan [Mon, 4 May 2020 22:55:41 +0000 (15:55 -0700)]
Merge pull request #4009 from stangri/19.07-luci-app-vpn-policy-routing

[19.07] luci-app-vpn-policy-routing: support phys-dev policies

4 years agoluci-app-vpn-policy-routing: support phys-dev policies 4009/head
Stan Grishin [Mon, 4 May 2020 22:54:30 +0000 (22:54 +0000)]
luci-app-vpn-policy-routing: support phys-dev policies

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoluci-base: i18n - cleanup after backport
Hannu Nyman [Mon, 4 May 2020 20:03:11 +0000 (23:03 +0300)]
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>
4 years agotreewide: i18n - backport translations from master
Hannu Nyman [Mon, 4 May 2020 19:47:26 +0000 (22:47 +0300)]
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>
4 years agotreewide: sync translations
Hannu Nyman [Mon, 4 May 2020 19:32:44 +0000 (22:32 +0300)]
treewide: sync translations

Sync translations.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
4 years agoMerge pull request #4002 from stangri/19.07-luci-app-vpnbypass
Stan [Sun, 3 May 2020 19:49:24 +0000 (12:49 -0700)]
Merge pull request #4002 from stangri/19.07-luci-app-vpnbypass

[19.07] luci-app-vpnbypass: better localizeable resources

4 years agoluci-app-vpnbypass: better localizeable resources 4002/head
Stan Grishin [Sat, 2 May 2020 22:17:49 +0000 (22:17 +0000)]
luci-app-vpnbypass: better localizeable resources

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoMerge pull request #3998 from stangri/19.07-luci-app-simple-adblock
Stan [Sat, 2 May 2020 16:20:56 +0000 (09:20 -0700)]
Merge pull request #3998 from stangri/19.07-luci-app-simple-adblock

[19.07] luci-app-simple-adblock: bugfix: remove escaped double-quotes from translateable resources

4 years agoMerge pull request #3996 from stangri/19.07-luci-app-vpn-policy-routing
Stan [Sat, 2 May 2020 16:20:29 +0000 (09:20 -0700)]
Merge pull request #3996 from stangri/19.07-luci-app-vpn-policy-routing

[19.07] luci-app-vpn-policy-routing: bugfix: remove escaped double-quotes from translateable resources

4 years agoluci-app-simple-adblock: bugfix: remove escaped double-quotes from translateable... 3998/head
Stan Grishin [Sat, 2 May 2020 16:00:54 +0000 (16:00 +0000)]
luci-app-simple-adblock: bugfix: remove escaped double-quotes from translateable resources

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoMerge pull request #3992 from stangri/19.07-luci-app-https-dns-proxy
Hannu Nyman [Sat, 2 May 2020 15:55:56 +0000 (18:55 +0300)]
Merge pull request #3992 from stangri/19.07-luci-app-https-dns-proxy

[19.07] luci-app-https-dns-proxy: bugfix: remove escaped double-quotes from translateable resources

4 years agoluci-app-vpn-policy-routing: bugfix: remove escaped double-quotes from translateable... 3996/head
Stan Grishin [Sat, 2 May 2020 15:46:47 +0000 (15:46 +0000)]
luci-app-vpn-policy-routing: bugfix: remove escaped double-quotes from translateable resources

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoluci-app-https-dns-proxy: bugfix: remove escaped double-quotes from translateable... 3992/head
Stan Grishin [Sat, 2 May 2020 15:31:49 +0000 (15:31 +0000)]
luci-app-https-dns-proxy: bugfix: remove escaped double-quotes from translateable resources

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoMerge pull request #3960 from stangri/19.07-luci-app-https-dns-proxy
Hannu Nyman [Fri, 24 Apr 2020 14:32:11 +0000 (17:32 +0300)]
Merge pull request #3960 from stangri/19.07-luci-app-https-dns-proxy

[19.07] luci-app-https-dns-proxy: add CIRA Canadian Shiled

4 years agoluci-app-https-dns-proxy: add CIRA Canadian Shiled 3960/head
Stan Grishin [Fri, 24 Apr 2020 10:06:01 +0000 (10:06 +0000)]
luci-app-https-dns-proxy: add CIRA Canadian Shiled

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoluci-app-travelmate: refine logical interface selection
Dirk Brenken [Fri, 24 Apr 2020 07:42:02 +0000 (09:42 +0200)]
luci-app-travelmate: refine logical interface selection

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit c2d8275fdae8caf76cb54af553bcf880d2c6f157)

4 years agoluci-app-travelmate: sync with travelmate 1.5.4
Dirk Brenken [Wed, 22 Apr 2020 19:40:04 +0000 (21:40 +0200)]
luci-app-travelmate: sync with travelmate 1.5.4

* change wifi scanning to logical interface name,
  no longer use the radio device

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 9d02ef1bd936e79d30370a243b42428675dce247)

4 years agoluci-proto-openconnect: fix certificate file paths
Friendly fellow [Thu, 26 Mar 2020 15:49:55 +0000 (18:49 +0300)]
luci-proto-openconnect: fix certificate file paths

This addresses the issue of openconnect.sh from openconnect package expecting
a vpn- suffix for the files, while the frontend didn't.

Signed-off-by: Friendly fellow <DasTestament@users.noreply.github.com>
[reword commit message]
Ref: https://github.com/openwrt/packages/issues/11584
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit adf0fb1879ffb6bd04984d257484fad0fba1d6a3)
Fixes: #3951
4 years agoMerge pull request #3944 from stangri/19.07-luci-app-simple-adblock
Hannu Nyman [Tue, 21 Apr 2020 16:48:23 +0000 (19:48 +0300)]
Merge pull request #3944 from stangri/19.07-luci-app-simple-adblock

[19.07] luci-app-simple-adblock: bugfix: get package version from opkg

4 years agoluci-app-simple-adblock: bugfix: get package version from opkg 3944/head
Stan Grishin [Tue, 21 Apr 2020 00:51:30 +0000 (00:51 +0000)]
luci-app-simple-adblock: bugfix: get package version from opkg

Signed-off-by: Stan Grishin <stangri@melmac.net>
4 years agoluci-app-adblock: accept capital letters in DNS filter
Dirk Brenken [Tue, 14 Apr 2020 17:44:58 +0000 (19:44 +0200)]
luci-app-adblock: accept capital letters in DNS filter

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit e7cb6efb5a2c147fb00b5dd97651099a60da9bd3)

4 years agoluci-app-adblock: more DNS Report tweaks
Dirk Brenken [Sun, 12 Apr 2020 08:00:34 +0000 (10:00 +0200)]
luci-app-adblock: more DNS Report tweaks

* revert last page loading change,
  this breaks the filter functionality on that page
* Add a short paragraph to explain the page functionality
* Fix search to accept ":" character as well
  (e.g. for IPv6 address search)

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 94799995aa3fc7961c6d6aea6d3105a29d550b3f)