summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
AgeCommit message (Collapse)Author
2015-12-12modules/luci-base: Move LuCI FileUpload directory to /etc/luci-uploads and ↵Daniel Dickinson
save across sysupgrade /lib/uci/upload is a rather odd place for configuration files Also the files were not saved across sysupgrade, which is somewhat counter-productive for configuration files. Signed-off By: Daniel Dickinson <openwrt@daniel.thecshore.com>
2015-12-09luci-base: rewrite luci.sys.net.conntrack()Jo-Philipp Wich
The new function is twice as fast as the old implementation and properly summarizes outgoing and incoming byte and packet counters. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-12-02luci-base: fix escaping lua string to js reprYousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-12-02luci-base: add hostport and ipaddrport validation typesJo-Philipp Wich
Add two new types 'hostport' and 'ipaddrport' to validate strings in the form 'sub.example.org:1234' and '0.0.0.0:80'. The 'hostport' accepts hostnames or IP addresses followed by a colon and a port number while the 'ipaddrport' type accepts numeric IP addresses only, followed by a colon and a port. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
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-26Merge pull request #534 from yousong/add-luci-proto-ppposshJo-Philipp Wich
Add luci proto pppossh
2015-11-21luci-base: use board.json to infer switch netdevJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
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-11-17luci-base: eliminate use of uci state vars in luci.model.networkJo-Philipp Wich
Also implement :ipaddrs() and :ip6addrs() helper for network instances. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-11-16luci-base: fix uci documentation issue (#538)Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-11-03Redirect to root on empty pathJoel Pedraza
* Prevents an empty Location header * Useful in environments where build_url() could return an empty string (such as http server rewrites requests to /cgi-bin/luci) Signed-off-by: Joel Pedraza <github@saik0.net>
2015-11-03luci-base: add support for DynamicList with FileBrowserYousong Zhou
Two new arguments url, defpath were added to cbi_dynlist_init() for initializing the brower button. An example of usage identity = section:taboption("general", DynamicList, "identity", translate("List of SSH key files for auth")) identity.datatype = "file" Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-11-03luci-base: urlencode: encode all except unreserved characters.Yousong Zhou
As per http://tools.ietf.org/html/rfc3986#section-2.3 Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde. unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-11-01template cbi/value.htm implement documented property maxlengthChristian Schoenebeck
template cbi/value.htm implement already documented property maxlength Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-10-31cbi.lua: Implement "readonly" property for "Value"Christian Schoenebeck
cbi.lua: Implement "readonly" property for "Value" Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-10-31template cbi/value.htm: add "readonly" propertyChristian Schoenebeck
template cbi/value.htm: add "readonly" property Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-10-30cbi.lua: Implement Flag.validate functionChristian Schoenebeck
cbi.lua - Implement Flag.validate function to be overwritable - rewritten if clause for easier reading ;-) Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-10-27luci-base: eliminiate use of uci state vars in luci.sysJo-Philipp Wich
Rewrite `luci.sys.wifi.getiwinfo()` to use the ubus wireless state instead of depreacated uci state vars in order to map abstract network notation to wireless ifnames. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-22luci-base: dispatcher expose test_post_security()Jo-Philipp Wich
Allows external code to perform POST and token checking manually. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-21luci-base: ensure that base url is emitted with trailing slashJo-Philipp Wich
Now that we don't have an url token anymore, '/cgi-bin/luci' becomes a valid url while cookies are restricted to only '/cgi-bin/luci/' and below. In order to ensure that the first request after login refers to a path covered by the authentication cookie, change build_url() to always append a trailing slash if we're referring to the base url. This should fix the login problems mentioned in #516. While we're touching the dispatcher, also remove remaining url token code. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-21luci-base: remove security token from urlsJo-Philipp Wich
Now that sensitive urls require post requests and only accept them if a valid security token is sent along the request, we can drop the global random url token to improve LuCI usability. The main improvement is the ability to use multiple tabs with the same login session, but also deep linking to specific urls without the need for another login becomes feasible, e.g. for documentation purposes. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-20luci-base: filter invalid opkg status linesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-20luci-base: generalize post security token handlingJo-Philipp Wich
* Add a generic helper function to check need for post / csrf token validation * Remove custom token verification in cbi targets * Support requiring post security depending on specific submit parameters, usable through post_on() action Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-12Timezone information: update to 2015gHannu Nyman
Changes in 2015g: http://mm.icann.org/pipermail/tz-announce/2015-October/000034.html Norfolk moves from +1130 to +1100 on 2015-10-04 at 02:00 local time. Fiji's 2016 fall-back transition is scheduled for January 17, not 24. Fort Nelson, British Columbia will not fall back on 2015-11-01. It has effectively been on MST (-0700) since it advanced its clocks on 2015-03-08. New zone America/Fort_Nelson. Note: the Turkey-related one-time rule change is not apparently catched by the zoneinfo2lua script, so that change is not included in this commit. (Turkey's 2015 fall-back transition is scheduled for Nov. 8, not Oct. 25.) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-10-08luci-base: prevent UCI changes in CBI if form is not in submit stateJo-Philipp Wich
Only process submitted data if the "cbi.submit" parameter is present as the dispatcher will verify the integrity of the CSRF token in this case. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-07Globally replace luci.dispatcher.build_url(...) with url(...) invocationsJo-Philipp Wich
Also concat multiple string arguments into one while we're at it. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-07luci-base: expose luci.dispatcher.build_url() as url() in templatesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-07luci-base: protect simpleforms with CSRF tokensJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-06luci-base: switch to POST action for service reloadJo-Philipp Wich
Switches the service reload calls to CSRF token protected POST action. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-06luci-base: protect CBI forms with CSRF tokensJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-06luci-base: add support for POST-only actions with CSRF token checkJo-Philipp Wich
Add the dispatcher infrastructure to restrict certain routes to POST requests only in conjunction with verification of CSRF tokens. This is the first step to get rid of the CSRF token in the url in favor to tokens embedded in forms. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-06Globally convert headline anchors into name attributes.Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-09-16Luci opkg/packages: Show package size in list of available packagesHannu Nyman
Add package *.ipk size information to package listing in Luci, as opkg was today extended to support listing also the size information. Visible fields are now: name, version, size, description That will help users considering installation of a certain package to assess its size impact on flash. Note: Opkg data includes the size of the .ipk file, not the expanded size. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-09-01Luci opkg/packages: Limit version string display to 26 charsHannu Nyman
Many packages currently include a git commit hash in version string. That makes versions string very long and the version column takes much space when listing available/installed packages in Luci. Longest version string is 58 characters (micropython). 85 packages have at least 50 chars and 150 packages at least 40 chars. Adjust Luci to display max. 26 characters (= luci's own version string). Longer version strings are cut to: "first 21c" + ".." + "last 3c" The last 3 chars are used to preserve the possible PKG_REVISION string. E.g. 'opkg' has only hash+PKG_REVISION, so using only start of the string might not be optimal. Examples: 1.3.10-20150302-f2a889564b3a215902622b040a1247af38cb8203-1 1.3.10-20150302-f2a88..3-1 0.1-20150302-654c7d288603f7dae09eb09b57fb67b38c7ac6c3-1 0.1-20150302-654c7d28..3-1 9c97d5ecd795709c8584e972bfdf3aee3a5b846d-7 9c97d5ecd795709c8584e..d-7 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-09-01Fix module lines in several luadoc filesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-09-01luci.utils.contains: update documentation to match realityKarl Palsson
Signed-off-by: Karl Palsson <karlp@remake.is>
2015-08-18http.protocol: Support filehandlers for unhandled encodingsKarl Palsson
The setfilehandler() functions used for mime and url encoded message bodies all operate with a signature of fh(meta, chunk, eof), but for unhandled encodings, the callback was directly assigned to the sink function, which has a signature of snk(chunk). Insert a wrapper to properly generate the EOF flag, and include a stub "meta" block providing a virtual "name" and also the original client provided Content-Type header, to possibly help with taking alternative actions in the file handler. The sink function created for raw content decoding also used the wrong signature for the sink function. Signed-off-by: Karl Palsson <karlp@remake.is>
2015-08-17Timezone information: update to 2015fHannu Nyman
Changes in 2015e and 2015f: http://mm.icann.org/pipermail/tz-announce/2015-June/000032.html http://mm.icann.org/pipermail/tz-announce/2015-August/000033.html Morocco will suspend DST from 2015-06-14 03:00 through 2015-07-19 02:00, not 06-13 and 07-18 as we had guessed. Assume Cayman Islands will observe DST starting next year, using US rules. Although it isn't guaranteed, it is the most likely. North Korea switches to +0830 on 2015-08-15. The abbreviation remains "KST". Uruguay no longer observes DST. Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-08-04ipkg.lua: compare_versions() Replace Lua Math Library callChristian Schoenebeck
function compare_versions(): replace Lua Math Library call with if clause Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-08-02cbi.lua: Fix Flag.parse() to set "self.section.changed"Christian Schoenebeck
Add to set "self.section.changed" on changes like other values do. Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-07-27ipkg.lua: new function compare_versionChristian Schoenebeck
* minor fix function _list() set to local * new function compare_version() lua version of opkg compare-version Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
2015-07-27Fix: A disabled wireless network may be shown as enabled, when multiple ↵Georgi Valkov
networks are defined on the same radio.
2015-07-27Fix: Status for disabled wireless networks may display the SSID, BSSID and ↵Georgi Valkov
Mode of an active network on the same radio.
2015-07-27Workaround: saved administration site user and pass may appear on the ↵Georgi Valkov
Wireless configuration page, replacing the WPA key.
2015-06-10Merge pull request #389 from hnyman/timezone2015dJo-Philipp Wich
Timezone information is updated to 2015d, released on 24 Apr 2015.
2015-05-26luci-base: prevent parsing the form input after cbi emergency saveJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-26luci-base: fallback to a simple text editor if uci config cannot be loadedJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-23Timezone information is updated to 2015d, released on 24 Apr 2015.Hannu Nyman
I used build/zoneinfo2lua.pl to pull data from my Ubuntu 15.04. Changes in 2015d are rather small: http://mm.icann.org/pipermail/tz-announce/2015-April/000031.html Changes affecting future time stamps Egypt will not observe DST in 2015 and will consider canceling it permanently. For now, assume no DST indefinitely. Change affecting time zone abbreviations The abbreviations for Hawaii-Aleutian standard and daylight times have been changed from HAST/HADT to HST/HDT, as per US Government Printing Office style. This affects only America/Adak since 1983, as America/Honolulu was already using the new style. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-04-19Timezone data: Update to 2015cHannu Nyman
Timezone information is updated to 2015c, released on 14 Apr 2015. I used build/zoneinfo2lua.pl to pull data from my Ubuntu 14.10. Changes in 2015b and 2015c are rather small: http://mm.icann.org/pipermail/tz-announce/2015-March/000029.html http://mm.icann.org/pipermail/tz-announce/2015-April/000030.html Mongolia will start observing DST again this year, from the last Saturday in March at 02:00 to the last Saturday in September at 00:00. Palestine will start DST on March 28, not March 27. Also, correct the fall 2014 transition from September 26 to October 24. Adjust future predictions accordingly. Egypt's spring-forward transition is at 24:00 on April's last Thursday, not 00:00 on April's last Friday. 2015's transition will therefore be on Thursday, April 30 at 24:00, not Friday, April 24 at 00:00. Similar fixes apply to 2026, 2037, 2043, etc. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-03-18luci-base: fix backslash escaping in luci.util.serialize_json()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>