summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
AgeCommit message (Collapse)Author
2019-09-13WIP from 2018-11-28multiplipv6prefixesMikael Magnusson
2018-11-27luci-base: dispatcher: use consistent orderingJo-Philipp Wich
Use the same ordering logic for building the dispatch tree and for querying the children of a given node. Fixes #2338. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-27luci-base: dispatcher: remove tree modifier supportJo-Philipp Wich
This feature was never used, is hardly documented and appears to be designed to fiddle with the internal dispatch tree state. Given that, simply drop the related code to simplify the dispatcher class somewhat. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22luci-base: do not trigger form action when revealing passwordJo-Philipp Wich
Ref: https://github.com/openwrt/luci/issues/2327 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22luci-base: introduce common JavaScript apiJo-Philipp Wich
Introduce a new script file luci.js which is included by default and intended to be the common location of functions currently scattered in cbi.js and xhr.js. The luci.js file provides a LuCI() class which - among other things - implements helpers to construct URL paths and making HTTP requests. A singleton instance of the class is instantiated as window.L upon load and preset with the necessary environment information. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-20luci-base: fix apply/rollback stringsJo-Philipp Wich
Commit 94d8c9a7a accidentally overwrite the rewording of strings made in an earlier commit. Fixes: 94d8c9a7a ("luci-base: simplify apply widget code") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-16luci-base: dispatcher: add login indication on 403 errorsJo-Philipp Wich
Send a custom LuCI X-Header to indicate that a login is required to access the requested resource. This is mainly intended for xhr.js to be able to intercept such responses and popup an authentication dialog. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-15luci-base: support disconnecting (deauthenticating) wireless clientsWang805447391
Add a button to each row in the wireless assoclist table to allow disconnecting clients using the ubus del_client method if the underlying radio interface supports it. Ref: https://github.com/openwrt/luci/pull/2271 Submitted-by: Wang805447391 <805447391@qq.com> [move deauth function to luci-base next to the existing assoclist function, require post security, fix parameter check condition, hide button if not supported by the radio, disable button after call, squash commits, fix whitespace, reword subject, add commit message] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: datatypes: add "unique" dummy validatorJo-Philipp Wich
Add a dummy validator for the server side so that we can start using unique in client side JS code. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14Merge pull request #2259 from pmelange/luci-app-olsr-new-json-libJo-Philipp Wich
update luci-app-olsr to the new jsoninfo library
2018-11-14Merge pull request #2282 from TDT-AG/pr/20181114-luci-baseJo-Philipp Wich
luci-base: allow optional default value for file browser
2018-11-14luci-lib-ipkg: move out of luci-baseJo-Philipp Wich
Move the old luci.model.ipkg utility class into a separate package and let the components using it depend on the new library package. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: simplify apply widget codeJo-Philipp Wich
- Drop embedded CSS in favor to new global rules - Drop extraneous include of cbi.js - Use showModal() facilities - Fix a cosmetic bug in countdown timeout handling Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: add luci.sys.process.exec()Jo-Philipp Wich
The new process.exec() function simplifies spawning external processes and capturing their stdio. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: rework dynamic list templateJo-Philipp Wich
Commit 7c7821833 ("luci-base, themes: rework dynlist and dropdown widgets") changed the way we initialize dynamic lists on client side, avoiding the need for pre-rendering the items on the server side. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: add ARIA label to reveal/hide password buttonJo-Philipp Wich
Fixes #2070. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14luci-base: allow optional default value for file browserFlorian Eckert
With this change we could set optional value for the file browser. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-07luci-base: network.lua add ipv6-prefix-assignment support to ↵pmelange
get_status_by_address Signed-off-by: pmelange <isprotejesvalkata@gmail.com>
2018-11-05luci-base: validate DHCP clientid as hexstringJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: expose system translations to JavaScriptJo-Philipp Wich
Add a new /admin/translations/ endpoint which exposes the loaded system translations as JavaScript file. Once referenced by <script>, the endpoint will create a `window.TR` object containing the entire translation string table for use on the client side. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: remove unused i18n functionsJo-Philipp Wich
Drop load(), loadc(), string() and stringf() from the luci.i18n class since these functions are either no longer unused or were never used to begin with. Also slightly rework the module to only use local symbols and unify the module require style. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: remove references to luci.i18n.loadc()Jo-Philipp Wich
The i18n.loadc() function has been a no-op since almost six years so it makes no sense to invoke it anymore. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: introduce luci.i18n.dump()Jo-Philipp Wich
Add a new luci.i18n.dump() function which returns all currently loaded translation strings as Lua table. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05luci-base: fix luci.i18n.setlanguage()Jo-Philipp Wich
Rework the setlanguage() implementation to actually switch catalogues if another language has been loaded previously and change it to return the effectively loaded language tag. Also improve input parameter validation and accept tags in both lower or upper case. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-30timezone data: update to 2018gHannu Nyman
Update timezone data to 2018g http://mm.icann.org/pipermail/tz-announce/2018-October/000052.html * Morocco switches to permanent +01 on 2018-10-27. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-25 timezone data: update to 2018fHannu Nyman
Update timezone data to 2018f http://mm.icann.org/pipermail/tz-announce/2018-October/000051.html Volgograd moves from +03 to +04 on 2018-10-28. Fiji ends DST 2019-01-13, not 2019-01-20. Most of Chile changes DST dates, effective 2019-04-06. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-17luci-base: fix cbi dropdown quirks with MS EdgeJo-Philipp Wich
On MS Edge, the behaviour of "value" attributes on "li" elements is unreliable, so use the "data-" prefix to circumvent the problem. Ref: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/19320991/ Fixes: #2224 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-12treewide: Fix typos in UI stringsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-10-10Merge pull request #2197 from yangfl/masterHannu Nyman
treewide: Fix typos in comments
2018-10-10luci-base: move luci.sys.iptparser into separate packageJo-Philipp Wich
Since commit f6bfac211 ("luci-mod-status: rework iptables status page"), nothing in luci-base depends on the iptparser class anymore, so fold it out into a separate package and let the few apps that require it depend on the new library package. Saves about 10K uncompressed in luci-base while the iptables status rework enlarged the markup by roughly 5KB, saving roughly 5KB of size overall. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10treewide: Fix typos in commentsyangfl
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-10-10luci-base: show default forwarding policy in zone forwarding listJo-Philipp Wich
The zone forwarding list widget misleadingly displays the intra-zone forwarding policy as default policy action when no forwardings exist instead of the appropriate global defaults forwarding policy which is the one applied to inter-zone forwarded traffic. Fix the issue by displaying the defaults policy and not the per-zone policy to match what the firewall implementation is actually doing. Fixes: #2213 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10luci-base: validate name in firewall zone selector widgetJo-Philipp Wich
When creating a new zone through the firewall zone selector widget, validate the given name before creating new items. Depends on commit 0b6ae96f2 ("luci-base: cbi.js: recognize invalid input in dropdown create field"). Fixes: #2211 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-09timezone data: update to 2018eHannu Nyman
Update timezone data to 2018e http://mm.icann.org/pipermail/tz-announce/2018-May/000050.html North Korea switches back to +09 on 2018-05-05. The main format uses negative DST again, for Ireland Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-10-03luci-base: reword rollback notification dialogJo-Philipp Wich
Rename "Apply unchecked" to "Apply anyway" for better clarity and update the base translation files accordingly. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-29luci-base: cbi.lua: fix TypedSection.parse()Darius
It's not necessary to execute all code if section already exists. Signed-off-by: Darius Joksas <jok.darius@gmail.com> [reword commit message, squash commits, remove stray semicolon] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-27luci-base: fix sysauth cookie not removed on logoutKyle Rogers
Signed-off-by: Kyle Rogers <7157021+kyle30312@users.noreply.github.com>
2018-09-19luci-base: switch admin category node to firstnode() actionJo-Philipp Wich
After this change, luci-base will render the first module or application page installed on the system, instead of rendering a "Component not found" message when the status category is unavailable. This allows for single-purpose LuCI installations like e.g. luci-base with luci-app-travelmate which only presents application specific views without any of the standard system pages. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-19luci-base: dispatcher: introduce firstnode() dispatching targetJo-Philipp Wich
The firstnode target will dispatch the request to the first eligible menu subtree node that is not a redirect to another node, a special action or post security enabled page. That action is specifically useful for global category toplevel nodes like "admin" which are supposed to simply direct access to the first installed page node without having to hardcode specific choices. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-19modules: Split luci-mod-fullDaniel F. Dickinson
Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-09-19modules: Make luci-base sufficient to use luci appsDaniel F. Dickinson
Per the discussion in https://github.com/openwrt/luci/issues/869, make luci-base sufficient to login, logout, and review and apply or revert uci changes. This allows most luci-app-xxx to work without having luci-mod-admin-full installed. It has been tested with some apps and not luci-mod-admin-full, as well as with luci-mod-admin-full (to make sure the usual case doesn't break). Instead of creating a new module namespace (e.g. 'Base') we reduce the opportunities for breakage by having luci-base take over the 'shell' of the 'Administration' (admin/....) namespace. Since admin is assumed by all current building LuCI components (including Freifunk), this doesn't introduce the 'Administration' tab into any situation where it would not already be present (but includes it where it was before). We also add a "Component not installed" page to avoid fatal errors and backtrace when e.g. luci-mod-admin-full is not installed. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-09-19Merge pull request #2140 from kristrev/multiple-upstream-interfaces-statusJo-Philipp Wich
luci-base: Show multiple upstream interface
2018-09-19luci-base: Show multiple upstream interfaceKristian Evensen
Several devices have multiple upstream interfaces, for example a fixed and a mobile broadband connection. Currently, only one upstream interface is shown per address family in Luci. So in my example, one of the interfaces would not appear on the Status-page. This PR introduces support for showing multiple upstream interfaces on the Status-page. The code is not very complicated. get_status_by_route() has been extended to return a list of all routes, and get_wannet()/get_wan6net() now returns all upstream interfaces. I could not find any other (active) users of these three functions than calls triggered from the Status-page, so changing the default behavior should be fine. get_wandev()/get_wan6dev() called get_status_by_route(), but I could not find any place where those functions were called. I removed the dev-functions instead of keeping the old get_status_by_route(). On the status page, the wan/wan6-variables have been replaced with arrays. When populating the html, we now iterate through these arrays and create one element for each interface. I have tested the code with different interface types, v4, v6, as well as disconnecting and connecting interfaces. The status is updated and the correct interfaces (or sometimes none at all) are shown. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2018-09-08modules: add backup module for mtdblock devicesRosy Song
Signed-off-by: Rosy Song <rosysong@rosinson.com>
2018-08-17luci-base: remove fake password field from tab orderJo-Philipp Wich
Set a negative tabindex on the dummy password field to not break the form tab order flow. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-08-16luci-base: mark password template dummy field as hiddenJo-Philipp Wich
Mark the dummy input field as aria-hidden, should fix #2063. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-08-13treewide: rework uci change displayJo-Philipp Wich
- Use native rpcd uci changes format instead of incompletely converting back and forth between the old and the new format - Rework uci changelog template to print the equivalent uci commands for the various changes - Rework theme headers to properly count the uncomitted changes - Rework theme CSS to properly style new changelog Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-08-07Correct grammar in apply_widget.htmGregory L. Dietsche
This patch corrects "to get" to "to be" in apply_widget.htm This shell command was used to find and make the change in all impacted files: find . -type f -exec sed -i 's/Waiting for configuration to get applied/Waiting for configuration to be applied/g' {} + Signed-off-by: Gregory L. Dietsche <gregory.dietsche@cuw.edu>
2018-07-28luci-base: fix footer templateJo-Philipp Wich
Move the apply widget markup before the final </html> tag to avoid XHTML errors with the OpenWrt theme. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-27treewide: rework rollback/apply workflowJo-Philipp Wich
Rework the apply confirmation mechanism to be session agnostic in order to circumvent cross domain restrictions which prevent the JS code from issuing apply confirm requests in some cases, e.g. when changing the LAN IP. Confirmation calls may now be done from unauthenticated pages, as long as a matching confirmation token is sent along with the request. The reasoning behind this is that there is little security impact in confirming pending apply sessions, especially since those sessions can only be initiated while being authenticated. After this change, LuCI will now launch a confirmation process on every rendered page when a rollback is pending. The confirmation will happen regardless of whether the user is logged in or not, or if the current page is a CBI form or static template. A confirmation request now also requires a random one-time token which is rendered along with the confirmation JavaScript code in order to succeed. This token is not meant to provide security but to ensure that the confirm was triggered from an interactive browser session and not some background HTTP requests that happened to end up in the admin ui. As a consequence, the different apply/confirm/rollback code paths in CBI maps and the UCI change/revert pages have been consolidated into one common implementation residing in the common global theme agnostic footer template. Signed-off-by: Jo-Philipp Wich <jo@mein.io>