Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
This is needed to deal with ubus methods that return multiple results,
e.g. session/list
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Also add a hidden type password field to prevent browser autocompleters
from entering the login passwords into fields liek the wireless WPA key
field.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add a "data-description" attribute to CBI fields which have a description
set, this allows responsive design themes to render a field description
when decomposing the table grid.
Also reuse the precalculated "typename" property if it exists, instead of
deriving it from the template name yet again.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The previous refactoring of the template caused the row stripying CSS
classes to be interpolated in such a way, that a separating space to
previous CSS classes was missing, leading to not rendered row names
and other side effects.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Make sure that hitting enter in the form hits the CBI save action and not
apply or cancel
- Hide action panel if no actions are available
- CLeanup code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Hide empty title and description rows
- Correct row striping offset
- Cleanup code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Ensure that pressing enter in the form triggers the submit action and
not a cbi skip or cancel
- Hide page actions when empty
- Cleanup code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Some CBI map models, mainly the Network -> VLAN page, expect a valid
previous section ID in their Section:create() callback.
Previous refactoring of the tblsection markup broke this behaviour as
the "section" loop variable was accidentally localized, causing it to
be undefined outside of the loop body which caused the section add
button and name input fields to get rendered with a wrong "name"
attribute.
Fix this by moving the "section" variable declaration out of the loop
and by readding references to it in the non-anonymous section add case.
Fixes FS#1657
Fixes 002c4d1d5 ("luci-base: add "Name" label to autogenerated title column")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
This allows exposing virtual ubus-based network interfaces in LuCI.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Fix button styles in failure message
- Pause XHR polling during apply/rollback sessions
- Throttle confirm requests to 1 request/second
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Commit c0de036b3 ("treewide: always include cbi.js") improperly removed the
cbi.js script include from header.htm, leaving behind the string dictionary.
Move the JSON dictionary to the parent <form> element and delete the
leftover </script> element.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Include cbi.js in the main header template like it is done for xhr.js and
remove the page specific includes.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The previous implementation failed to mark active nodes under some
circumstances.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Attempt to derive a MAC from the DHCPv6 lease DUID and use it to look up
a host hint. If a hint is found, add it to the lease information.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Merge the assoclist code of the status overview and wireless overview pages
into a single shared partial template.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- add responsive attributes to partial cbi templates
- unify and fix button style classes
- fix styling of sysauth dialog
- rework firewall_zoneforwards widget
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Also switch the weekday and monthday lists in the firewall rule details to
cbi dropdowns, vastly uncluttering the form.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
This commit introduces the required code for a new, markup based dropdown
widget which can be used as a styleable alternative to select boxes or
radio/checkbox button groups.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
AbstractValue descendants may now specify a new optional property `alias`
which refers to a uci option to read/write/remove that differs from the
option name itself.
This is mainly useful for widgets that are toggled based on dependencies,
e.g. for alternating between SingleValue and MultiValue, but which are
intented to write into the same uci option.
Such a setup was previously possible already by overriding the .cfgvalue(),
.write() and .remove() callbacks with custom implementations, but that
required a lot of boiler plate code and was rather fragile.
With the `alias` property, CBI now takes care of the details and tracks
aliased fields within a section accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Properly serialize option delete changelogs
- Do not perform a section create if a nil value is passed to set()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Since the switch to ubus uci operations we do not have a local application-
side cursor cache anymore, instead uci operations happen synchronously in
the rpcd backend server.
This may cause cbi section reorder operations involving multiple elements
to fail, because anonymous section hashes may change due to rehashing
between consecutive ubus uci reorder calls.
In order to avoid that problem, use the ubus uci batch reorder extension,
which allows to pass a complete (or partial) list of section ids in the
desired order in one call, bypassing the volatile section id problem.
Fixes #1844.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Sync our coxpcall() implementation to the newest upstream version in order to
get access to the inner backtrace information and propagate these traces to
the browser in luci.dispatcher.dispatch().
This should make tracking down runtime errors much easier.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
After applying uci configuration, a full map reload is required in many
cases as the anonymous section identifiers might have been rehashed, causing
the rendered map to go out of sync.
To avoid that, add both a full page overlay preventing further page
interaction and let the apply widget forcibly reload the current view once
the operation is complete.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Mostly convert HTML tables to div based markup to allow for easier styling
in the future. Also change JS accessor code accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
http.getenv("SCRIPT_NAME") fail if it's not provided. This can happen in the login screen when we don't have any script to load.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
|
Should prevent the crash mentioned in #1779.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
On certain environments, mainly with the embedded uhttpd interpreter, the
luci.config class cannot be loaded due to a circular dependency with the
luci.model.uci class.
Break up the dependency by deferring the loading of luci.config in
luci.model.uci until it is actually needed.
Fixes #1803, FS#1553.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
UCI apply/rollback workflow
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
luci-base: show wifi chip identification on overview
|
|
A simple scan of the code indicates that currently no code in the repo
is accessing the sysauth= cookie
Closes openwrt/luci#1555
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
Switch to rpcd based uci apply/rollback workflow which helps to avoid soft-
bricking devices by requiring an explicit confirmation call after config
apply.
When a user now clicks "Save & Apply", LuCI first issues a call to uci apply
which commits and reloads configuration, then goes into a polling countdown
mode where it repeatedly attempts to call uci confirm.
If the committed configuration is sane, the confirm call will go through and
cancel rpcd's pending rollback timer.
If the configuration change leads to a loss of connectivity (e.g. due to bad
firewall rules or similar), the rollback mechanism will kick in after the
timeout and revert configuration files and pending changes to the pre-apply
state.
In order to cover such rare cases where a lost of connectivity is expected
and desired, the user is offered an "unchecked" apply option after timing
out, which allows committing and applying the changes anyway, without the
extra safety checks.
As a consequence of this change, the luci-reload mechanism is now completely
unsused since rpcd uses ubus config reload signals to reload affected
services, which means that only procd-enabled services will receive proper
reload treatment with the new workflow.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Switch to per-session save directories to decouple LuCI configuration changes
from system wide ones.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Show the correct wifi chip identification in case iwinfo
recognises the chip.
So far the wifidev.get_i18n function has practically always
returned just "Generic", but use iwinfo.hardware_name to
fetch the name.
In case iwinfo returns the default "Generic MAC80211", there
is a double 80211 in the final string, which is a cosmetic bug.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
This reverts commit 52cf265c9d12537d5f37043350328d30ca11bab4.
I accidentally committed unrelated changes.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Support a new boolean property `cors` which - if set to true - causes the
dispatcher to positively answer CORS OPTIONS requests after authentication
without actually running the dispatching target.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Decode the HTTP message bodies of any request carrying a Content-Length
header, not just those in POST requests.
This allows handling parameters in other methods, OPTIONS in particular.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add a 3rd return value to luci.util.ubus() containing the string value
of the error return value.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Ensure that the (table) length of a file upload value has nonzero length
by initializing the first table index with the file name.
This fixes tests in the form
x = luci.http.formvalue(...)
if x and #x > 0 then ... end
Fixes #1763.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|