Commit graph

554 commits

Author SHA1 Message Date
Jo-Philipp Wich
e7866c7dcc luci-mod-admin-full: add suggested italian translations
Merge two italian translations suggested in #1870 and add back two missing
dots accidentially removed from the translations in a previous commit.

Fixes: 588c8618b ("luci-mod-admin-full: fix translation interpolation in JS confirm() calls")
Suggested-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-06-08 16:05:48 +02:00
Jo-Philipp Wich
0e0ee2fed5 luci-mod-admin-full: git rid of embedded newlines in translation strings
Also switch one usage of raw '<%_ ... %>' interpolation to '<%: ... %>' in
order to avoid issues with translations using apostrophes.

Globally resnyc translations after the fix.

Fixes #1866.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-06-08 13:50:14 +02:00
Zheng Qian
2e7fa89e1a luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-06-08 16:43:40 +08:00
Jo-Philipp Wich
74be6f3974 treewide: switch firewall zone, network and iface lists to dropdown code
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>
2018-06-08 08:19:20 +02:00
Jo-Philipp Wich
9d48490729 luci-base: add markup, JS and CSS for new dropdown
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>
2018-06-08 08:14:36 +02:00
Jo-Philipp Wich
4cca96ef09 luci-base: support option aliases in luci.cbi
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>
2018-06-08 07:25:54 +02:00
Jo-Philipp Wich
7be3f0400c luci-base: fix some minor luci.model.uci issues
- 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>
2018-06-06 21:45:49 +02:00
Jo-Philipp Wich
2d352a9251 luci-base: cbi: atomically reorder uci sections
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>
2018-06-03 20:02:44 +02:00
INAGAKI Hiroshi
f28784b61e luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-06-01 02:45:53 +09:00
INAGAKI Hiroshi
2d196614f4 luci-base: sync translations
Synchronized translations with sources.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-06-01 02:20:05 +09:00
Jo-Philipp Wich
29b391d7bc luci-base: use common alert message markup
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-31 19:06:48 +02:00
Jo-Philipp Wich
298d164dd7 luci-base: update coxpcall() implementation, fix runtime error reporting
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>
2018-05-31 17:45:49 +02:00
Jo-Philipp Wich
5427395649 luci-base: add full page overlay during apply
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>
2018-05-31 15:38:42 +02:00
Jo-Philipp Wich
c3da1fc232 luci-base: cbi.js: remove unused serialize functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-30 16:04:07 +02:00
Jo-Philipp Wich
d1df5a6b7d luci-base: cbi.js: fix cbi_row_swap() after recent table markup changes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-30 15:59:52 +02:00
Jo-Philipp Wich
067d7dc9f7 treewide: convert HTML tables to div
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>
2018-05-28 15:18:45 +02:00
Jo-Philipp Wich
79c82237e3 luci-base: add element creation helper to cbi.js
Add a new helper function `E()` to cbi.js which can be used to conveniently
build HTML markup.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-28 15:18:45 +02:00
Ansuel Smith
e1ab470f4c luci-base: fix broken translation
Currently this translation refer to an old string, sync to the new one.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit c29ffe4dfc)
2018-05-27 22:09:05 +03:00
Hannu Nyman
6f630b5e66
Merge pull request #1834 from Ansuel/fixpo
luci-base: fix broken translation
2018-05-27 22:07:52 +03:00
Ansuel Smith
c29ffe4dfc
luci-base: fix broken translation
Currently this translation refer to an old string, sync to the new one.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2018-05-27 21:01:33 +02:00
Yusuf Soyipek
2d053d39d0
Update base.po
Some of the shortcomings in Turkish were added.
2018-05-27 16:17:15 +03:00
Hannu Nyman
9de9a71a9f i18n: one more fix for Polish translation
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-25 17:11:47 +03:00
Hannu Nyman
1341412893 i18n: one more fix for Polish translation
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-25 17:10:04 +03:00
Hannu Nyman
c5459f52f4 i18n: sync, fix and cleanup translations
* sync translations (aiccu removal)
* remove some other old strings
* fix Polish translation

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-25 16:52:30 +03:00
Hannu Nyman
36654b7f4d i18n: sync, fix and cleanup translations
* sync translations (aiccu removal)
* remove some other old strings
* fix Polish translation

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-25 16:44:50 +03:00
Ansuel Smith
da1e655294
luci-base: fix dispacher fail
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>
2018-05-23 02:52:08 +02:00
Hannu Nyman
b2a247a1e9 i18n: sync tranlations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-20 19:45:33 +03:00
INAGAKI Hiroshi
b01471b1fc luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-05-21 01:04:53 +09:00
INAGAKI Hiroshi
b1fd056fa5 i18n: sync translations
Synchronized translations with sources.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-05-21 01:04:53 +09:00
Jo-Philipp Wich
64da34b13c luci-base: handle potential crash in luci.model.network.interface.get_i18n()
Should prevent the crash mentioned in #1779.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-19 22:11:08 +02:00
Jo-Philipp Wich
9ed48ef2a6 luci-base: break circular luci.config <> luci.model.uci dependency
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>
2018-05-19 13:07:37 +02:00
Jo-Philipp Wich
828202ef52
Merge pull request #1769 from jow-/master
UCI apply/rollback workflow
2018-05-18 16:44:33 +02:00
Jo-Philipp Wich
80cb4fef8c luci-base: raise maximum POST value size to 100KB
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-18 16:43:29 +02:00
Hannu Nyman
521554f4a7
Merge pull request #1748 from hnyman/wifidata
luci-base: show wifi chip identification on overview
2018-05-18 12:51:24 +03:00
Rixerx
1faa9a3cb6 luci-base: update Polish translation
Signed-off-by: Rixerx <krystian.kozak20@gmail.com>
(cherry picked from commit 3782e74cf8)
2018-05-16 16:42:26 +03:00
Rixerx
3782e74cf8 luci-base: update Polish translation
Signed-off-by: Rixerx <krystian.kozak20@gmail.com>
2018-05-15 11:40:27 +02:00
Yousong Zhou
2f0f456b71 luci-base: harden cookie sysauth=
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>
2018-05-13 18:30:47 +08:00
Florian Eckert
6f3007980b luci-base: reload log on uci system change
If log configuration get changed in uci system no new values are applied
until reboot. Add /etc/init.d/log reload to exec option will solve this
issue.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-07 14:37:35 +08:00
Florian Eckert
3cb7452eba luci-base: fix i18n de typo for rc.local
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-07 13:51:18 +08:00
Jo-Philipp Wich
9f796fad3a luci-base: add transitional /etc/init.d/ucitrack
Ship an /etc/init.d/ucitrack for spawning a virtual service with the sole
purpose to track the configurations and dependencies formerly handled by
luci-reload.

