Commit graph

1762 commits

Author SHA1 Message Date
Zheng Qian
4e9271d5e8 luci-base: zh_CN: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-06-09 21:38:01 +08: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
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
b2a247a1e9 i18n: sync tranlations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-05-20 19:45:33 +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
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
Yousong Zhou
b810d99503 luci-mod-freifunk: fix redirect url
location.hostname lacks port info

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2018-05-07 22:27:58 +08:00
Yousong Zhou
c91ba4babc luci-mod-admin-full: use fs.glob instead nixio.fs.glob
It's how the module was named when "require"d and used by other code in
the same function

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2018-05-07 21:19:35 +08:00
Florian Eckert
690ae5c211 luci-mod-admin-full: no menu entry for leds if "/sys/class/leds" is empty
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2018-05-07 21:14:48 +08:00
Florian Eckert
da4fab0462 luci-mod-admin-full: change supports_reset() test for factory reset
The check "supports_reset" only covers /proc/mtd partitions. If we have
this the commands checks for names like ubi or rootfs_data. If this is
found the system is possible for a factory reset.  But on x86 the
situation is different.  We have no /proc/mtd partitions because this
system do not use a bare metall flash.

To solve this issue check if we have an overlay and if so we could do a
factory reset. This could be applied for system which uses bare metal
flash and system which uses FTL or harddisks.

Jffs2reset is the current command used for factory reset.  It will try
to find volume "rootfs_data" and if it's mounted will delete all files
under directory /overlay

luci-mod-admin-mini also has check for reset available, but we leave it
alone for now as it uses "mtd -r erase rootfs_data"

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2018-05-07 20:36:40 +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
055b621cf5 luci-mod-rpc: more auth/login fixes, expose further libraries
The previous attempt to fix authentication broke login functionality so
rework the code once again, this time with referencing helper functions
directly via the controller scope.

Furthermore, properly expose luci.sys.wifi.getiwinfo() and luci.ip.

For getiwinfo(), the RPC wrapped function accepts one further optional
parameter specifying the operation to invoke on the iwinfo instance.
If no operation is specified, a summary object containing all info
without country and scan list is returned.

Example to obtain iwinfo summary object:
  curl --cookie sysauth=... \
       --data '{"method": "wifi.getiwinfo", "params": ["wlan0"]}' \
		"http://192.168.1.1/cgi-bin/luci/rpc/sys"

Example to obtain iwinfo scan list:
  curl --cookie sysauth=... \
       --data '{"method": "wifi.getiwinfo", "params": ["wlan0", "scanlist"]}' \
		"http://192.168.1.1/cgi-bin/luci/rpc/sys"

The exposed luci.ip class uses a similar approach to allow invoking
instance methods on cidr objects. The new(), IPv4(), IPv6() and MAC()
constructors accept two further optional arguments, with the first
specifying the instance method to invoke and the second the value to
pass to the instance method.

Example to get list of IPv4 neighbours (ARP entries):
  curl --cookie sysauth=... \
       --data '{"method": "neighbors", "params": [{"family": 4}]}' \
		"http://192.168.1.1/cgi-bin/luci/rpc/ip"

Example to add 100 hosts to a network address:
  curl --cookie sysauth=... \
       --data '{"method": "IPv4", "params": ["192.168.0.1", "255.255.255.0", "add", 1000]}' \
		"http://192.168.1.1/cgi-bin/luci/rpc/ip"

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 23:11:07 +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
Jo-Philipp Wich
6a1cdca345 luci-mod-rpc: fix authentication via query string parameter
Localize the `authenticatior()` and `session_retrieve()` functions into the
`index()` function scope so that they're retained when extracting the
function into the dispatcher bytecode cache.

Also allow access to the global scope since upvalues do not work reliably
due to the out-of-context byte code caching of index functions.

Fixes https://github.com/openwrt/luci/issues/1300#issuecomment-381352765
Fixes feefc600e ("luci-mod-rpc: rework authentication and session handling")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 19:56:26 +02: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
Hannu Nyman
c946efee0f
Merge pull request #1775 from musashino205/l10n/base-upd-ja
luci-base: update Japanese translation
2018-05-02 18:40:08 +03: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
Jo-Philipp Wich
9adbd79faa luci-mod-admin-full: canonicalize configured static lease MAC
When reading the configured mac address of the static lease, filter it
through luci.ip.checkmac() to canonicalize and uppercase the value for
mapping it against the combo box host hints.

Fixes #1772.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-02 16:55:22 +02: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
8335997df5
Merge pull request #1705 from Mushoz/add-igmp-snooping
luci-mod-admin-full: add igmp snooping option
2018-05-02 16:31:27 +02:00
Hannu Nyman
8656ab726d
Merge pull request #1767 from SvenRoederer/patch-2
luci-mod-freifunk: align spacing
2018-04-28 08:48:09 +03: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
Sven Roederer
c4460f09a5
luci-mod-freifunk: align spacing
remove some tailing tabs and an empty line in OSMLatLon.htm

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2018-04-25 21:13:00 +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
Hannu Nyman
d42ce28e20
Merge pull request #1742 from fantom-x/dhcp_cachesize_max
luci-mod-admin-full: limit dns cachesize to 10000
2018-04-10 17:36:29 +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