summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/util.lua
AgeCommit message (Collapse)Author
2018-05-31luci-base: update coxpcall() implementation, fix runtime error reportingJo-Philipp Wich
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-04-24luci-base: additionally return error code strings in luci.util.ubus()Jo-Philipp Wich
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-18luci-base: drop luci.util.dtable()Jo-Philipp Wich
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-18luci-base: switch to lucihttp.urldecode() and lucihttp.urlencode()Jo-Philipp Wich
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-05luci-base: introduce luci.util.shellquote()Jo-Philipp Wich
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-03-22luci-base/util.lua: enhance checklib functionDirk Brenken
* 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>
2016-08-04luci-base: improve string format error reportingJo-Philipp Wich
In mod metamethod, execute string format under pcall() and rethrow error in caller context to report caller of function in errors and not the meta method itself. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-04-08luci-base: utils: Make checklib return a booleanDaniel Dickinson
Using tristate is counter-intuitive and probably doesn't provide a lot of benefit so we use a boolean and treat "don't know" as false (because it is safer than showing options that are not actually available). Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2016-03-25luci-base: Add option to check linked librariesDaniel Dickinson
Some packages have different variants that have different capabilities depending on which libraries against which they are linked. Add a function to check which library a binary links against in order to determine available functionality. Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2016-03-20luci-base: fix bug in util.lua in 'shellsqescape'Hannu Nyman
Fix a bug introduced by #561 Function 'shellsqescape' calls 'gsub' with the empty result string 'res' instead of the actual parameter 'value'. This leads into error: .../util.lua:160: bad argument #1 to 'gsub' (string expected, got nil) Fix error by passing the correct parameter to the function. After the fix, the unmount button introduced by #561 finally works. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-12-02luci-base: Add function for shell single-quote parameter escapingDaniel Dickinson
When using os.execute or luci.sys.call the shell is called with the command line which means that standard shell interpretation of strings occurs. To allow to use these commands more easily we add functions for properly escaping single-quoted strings used on the command line
2015-11-21luci-base: switch to luci-lib-jsoncJo-Philipp Wich
Add dependency on luci-lib-jsonc and use it to reimplement luci.util.serialize_json(). Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-03-18luci-base: fix backslash escaping in luci.util.serialize_json()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-29Move inline documentation into separate files.Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22luci-base: add luci.util.serialize_json()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-16Globally reduce copyright headersJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-15luci-base: add luci.util.ubus()Jo-Philipp Wich
Add luci.util.ubus() convenience wrapper which establishes a connection on the first call. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08luci-base: luci.util: rewrite threadlocal code to not confuse minifierJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08Rework LuCI build systemJo-Philipp Wich
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>