Once all LuCI supported services ship with procd compatible init scripts,
the uci track support can be dropped.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 23:11:23 +02:00
Jo-Philipp Wich
8deb949551 treewide: rework uci apply workflow
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>
2018-05-05 23:11:23 +02:00
Jo-Philipp Wich
7cca313959 luci-base: enable uci session isolation
Switch to per-session save directories to decouple LuCI configuration changes
from system wide ones.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 23:11:23 +02:00
Jo-Philipp Wich
34821b15a5 luci-base: xhr.js: fix timeout setting with IE 11
Internet Explorer 11 requires the timeout to be applied after the open()
call, otherwise an invlaid state exception will be raised

Fixes aa6c97154 ("luci-base: extend xhr.js")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 21:16:53 +02:00
Hannu Nyman
4edc9256fa luci-base: show wifi chip identification on overview
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>
2018-05-05 21:20:41 +03:00
Jo-Philipp Wich
b0f3946570 luci-base: support hiding the "Back to Overview" button in cbi maps
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-03 08:25:26 +02:00
Jo-Philipp Wich
07de9190d8 Revert "luci-base: support hiding the "Back to Overview" button in cbi maps"
This reverts commit 52cf265c9d.

I accidentally committed unrelated changes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-03 08:24:36 +02:00
Jo-Philipp Wich
52cf265c9d luci-base: support hiding the "Back to Overview" button in cbi maps
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-03 08:22:55 +02:00
Ricardo Lamego
e55a5fa386 Fixing small typo
indentifies > identifies
2018-05-02 21:01:53 +01:00
INAGAKI Hiroshi
27af493779 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-05-03 00:25:41 +09:00
INAGAKI Hiroshi
0efc6daecf luci-base: sync translations
Synchronized translations with sources.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-05-02 23:53:48 +09:00
Jo-Philipp Wich
aa6c97154e luci-base: extend xhr.js
Add timeout options to get() and post() and introduce XHR.stop() to support
stopping a poll operation.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-26 09:40:17 +02:00
Jo-Philipp Wich
8459ec0ec8 luci-base: add simple CORS handling to luci.dispatcher
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>
2018-04-26 08:26:30 +02:00
Jo-Philipp Wich
7d13ec6010 luci-base: handle bodies of non-POST requests as well
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>
2018-04-26 08:26:19 +02:00
INAGAKI Hiroshi
f55a1faeaa luci-base: update japanese translation
Updated japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-04-26 00:30:23 +09:00
Jo-Philipp Wich
11f4a50b3f luci-base: additionally return error code strings in luci.util.ubus()
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>
2018-04-24 19:22:55 +02:00
Jo-Philipp Wich
914c661b58 luci-base: ensure that file upload values have length
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>
2018-04-24 13:44:40 +02:00
Jo-Philipp Wich
82abf9add9 luci-base: decode plus signs in x-www-form-urlencoded POST data
Depends on 5ef51b2ab ("lucihttp: update to latest HEAD").
Fixes #1755.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-22 12:03:23 +02:00
Jo-Philipp Wich
628048772d luci-base: ship rpcd uci access ACL
Ship an ACL definition for granting full read/write access to uci
configuration files via ubus rpc. This is a precondition for enabling
uci session isolation later on.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-21 14:59:41 +02:00
Jo-Philipp Wich
172155eb46 luci-base: properly handle repeated POST parameters
Restore the old luci.http behaviour of converting repeated POST params into
single tables holding all values instead of letting each repeated parameter
overwrite the value of the preceeding one.

Fixes, among other things, the handling of CBI dynamic list values.

Fixes #1752
Fixes 59dea0230 ("luci-base: switch to lucihttp based POST data processing")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-19 12:00:13 +02:00
Jo-Philipp Wich
9b22c9c1e1 luci-base: implement session handling in luci.model.uci
Introduce luci.model.uci.set_session_id() and luci.model.uci.get_session_id()
to set and get the effective session ID respectively.

When a session ID is set, it is sent as `ubus_rpc_session` attribute to rpcd,
causing it to use per-session change directories, isolating LuCI changes from
the global system uci state.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-19 11:42:12 +02:00
Jo-Philipp Wich
fc8f825e2f luci-base: drop dependency on libuci-lua
LuCI itself now uses ubus calls to interact with uci configuration while
the remaining direct libuci-lua users have been updated to either depend
on the binding library or to use luci.model.uci.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:54:53 +02:00
Jo-Philipp Wich
b4040aacb0 libs: move http.protocol.{date,mime,conditionals} to luci-lib-httpprotoutils
Also adjust the dependencies of components depending on these classes and
flatten the namespace from luci.http.protocol.* to luci.http.*

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
eb4571c6dc luci-base: fold luci.http.protocol into luci.http
With only the decoder routines remaining in luci.http.protocol, it makes no
sense to keep the low level protocol class around, so fold the remaining code
into the central luci.http class.

Also adjust the few direct users of luci.http.protocol accordingly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
8f66de12c1 luci-base: refactor luci.http
- Rewrite getcookie() to use liblucihttp header value parsing
 - Rewrite setfilehandler() to use local variables and have cleaner code
 - Fix build_querystring() to actually *en*code the given params

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
db0d5b33d0 luci-base: drop luci.util.dtable()
The dtable() function has no user in the entire LuCI repo, so drop it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
1d5a3123ed Revert "luci-base: add urldecode() and urlencode() C implementations"
This reverts commit ad7dc4a492.

Since we're using liblucihttp now, that library is the appropriate place to
add such decoding helper functions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
59dea0230c luci-base: switch to lucihttp based POST data processing
Use the liblucihttp provided multipart and x-www-urlencoded body parsers
and drop the old Lua parsing code.

The C based data parsers are way faster than their old Lua counterparts
while producing less string garbage and more correct results.

While refactoring the luci.http.protocol code, also drop unused functions
and dead code, heavily reducing the module size.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
f52c8d0b7f luci-base: switch to lucihttp.urldecode() and lucihttp.urlencode()
Drop the Lua implementation in luci.http.protocol and use the optimized C
variants of liblucihttp instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Qian Zheng
8e087a3d53 luci-base: zh_CN: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-04-18 09:22:07 +08:00
Hannu Nyman
b2eceb0bcc i18n: sync translations, cleanup
* sync translations
* clean-up old strings from adblock

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-10 18:27:07 +03:00
Jo-Philipp Wich
2b516423a0 luci-base: fix rendering of 404 HTML error template
This 404 error template rendering has been broken for a long time due to bad
function environment level in luci.template when invoking the rendering from
the toplevel dispatcher context.

Fix this issue by adding a local function indirection, essentially adding an
additional stack frame.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 12:03:15 +02:00
Jo-Philipp Wich
48a5864f06 luci-base: error404: do not access request env directly
Instead of attempting to access the request environment directly (which does
not work anyway using the CGI SGI), use the already sanitized
dispatcher.context.request property to print out the not found url.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 12:01:43 +02:00
Jo-Philipp Wich
b194b8882e luci-base: don't propagate null bytes in path information
It is possible to inject unescaped markup using a double encoded null byte
via PATH_INFO on certain leaf nodes.

Since there is no legitimate reason to handle null bytes in any part of the
requested url, simply skip over such bytes when parsing the PATH_INFO value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 11:41:32 +02:00
Jo-Philipp Wich
ad7dc4a492 luci-base: add urldecode() and urlencode() C implementations
The C implementations of urlencode and urldecode are considerably faster
than their current Lua counterparts.

On an AMD Geode system, the C variant is up to ten times faster when
decoding strings and up to four times faster when encoding them.

The functions are also designed to only allocate new strings when any
actual changes are required, otherwise they reuse the existing input
strings, reducing the overal memory usage somewhat.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 11:41:32 +02:00
Jo-Philipp Wich
b1b5723516 luci-base: consider empty parameters as well when testing POST requirement
The cbi class will react on an empty "cbi.submit" parameter as well so we
must intercept GET requests using that too.

Fixes 186e690c0 ("luci-base: dispatcher: reject non-POST requests with any cbi.submit value")

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-09 07:19:28 +02:00
Hannu Nyman
0ab0303527 i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-08 20:38:30 +03:00
Hannu Nyman
c7369830b6 timezone data: update to 2018d
Update timezone data to 2018d

http://mm.icann.org/pipermail/tz-announce/2018-March/000049.html

  In 2018, Palestine starts DST on March 24, not March 31.
     Adjust future predictions accordingly.
  Casey Station in Antarctica changed from +11 to +08

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-07 23:26:29 +03:00
Jo-Philipp Wich
8c636c87ee luci-base: fix luci.model.uci.get_first()
Properly propagate the config parameter to the foreach iterator in order
to fix get_first() lookups.

Fixes #1734.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 14:09:18 +02:00
Jo-Philipp Wich
5c31937a0f luci-base: escape path strings and field parameter
Prevent various XSS vectors by not interpolating field and path values
verbatim into script and html contexts.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 11:43:44 +02:00
Jo-Philipp Wich
b00b676923 luci-base: properly initialize cbi.js on SimpleForms
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 16:39:39 +02:00
Jo-Philipp Wich
bf71ae5f1b luci-base: emit a warning if cbi() delegates a SimpleForm instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:49 +02:00
Jo-Philipp Wich
24ac0d81ee luci-base: implement luci.model.uci.get_state()
Introduce a get_state() function which can be used to access legacy
uci state variables. This is usually not needed anymore but some
packages (mainly mwan3) still rely on this.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 09:24:36 +02:00
Jo-Philipp Wich
4d6c5d284b luci-proto-ipv6: clarify 6in4 local address hint
Make the hint message more explicit to tell users that the prefix size needs
to be specified as well.

Fixes #1559.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 08:49:41 +02:00
Jo-Philipp Wich
7b04d0bbcf luci-base: introduce luci.dispatcher.lookup()
The lookup function takes multiple, possibly malformed path fragments,
splits them on slashes, constructs a temporary path and looks up the
result in the dispatch tree.

If a matching node has been found, the function will return both the
node reference and the canonical url to it.

If no corresponding node is found, the function returns nil.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 23:03:01 +02:00
Jo-Philipp Wich
ac2210376d
Merge pull request #1709 from dibdot/get_interface-fix
luci-base/network.lua: fix get_interface function
2018-04-05 09:49:49 +02:00
Jo-Philipp Wich
c0d9c4f3ce treewide: filter shell arguments through shellquote() where applicable
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 09:37:43 +02:00
Jo-Philipp Wich
45cefe71f6 luci-base: introduce luci.util.shellquote()
Introduce a new function luci.util.shellquote() which encloses the given
string argument in single quotes and escapes any embedded single quote
characters.

This function is intended to be used when interpolating untrusted input
into shell commands.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 09:37:43 +02:00
Jo-Philipp Wich
9db5fa93af luci-base: fix possible shell injection in luci.tools.status.switch_status()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 00:32:56 +02:00
Jo-Philipp Wich
186e690c08 luci-base: dispatcher: reject non-POST requests with any cbi.submit value
Due to the fact that luci.model.cbi reacts on any "cbi.submit" value while
the dispatcher only required POST for cbi.submit == 1, the CSRF token
protection could be bypassed.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 00:15:22 +02:00
Jo-Philipp Wich
053c343ef1 luci-base: use FULL_REQUEST_URI on login form templates
Switch from using the REQUEST_URI CGI variable directly to the canonicalized
FULL_REQUEST_URI property.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04 23:30:49 +02:00
Jo-Philipp Wich
8c617c02b5 luci-base: add FULL_REQUEST_URI template property
Introduce a new template property FULL_REQUEST_URI which returns the full
canonicalized request URL built from SCRIPT_NAME, PATH_INFO and QUERY_STRING.

This new property is safer to use compared to using the raw REQUEST_URI CGI
environment variable directly as this value is essentially untrusted user
input which may contain embedded escaped slashes, double forward slashes and
other oddities allowing XSS exploitation or request redirection.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04 23:24:31 +02:00
Jo-Philipp Wich
70ffbe65a0 luci-base: add a strict flag to the hostname validator
Some applications, e.g. dnsmasq, do not allow hostnames starting with an
underscore, therefor extend the existing hostname datatype validator with
a `strict` which disallows a leading underscore.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04 23:21:53 +02:00
Jo-Philipp Wich
4024d4f224 luci-base: switch to ubus uci operations
Switch luci.model.uci to use ubus uci calls instead of driving libuci-lua
directly.

This prepares support for more advanced features such as per-session change
isolation and configuration rollback on errors.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04 23:21:53 +02:00
Qian Zheng
46a2b5ebea luci-base: zh_CN: update Simplified Chinese translation
Signed-off-by: Qian Zheng <sotux82@gmail.com>
2018-04-02 11:49:47 +08:00
Dirk Brenken
87c2d95264 luci-base/network.lua: fix get_interface function
* fix wrong private function call to handle
  section id as parameter (fix for #1687)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-03-31 07:11:02 +02:00
INAGAKI Hiroshi
caf4421603 i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-03-29 12:51:13 +09:00
Florian Eckert
70783f5802 luci-base: fix colspans calculation in tblsection
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-27 10:39:55 +02:00
Dirk Brenken
29d8770983 luci-base/util.lua: enhance checklib function
* enhance the checklib function in util.lua to check the 'fullpathexe'
  as well, e.g. this fixes runtime errors on the dhcp/dns template in
  environments without dnsmasq

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-03-22 10:40:42 +01:00
Jo-Philipp Wich
005f4fb7d4
Merge pull request #1654 from TDT-AG/pr/20180301-luci-several-fixes
luci-app-firewall/luci-base/luci-mod-admin-full: some fixes and improvements
2018-03-15 09:52:22 +01:00
Jo-Philipp Wich
28e3b32854 treewide: unify mac address handling
Use the new luci.ip MAC address facilities to parse and verify MAC addresses
in a common way, instead of relying on various ad-hoc solutions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:12:18 +01:00
Jo-Philipp Wich
dfba318140 luci-base: fix documentation spelling mistakes in luci.http.protocol
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:04:52 +01:00
Jo-Philipp Wich
6d253abd99 luci-base: fix documentation spelling mistakes in luci.util
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:03:58 +01:00
Jo-Philipp Wich
62630fbf88 luci-base: fix parsing of ethers(5)
The /etc/ethers file may contain any number of white space characters
between the mac address and the IP/hostname field, so extend the pattern
to allow for that.

Man ethers(5) also states that the IP field may be a symbolic hostname,
so test whether the name is an IP address or hostname before adding it
to the hints structure.

Fixes #1674.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-11 18:26:31 +01:00
Hannu Nyman
bf04031171
Merge pull request #1675 from dibdot/material-fix
luci-base/firewall_zonelist: fix visual interface/background alignment
2018-03-09 18:54:32 +02:00
Dirk Brenken
21fbe39858 luci-base/firewall_zonelist: fix visual interface/background alignment
* fix for #1667, tested with all standard themes

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-03-09 08:13:03 +01:00
Jo-Philipp Wich
bf49505ea0 luci-base: properly handle undefined IPv6 local-address information
If IPv6 prefix assignment is disabled, the "local-address" structure
might exist, but be empty which causes the adress formatting in the
network model class to bail out.

Verify the completeness of the "local-address" structure before using
it in order to avoid runtime errors.

Fixes #1657.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-02 14:42:52 +01:00
Jo-Philipp Wich
852ec6e28b luci-base, luci-mod-admin-full: store backup vars in luci configuration
Keep the ifname and bridge state backup variables in /etc/config/luci to not
pollute /etc/config/network.

Fixes #1655.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-02 12:44:35 +01:00
Florian Eckert
fa756d1fbb luci-base: fix browser.htm template
If cbi_init() is not called first browser gif will not be found.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-03-01 12:31:50 +01:00
Jo-Philipp Wich
461df8b0dc luci-base: do not assume a fixed host address in delegated prefix (#1484)
OpenWrt/LEDE introduced the "local-address" field a while back to expose the
effective local host address of the delegated prefix, so use that information
instead of assuming `[prefix]:1`.

Fixes #1484.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-02-16 17:05:52 +01:00
Jo-Philipp Wich
de4f1c9046 luci-base: rework client side IP validation types and support "hostid" type
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-02-16 17:05:48 +01:00
Jo-Philipp Wich
3e1e4d5eb6 luci-base: fix Lua-side ip6hostid() datatype validation
A valid host ID as accepted by netifd must meet the following criteria:

 - Is either one of the two special "random" or "eui64" strings
 - Or is a valid IPv6 address according to inet_pton(AF_INET6)
 - Has the first 64 bit set to zero

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-02-16 17:05:48 +01:00
Vladimir
c21d22c017 i18n-ru: fixed russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-02-07 17:37:34 +03:00
Hannu Nyman
eae2f37b62 timezone data: update to 2018c
Update timezone data to 2018c

http://mm.icann.org/pipermail/tz-announce/2018-January/000048.html

   Briefly:
   Sao Tome and Príncipe switched from +00 to +01.
   Brazil's DST will now start on November's first Sunday.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-02-02 18:21:58 +02:00
Vladimir
4567512bdd i18n-ru: fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-30 17:35:30 +03:00
Vladimir
7133c51012 i18n-ru: fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-29 18:03:37 +03:00
Vladimir
d74ff878e1 i18n-ru: fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-26 16:57:15 +03:00
Vladimir
3467df984f i18n-ru: fixed simple-adblock strin&rus translation
Signed-off-by: Vladimir <picfun@ya.ru>

refine

refine
2018-01-23 13:40:18 +03:00
Vladimir
1295b6ca38 i18n-ru: fixed russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-21 19:48:47 +03:00
Vladimir
8a929a9551 i18n-sync base.po changes
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-20 16:09:35 +03:00
Vladimir
bb87aac852 i18n-ru: Edits on the general pattern of Russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-20 14:02:48 +03:00
Hannu Nyman
7062250701 luci-mod-admin-full: fix typos on dhcp page
Based on #1568

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-01-20 10:51:29 +02:00
Jo-Philipp Wich
a441721d32 luci-base: log login attempts
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-17 18:49:42 +01:00
Vladimir
94f7c302bb i18n-sync change, added project info...
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-16 21:06:05 +03:00
Qian Zheng
ba741b40c3 luci-base: zh_CN: update Simplified Chinese translation
Signed-off-by: Qian Zheng <sotux82@gmail.com>
2018-01-16 20:22:37 +08:00
Vladimir
7541a2705e added project info, were reviewed in graphical mode, ready for a stable release
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-14 23:15:59 +03:00
Vladimir
72b9aa414e fixed russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-12 23:11:58 +03:00
Vladimir
26d60e9c7f fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-12 19:39:21 +03:00
Vladimir
7cdb92bfd0 fixed russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-11 23:17:43 +03:00
Vladimir
5d48227363 Correction by script i18n-sync.sh with editing of Russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-11 19:22:07 +03:00
Vladimir
7e3d52ec08 fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-11 01:43:46 +03:00
Vladimir
6a9ceee72b i18n: Added and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
[squashed commits]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-09 08:17:07 +01:00
Jo-Philipp Wich
e034f271d8 luci-base: adjust translations
- Modify labels for mesh forwarding and 802.11b rate options
 - Synchronize translations
 - Complete german base translation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-09 08:03:03 +01:00
Vladimir
ad3ee48813 fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-08 01:48:03 +03:00
Vladimir
cdb506d1b4 fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
2018-01-06 22:34:40 +03:00
Hannu Nyman
bd52bf4625 i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-01-06 09:40:39 +02:00
Vladimir
76b12b242a fixed and updated russian translation
Signed-off-by: Vladimir <picfun@ya.ru>
[renamed swedish advanced-reboot.po as well, fixed a syntax error,
 filtered updated files through ./build/i18n-sync.sh]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-03 21:44:55 +01:00
Jo-Philipp Wich
75e9338b87 luci-base: fix luci.sys.wifi.getiwinfo() on radio names
Fall back to using a phy-wide iwinfo handle if the vif query yields no result.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-03 21:27:49 +01:00
Jo-Philipp Wich
c8b48f9524 luci-base: reorder private functions
The _wifi_sid_by_ifname() function depends on _wifi_state_by_ifname()
so reorder the private helper functions accordingly to avoid nil value
call attempts.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-02 00:30:53 +01:00
Jo-Philipp Wich
f9b8d7ff7b luci-base: rework wireless state handling (#1179)
- fix mapping of ubus wireless state to uci declared vifs
 - fix leaking foreign vif info into per-phy iwinfo stats

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-02 00:24:10 +01:00
Jo-Philipp Wich
f2162a9a66 luci-base: require current libuci-lua
Upcoming changes will require libuci-lua features not present in
versions prior to version 2018-01-01.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-01 17:10:31 +01:00
Hannu Nyman
878a64f538 typo: fileystem --> filesystem
fix typo:
sed -i "s/fileystem/filesystem/"

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-12-28 14:15:16 +02:00
Hannu Nyman
ede51e4641 timezone data: update to 2017c
Update timezone data to 2017c

http://mm.icann.org/pipermail/tz-announce/2017-October/000047.html

   Briefly:
   Northern Cyprus switches from +03 to +02/+03 on 2017-10-29.
   Fiji ends DST 2018-01-14, not 2018-01-21.
   Namibia switches from +01/+02 to +02 on 2018-04-01.
   Sudan switches from +03 to +02 on 2017-11-01.
   Tonga likely switches from +13/+14 to +13 on 2017-11-05.
   Turks & Caicos switches from -04 to -05/-04 on 2018-11-04.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-11-11 18:59:14 +02:00
INAGAKI Hiroshi
7f48b25038 i18n: Sync translations
Synchronized translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2017-11-11 12:14:52 +09:00
Hannu Nyman
87ec343637
Merge pull request #1418 from yangfl/master
i18n: Update Chinese translation
2017-10-29 10:04:54 +02:00
yangfl
4dc055be85 i18n: Update Chinese translation
Signed-off-by: David Yang <mmyangfl@gmail.com>
2017-10-29 16:00:27 +08:00
Felix Yan
0167394a10
Fix typos in luci-base/luasrc/http/protocol.lua 2017-10-29 15:39:21 +08:00
Hannu Nyman
d4e3d5686a i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-10-28 10:21:41 +03:00
Jo-Philipp Wich
fbe7f90eed luci-base: fix client side "host" datatype validator
Fixes #1413.

Reported-by: Wojciech Jowsa <wojciech.jowsa@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-10-25 14:23:47 +02:00
Jo-Philipp Wich
824b9357ed Fix syntax errors in swedish translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-10-20 10:55:22 +02:00
INAGAKI Hiroshi
5018b476fc luci-base: Update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2017-10-20 13:55:17 +09:00