Commit graph

1681 commits

Author SHA1 Message Date
Jan-Philipp Litza
e32a877aa4 luci-lib-jsonc: Ignore non-string-or-number keys in tables
Previously, the following caused a segmentation fault:

    json.stringify({[{}] = true})

This was caused by lua_tostring() returning NULL for anything but
strings and numbers, letting json_object_object_add crash.

This patch makes jsonc ignore all keys which have no string
representation altogether.

Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
2015-08-30 15:51:17 +02:00
Jo-Philipp Wich
376f038726 luci-lib-nixio: pass exact sockaddr length to getnameinfo()
Musl libc requires the length parameter of getnameinfo() to be exactly
`sizeof(struct sockaddr_in)` or `sizeof(struct sockaddr_in6)`, depending on
the passed sockaddr family.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-07-30 22:38:36 +02:00
Matthias Schiffer
304eec2eba luci-lib-json: ignore null keys to allow encoding empty objects
There is currently no way to encode an empty object {}, as empty tables are
encoded as empty lists [].

With this patch, encode() will ignore table fields with the key json.null (which
doesn't make sense anyways). This allows adding a field with key json.null to
force encoding it as an object.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2015-06-04 21:13:41 +02:00
Jo-Philipp Wich
84346cd178 Move inline documentation into separate files.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-29 16:26:46 +01:00
Jo-Philipp Wich
cf7e2695cc luci-lib-jsonc: add api documentation
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28 22:31:28 +01:00
Jo-Philipp Wich
7ca5222f4b luci-lib-ip: add api documentation
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28 22:31:14 +01:00
Jo-Philipp Wich
fb69e15e8d luci-lib-nixio: move CHANGELOG and README into nixio namespace
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28 22:29:45 +01:00
Jo-Philipp Wich
e6e74b712f luci-lib-ip: add functions to deal with IPv6 mapped IPv6
* Add luci.ip.cidr.is6mapped4() to test whether an IPv6 CIDR is a mapped IPv4 one
 * Add luci.ip.cidr.mapped4() to derive IPv4 from mapped CIDR
 * Remove mapped IPv4 workaround from constructor as it breaks genuine addrs like ::ffff:0

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28 14:21:04 +01:00
Jo-Philipp Wich
65f0135491 luci-lib-ip: multiple fixes
* Fix broken neighbor filtering by address range due to uninitialized memory
 * Fix wrong sizeof in _cidr_add_sub when adding/substracing IPv6 addresses
 * Properly convert numeric values to IPv6 addresses

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-28 13:23:24 +01:00
Jo-Philipp Wich
73b19f6382 libs: add luci-lib-jsonc, a Lua binding for JSON-C
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-26 16:49:23 +01:00
Jo-Philipp Wich
8c8c69fa5d luci-lib-ip: accept 2nd netmask argument in new(), IPv4() and IPv6()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-26 10:47:39 +01:00
Jo-Philipp Wich
0d32e69f16 luci-lib-ip: fix segfault in link() on systems with ip6gre support
If an ip6gre interface is queried, the resulting link local address string
of 47 byte overflowed the buffer of 32 bytes used to hold the translated
address.

Increase the address string buffer to 48 byte and check the address length
prior to writing it into the buffer to avoid future problems with longs
link local addresses.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-25 21:39:17 +01:00
Jo-Philipp Wich
eb1ef783f6 luci-lib-ip: fix netlink receiving in link()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-24 14:25:53 +01:00
Jo-Philipp Wich
671566d701 luci-lib-ip: add link() method to get basic iface info
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-23 13:00:51 +01:00
Jo-Philipp Wich
4ab9f972c4 luci-lib-ip: always return table for dump, even if empty
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22 23:59:11 +01:00
Jo-Philipp Wich
e85698638f luci-lib-ip: support filtering neighbors by mac or dest addr
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22 23:43:56 +01:00
Jo-Philipp Wich
e9bfa5fe79 luci-lib-ip: fix routes() for non-callback invocations
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22 15:25:41 +01:00
Jo-Philipp Wich
8cf1b1374d luci-lib-nixio: always assume Linux target (#307)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22 15:01:50 +01:00
Jo-Philipp Wich
0ff02e3a13 libs: add luci-lib-ip
Add new luci.ip library which is an api compatible C reimplementation
of ip.lua. It also supports dumping the system routing table and neighbour
entry database via netlink.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-22 15:01:50 +01:00
Yuzo
3dbdff7096 add params support in options 2015-01-22 13:12:48 +08:00
Yuzo
b6d4f32dcc send Cookie in a single header line, follow browser behavior 2015-01-22 12:50:58 +08:00
Yuzo
c30cf9abd4 add sock::readall() to ensure the response body is complete 2015-01-22 11:34:00 +08:00
Jo-Philipp Wich
41d2b33087 Update my email addresses in the license headers
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-16 23:49:44 +01:00
Jo-Philipp Wich
7a3493b1f7 Globally reduce copyright headers
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-16 23:38:38 +01:00
Jo-Philipp Wich
575e1093ab luci-lib-nixio: drop "bit" compatibility class
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-15 16:05:31 +01:00
Jo-Philipp Wich
0b491a05ca luci-lib-px5g: disable MIPS16
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-15 11:12:11 +01:00
Jo-Philipp Wich
f4fb587125 luci-lib-px5g: add missing src Makefile and fix depends
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-09 13:19:28 +01:00
Jo-Philipp Wich
3c6d03ddee luci-lib-luaneightbl: add src Makefile and fix dependencies (#282)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-09 13:04:01 +01:00
Jo-Philipp Wich
4cb3aed0ca Remove obsolete .mk files
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08 16:49:42 +01:00
Jo-Philipp Wich
1bb4822dca Rework LuCI build system
* 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>
2015-01-08 16:26:20 +01:00
Manuel Munz
0103344663 httpclient: fix logic error for redirects 2014-10-16 12:22:49 +02:00
Jo-Philipp Wich
e4be3f94a0 build: remove abandonned sgi libraries 2014-06-11 13:33:03 +00:00
Jo-Philipp Wich
7043c30e0e build: introduce luci-base
Merges libs/core, libs/ipkg, libs/web, libs/sys, libs/sgi-cgi, libs/sgi-uhttpd,
modules/admin-core, themes/base and protcols/core into modules/base and renames
luci-lib-core to luci-base.
2014-06-11 13:29:05 +00:00
Jo-Philipp Wich
91b97bc9f6 Remove unmaintained components: lucid, fastindex, niu 2014-06-11 12:37:19 +00:00
Jo-Philipp Wich
b2d5843ddc libs/sys: make sure to always return a table from arptable() when no callback is passed (#671) 2014-04-24 21:42:48 +00:00
Jo-Philipp Wich
c3bf59a91d libs/sgi-uhttpd: fix binding to properly work with current uhttpd2 implementation
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-03-28 16:59:08 +00:00
Jo-Philipp Wich
0efb19876b libs/sgi-uhttpd: do not assume env.CONTENT_LENGTH to be a number
env.CONTENT_LENGTH as passed by uhttpd might be a string, so explicitely
convert it using tonumber().

Issue has been reported by Catalin Patulea <cat@vv.carleton.ca>

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-03-28 16:37:03 +00:00
Jo-Philipp Wich
b92a01d3ae httpclient: fix parsing of IPv6 URLs (#662) 2014-02-05 13:44:07 +00:00
Jo-Philipp Wich
c1bd1e59d3 build: fix clean targets in Makefiles (#667) 2014-02-05 13:35:34 +00:00
Jo-Philipp Wich
cb6bdd9f50 libs/core: further network model compatibility fixes 2013-12-03 15:23:09 +00:00
Jo-Philipp Wich
e22e6dd9ca libs/core: make luci.model.network compatible with new wireless netifd integration 2013-12-03 15:04:34 +00:00
Jo-Philipp Wich
297d368ecc libs/json: add proper support for decoding unicode escapes 2013-12-03 15:04:32 +00:00
Patrick Grimm
54001e307e add luaneightbl: this is an arp replacement for ipv6. neightbl.get(wlan0) return ip,mac table this can use in a for loop "for ip,mac in pairs(t) do" Thanx Cyrus 2013-07-07 12:45:59 +00:00
Steven Barth
5200eb1577 Add support for stateful DHCPv6 2013-05-23 10:14:20 +00:00
Jo-Philipp Wich
5fed5c91f8 libs/web: do not cast to string when using network_netlist widget (#560) 2013-04-04 14:06:26 +00:00
Jo-Philipp Wich
875bfd7706 libs/core: do not consider alternative routing tables in luci.model.network for now 2013-04-04 14:06:12 +00:00
Jo-Philipp Wich
4fa798dffe libs/sys: fix incomplete options table when parsing iptables rules 2013-03-27 13:28:26 +00:00
Jo-Philipp Wich
f804a21c8d libs/core: fallback to ipv6-prefix-assignment if ipv6-address is empty 2013-03-19 17:26:01 +00:00
Jo-Philipp Wich
c6712bdc3c libs/web: allow '!' and '.' symbols in phonedigit datatype 2013-02-05 13:15:48 +00:00
Manuel Munz
5b129819cc modules/admin-full: Add swap info to admin_status page if swap is available, #533 2013-01-30 13:36:20 +00:00
Jo-Philipp Wich
6bec9b6bcf libs/web: further endian fixes in lmo processing 2013-01-27 18:18:47 +00:00
Jo-Philipp Wich
bb6ba23b3d libs/web: add missing byteswap of index offset when parsing index offset of lmo files 2013-01-26 19:57:18 +00:00
Jo-Philipp Wich
ad3ec0d4ee libs/web: fix endian issues in lmo conversion leading to a bad index order 2013-01-26 18:38:01 +00:00
Jo-Philipp Wich
7fd1bb5831 libs/web: support dependencies on mvalues 2013-01-22 11:52:27 +00:00
Jo-Philipp Wich
686de0fbec move dhcpv6 support into luci-proto-6x4, rename luci-proto-6x4 to luci-proto-ipv6 2013-01-22 10:44:28 +00:00
Jo-Philipp Wich
a4f3f52d1c New IPv6 integration 2013-01-22 10:44:16 +00:00
Jo-Philipp Wich
4fec63df9e libs/core: remove now obsolete uint() wrapper in network model 2013-01-13 21:03:28 +00:00
Jo-Philipp Wich
237aa91089 libs/web: include limits.h to fix compilation on OS X (#531) 2013-01-13 18:33:21 +00:00
Jo-Philipp Wich
a52a6a4f22 libs/sys: fix luci.sys.processes.list() for entries with spaces i nthe STAT column (#528) 2013-01-11 18:16:26 +00:00
Jo-Philipp Wich
018cbe69a9 libs/web: fix missing escapes in network_ifacelist widget 2012-12-25 02:43:03 +00:00
Jo-Philipp Wich
33fba71fc9 libs/core: make luci.util.spairs(), kspairs() and vspairs() return the sequential index as 3rd variable 2012-12-25 02:28:20 +00:00
Jo-Philipp Wich
8cfa5cc7c5 don't use symlink to /lib/functions.sh
Signed-off-by: Luka Perkov <luka@openwrt.org>
2012-12-20 15:01:04 +00:00
Jo-Philipp Wich
d4987d7863 ccache not loading or storing cache files
I've noticed that there is nothing in my /tmp/luci-modulecache
directory. Digging into it it looks like because both the expected uid
and mode of the files doesn't match, so for security reasons they're
long being loaded or saved by ccache.lua (from the luci-lib-core
package). I'm not sure how far back this has been broken but I it
appears to have been quite some time, possibly years?

I've included a patch which updates the checks to use the right newer
function name / structure name. It decreases page load times by about
10-15% on my bcm2708 (raspberrypi). I can create a ticket if you'd
prefer. The patch is against the luci-0.11 branch but should apply to
trunk as well.

Signed-off-by: Bryan Mayland <bmayland@leoninedev.com>
2012-12-19 00:35:30 +00:00
Jo-Philipp Wich
564ca0accd libs/web: make JS String.format() and String.serialize() available as prototype options, introduce String.nobr() 2012-12-02 14:20:36 +00:00
Jo-Philipp Wich
7c3c6b013b libs/web: let luci.i18n.setlanguage() return the lang that was actually loaded 2012-12-02 13:30:46 +00:00
Jo-Philipp Wich
ce8a22d1b4 libs/core: remove unused luci.util.escape(), map luci.util.striptags() to luci.template.parser.striptags() 2012-11-26 14:26:46 +00:00
Jo-Philipp Wich
f7b4fd2979 libs/web: various changes in template library
- rename sanitize_pcdata() and sanitize_utf8() to pcdata() and utf8()
	- implement striptags()
2012-11-26 14:26:43 +00:00
Manuel Munz
e2f3b8923d libs/web: Allow to disable buttons in cbi models from the controller 2012-11-26 13:11:41 +00:00
Jo-Philipp Wich
848e43a5b4 remove .i18n annotations from controller files 2012-11-26 12:53:43 +00:00
Daniel Golle
d07036b59c "Waiting for router..." is misleading on non-router devices. Use "Waiting for changes to be applied..." instead. 2012-11-26 11:07:11 +00:00
Jo-Philipp Wich
68e9458ae0 libs/web: remove unneeded include 2012-11-25 19:22:38 +00:00
Jo-Philipp Wich
cd0bb63394 libs/web: remove leftover debugging code in template_parser.c 2012-11-25 19:18:15 +00:00
Jo-Philipp Wich
bb276a7c7b libs/core: use luci.template.parser.hash() instead of lmo.hash() 2012-11-25 19:18:10 +00:00
Jo-Philipp Wich
0e50aa690a libs/web: rewrite template engine, merge lmo library
- template parser: merge lmo library
	- template parser: rewrite to operate on memory mapped files
	- template parser: implement proper line number reporting on syntax errors
	- template parser: process translate tags directly and bypass Lua
	- template lmo: introduce load_catalog(), change_catalog() and close_catalog()
	- template lmo: rewrite index processing to operate directly on the memory mapped file
	- template lmo: implement binary search keys, reducing the lookup complexity to O(log n)
	- po2lmo: write sorted indixes when generating *.lmo archives
	- i18n: use the template parser for translations
	- i18n: stub load(), loadc() and clear()
	- i18n: map setlanguage() to load_catalog()
2012-11-25 19:17:55 +00:00
Jo-Philipp Wich
c647ff9f0e libs/lmo: fix whitespace handling in string hashing, optimize code 2012-11-23 10:15:02 +00:00
Jo-Philipp Wich
72d1549e8b libs/lmo: canonize key strings before hashing them, fixes missing translations for original strings with line breaks or white spaces embedded 2012-11-21 23:26:30 +00:00
Jo-Philipp Wich
06c8c28bab libs/core: introduce get_status_by_address() in luci.model.network 2012-11-21 20:13:53 +00:00
Jo-Philipp Wich
2675ad1c63 libs/web: fix luci.http.write_json() to properly encode control chars in strings 2012-11-21 16:04:13 +00:00
Jo-Philipp Wich
e3bb15012b libs/ipkg: simplify parsing logic to take advantage of the opkg improvements in trunk, introduce find() operation 2012-11-15 20:59:03 +00:00
Jo-Philipp Wich
431d4e8eff merge branch changes into trunk 2012-10-29 13:09:31 +00:00
Jo-Philipp Wich
c802c941cb libs/web: relax validation for hostnames to allow names like _kerberos._udp.EXAMPLE.COM 2012-10-06 23:10:43 +00:00
Jo-Philipp Wich
b0d3b82400 libs/web: transparently handle userdata in write_json() 2012-09-15 14:25:18 +00:00
Jo-Philipp Wich
8772db1675 libs/core: explicitely load luci.i18n in network model 2012-09-15 14:02:27 +00:00
Jo-Philipp Wich
647a0d33c3 libs/core: adapt luci.model.network for wifi-iface instances which are members of multiple networks 2012-09-15 13:10:27 +00:00
Jo-Philipp Wich
5164d55091 libs/core: remove route enabled check in network model after netifd update in OpenWrt trunk 2012-09-13 08:50:59 +00:00
Jo-Philipp Wich
c4d0dd19b7 libs/web: merge luci.http.protocol fix from Fonosfera
See http://trac.fonosfera.org/fon-ng/changeset/2102/trunk/luci/libs/http .
2012-08-29 13:06:58 +00:00
Jo-Philipp Wich
ec5487649e [PATCH] nixio HAS_SHADOW test link error
The nixio library can mistakenly build without shadow password support due to the
compile-time test failing.

Because the test for HAS_SHADOW in the nixio Makefile uses the default CC flags,
the test may attempt to cross-compile with different VFP abi than libc does and
will therefore not link. Passing CCFLAGS on the command line builds the test
correctly and will enable HAS_SHADOW if available.
2012-08-29 13:04:44 +00:00
Jo-Philipp Wich
1916ab494a libs/nixio: add missing parameter to alarm reset 2012-08-27 14:54:37 +00:00
Jo-Philipp Wich
54567e57ea libs/nixio: cancel pending alarm after successfully returning from getnameinfo() 2012-08-27 14:54:07 +00:00
Jo-Philipp Wich
f66a13dc4d libs/sys: use 100ms timeouts for name resolution of host hints 2012-08-27 14:39:33 +00:00
Jo-Philipp Wich
c755e818c4 libs/nixio: implement optional timeout for getnameinfo() on Linux 2012-08-27 14:36:47 +00:00
Jo-Philipp Wich
044b011051 libs/core: also add gre0 to default interface ignore pattern 2012-08-17 11:39:04 +00:00
Jo-Philipp Wich
b7026b156d libs/web: export translatef() into templates 2012-08-14 15:31:26 +00:00
Jo-Philipp Wich
2c844d42d8 libs/sys: fix getiwinfo() for "radioX.networkY" notation if the target network is not yet committed to uci 2012-08-14 12:45:12 +00:00
Jo-Philipp Wich
c78e445583 libs/web: rework unspecified/create logic for checkboxes in network_netlist widget 2012-08-09 23:42:53 +00:00
Jo-Philipp Wich
b35ab62ada libs/web: support placeholder attribute for comboboxes, fix validation quirks with input->select transition in comboboxes 2012-08-09 11:25:25 +00:00
Jo-Philipp Wich
0eb010a754 libs/sys: remove _parse_delimitted_table() and incorperate /etc/config/dhcp leases into mac_hints() 2012-08-09 10:03:25 +00:00
Jo-Philipp Wich
9bd814cf0e libs/sys: remove wifi.channels() 2012-08-08 20:25:03 +00:00
Jo-Philipp Wich
d1fd6e702e libs/sys: remove wifi.getiwconfig() and wifi.getiwscan() 2012-08-08 20:16:46 +00:00
Jo-Philipp Wich
df8601c864 libs/sys: introduce net.mac_hints(), net.ipv4_hints() and net.ipv6_hints() functions to obtain lists of peers from various sources (e.g. ethers, leases, arp cache) 2012-08-08 15:20:03 +00:00
Jo-Philipp Wich
4d2332c01c libs/web: add missing css class to cbi simpleform template 2012-08-08 11:29:46 +00:00
Jo-Philipp Wich
7bca24db1b libs/web: adapt dispatcher to sauth api changes 2012-08-08 09:48:50 +00:00
Jo-Philipp Wich
abef50b852 libs/web: rework luci.sauth
- perform decoding/encoding transparently in read() and write()
	- remove decode() and encode() helpers
	- introduce reap() to kill expired sessions
2012-08-08 09:48:47 +00:00
Jo-Philipp Wich
a58370ab74 Rework authentication system
The validity of authentication tokens was determined by the
mtime of respective authentication tokens on filesystem
stored in $sessionpath.
Talking about hardware without RTC or without a prior
connection to a time server, date/time usually around 1970 -
so is the mtime of the authentication token file in
$sessionpath.

When now configuring an internet connection via LuCI, the
system might fetch the current date/time (e.g. via ntp)
which invalidates the token, returns "403 Forbidden" and
kicks the user out of the interface.

This patch changes the authentication system to use time values
based on the uptime of the machine - rather than values based upon
gettimeofday() and {a|m}time values - and save them inside the token.
That way can always determine the difference between login
(last interaction respectively) and the current time, in-
dependant of the system clock jumping backwards/forwards.

Warning: This patch removes the clean() function and respective calls.
This means, invalid tokens will NOT be determined and removed from
filesystem automatically anymore.
Before, every HTTP-call caused a scan for invalid tokens,
which is quite expensive. Instead consider using a cron job
deleting all stalled files periodically.

Contributed by T-Labs, Deutsche Telekom Innovation Laboratories

Signed-off-by: Mirko Vogt <mirko@openwrt.org>
2012-08-07 19:11:56 +00:00
Jo-Philipp Wich
a798da5d8b libs/web: support creating networks in checkbox network widget (#457) 2012-07-24 11:48:03 +00:00
Jo-Philipp Wich
46c84206f3 libs/sys: workaround broken entries in /proc/net/ipv6_route, observed on brcm-2.4 2012-07-18 11:22:10 +00:00
Jo-Philipp Wich
c098c59fd1 libs/core: only consider enabled routes when finding wan interface 2012-06-29 11:59:38 +00:00
Jo-Philipp Wich
e2dd594c38 libs/sys: fix login with empty password after previous commit 2012-06-27 14:11:48 +00:00
Jo-Philipp Wich
b1617b3718 libs/sys: fix luci.sys.checkpasswd() semantics 2012-06-27 13:52:09 +00:00
Jo-Philipp Wich
9fab594101 libs/core: improve luci.util.imatch() to not create temporary strings when iterating non-string values 2012-06-26 22:58:24 +00:00
Jo-Philipp Wich
0f3175ad42 libs/core: implement get_wandev(), get_wan6dev(), get_wannet() and get_wan6net() in luci.model.network 2012-06-26 22:19:27 +00:00
Jo-Philipp Wich
61883f2c3f libs/core: fix network is_empty() check for wifi-ifaces which are part of multiple networks 2012-06-26 21:49:24 +00:00
Jo-Philipp Wich
fe7424b68e libs/web: extend network_ifacelist widget to display all networks an iface is member of 2012-06-26 21:49:15 +00:00
Jo-Philipp Wich
699391a559 libs/core: allow ifaces to be part of multiple networks in luci.model.network 2012-06-26 21:49:07 +00:00
Jo-Philipp Wich
6780f757d6 libs/web: implement minlength(), maxlength() and rangelength() datatypes 2012-06-25 09:51:59 +00:00
Jo-Philipp Wich
5bcf9d07fd libs/core: fix various problems in the network model 2012-06-17 11:18:58 +00:00
Jo-Philipp Wich
22ce33a5a6 libs/core: fix ubus corner cases in network model 2012-05-31 17:24:13 +00:00
Jo-Philipp Wich
eb7a72f251 libs/core: use ubus to fetch interface and device status information, depend on libubus-lua 2012-05-31 10:05:31 +00:00
Jo-Philipp Wich
16ffd14cc2 move luci specific index.html from package 'sgi-cgi' to 'admin-core'
Contributed by T-Labs, Deutsche Telekom Innovation Laboratories

Signed-off-by: Mirko Vogt <mirko.vogt@external.telekom.de>
2012-05-06 18:57:18 +00:00
Jo-Philipp Wich
216264b6e4 libs/sys: fix luci.sys.init.index() (#399) 2012-05-06 09:47:57 +00:00
Jo-Philipp Wich
b6c98f9c57 Fix JSON NaN
Hi,

The attached patch fixes the JSON generation when dealing with NaN (not
a number), this makes the JSON parsing in the web browser succeed
(before it would get a "nan" which is not a valid JS value)

Chris
2012-04-16 16:48:59 +00:00
Jo-Philipp Wich
fd28386e35 libs/web: fix html output for complex datatypes containing apostrophes 2012-04-15 14:31:04 +00:00
Jo-Philipp Wich
4711c01509 libs/sys: introduce luci.sys.init.start() and luci.sys.init.stop(), also execute all init action with an empty environment 2012-04-15 14:30:54 +00:00
Manuel Munz
7fdb055265 libs/datatypes: Fix typo 2012-04-13 18:12:34 +00:00
Jo-Philipp Wich
005fd26cf6 libs/nixio: reorder linker commandline args to fix build on Ubuntu 11.x 2012-03-13 22:45:26 +00:00
Jo-Philipp Wich
e620bdac3e libs/nixio: disable TLS implementation by default, fixes host builds on Ubuntu 11.x 2012-03-13 22:11:27 +00:00
Jo-Philipp Wich
fd0f8e80c5 libs/web: fix wrong default focus in dynlist widgets (#388) 2012-03-04 14:15:09 +00:00
Jo-Philipp Wich
1c10042f8c libs/web: fix delete action in tblsections, fix extedit buttons 2012-02-15 22:08:51 +00:00
Jo-Philipp Wich
5d45927643 libs/web: remove inline styles from firewall_zoneforwards and firewall_zonelist widgets 2012-02-15 17:50:25 +00:00
Jo-Philipp Wich
7c9dd3ab81 libs/web: remove inline styles from network_netinfo widget 2012-02-15 16:43:39 +00:00
Jo-Philipp Wich
481ddd0909 libs/web: remove inline styles for interface badges 2012-02-15 16:00:23 +00:00
Jo-Philipp Wich
857dcdf727 libs/web: remove more inline styles from tblsection template, fixes action buttons in bootstrap theme 2012-02-15 15:27:03 +00:00
Jo-Philipp Wich
13beaf8b3d libs/web: use new button classes for tblsection template 2012-02-15 15:13:27 +00:00
Jo-Philipp Wich
47b51b54e8 libs/web: fix firewall_zoneforwards template for bootstrap theme 2012-02-15 15:12:53 +00:00
Jo-Philipp Wich
63a75c6ea9 libs/web: implement new phone digit datatype, useful for VoIP related config screens 2012-02-14 15:16:53 +00:00
Jo-Philipp Wich
8412034c3d libs/web: use CSS class for sort buttons, drop inline style 2012-02-14 15:08:12 +00:00
Jo-Philipp Wich
75f849ca58 libs/web: fix invalid html after r8224 - the whitespace trimming removed the space between the attributes 2012-02-14 14:11:57 +00:00
Patrick Grimm
a3b0db7d86 libs/web: fix line wrapping error 2012-02-13 00:44:56 +00:00
Patrick Grimm
9305afaf0d libs/web: replace <a href> by <input type=button> for better css style in tables 2012-02-12 22:50:48 +00:00
Jo-Philipp Wich
001e15a0db [PATCH] Explicit Cache-Control for lucid.http static content
The Chrome web browser revalidates every resource if no explicit Cache-Control or Expires HTTP/1.1 header is sent. This makes the page loads appear to take a long time on pages with a few external resources, adding 300-500ms 
per item. This includes the XHR json responses that set page images, like wireless signal indicators and the like-- the images are revalidated on every XHR response. As an example, the Network -> Interfaces page generates 16 
requests to the lucid http server:

    Main HTML
    cascade.css
    xhr.js
    tabbg.png
    cbi.js
    loading.gif
    ethernet_disabled.png
    reload.png
    reset.gif
    edit.gif
    remove.gif
    add.gif
    bridge.png
    vlan.png
    wifi.png
    iface_status 

Of those, 14 should be pulled from cache but they are all valdiated. The lucid server returns the correct 304 (Not Modified) responses but it delays the apparent page load time because of the backlog it creates at the http 
server.

I would suggest setting explicit cache control on all files returned by the lucid http directory dispatcher. The "Expires" header is reportedly more widely supported, however this relies on the clock on the OpenWrt? system 
being accurate, which may not be the case. The "Cache-Control: max-age=" allows the server to set a timeout in seconds. I've included a patch that sets revalidate interval to 1 year, which is the value recommended by google.
Reference:  http://code.google.com/speed/page-speed/docs/caching.html

Note this could create an issue if there are luci application which are generating files which change that are being served by the lucid http DirectoryPublisher?. I'm not sure if there is anyone doing that. If needed, this can 
probably be created as an option to the DirectoryPublisher? config stanza for each vhost.

Finally, this only affects the Google Chrome browser, as both IE9 and Firefox seem to have their own revalidation interval in the absence of explicit cache control which may be based on the last modified time of the resource. 
Even in Chrome, this change doesn't take effect until the item is re-served with a 200 HTTP response so Chrome's cache should be cleared after this patch is applied. The patch can be extended to include cache control on 304 
responses, but I'd not worry about cluttering the code with it because the problem will solve itself once chrome redownloads the resource.
2012-01-09 00:04:54 +00:00
Jo-Philipp Wich
a4996261ea libs/web: remove debugging code 2012-01-08 23:39:29 +00:00
Jo-Philipp Wich
875baa244a libs/web: allow zero-length string literals when parsing datatypes 2012-01-08 23:36:35 +00:00
Jo-Philipp Wich
9fcdf0fe81 libs/web: introduce recursive expression support for datatypes, introduce "or" and "and" datatypes
The commit adds a recursive parser for datatype expressions which allows nesting of validators,
this allows for complex expressions like  "list(or(range(0,65535),'infinite'))" to allow a list of
values which are either integers between 0 and 65535 or the literal string "inifinite".
That change also deprecates combined datatypes like "ipaddr" ["or(ip4addr,ip6addr)"] or
"host" ["or(hostname,ip4addr,ip6addr)"]
2012-01-08 23:33:47 +00:00
Jo-Philipp Wich
3812f29087 libs/web: remove neg_ipaddr, neg_ip4addr and neg_network_ip4addr datatypes, can be represented with neg(type) 2012-01-07 22:06:02 +00:00
Jo-Philipp Wich
481cd6feb7 libs/core: remove various uses of global vars in luci.ip 2012-01-01 15:51:37 +00:00
Jo-Philipp Wich
574eff4e8e libs/core: rework luci.model.uci.apply() to return the commandline as table, suitable for passing to nixio.exec() 2011-12-20 19:02:14 +00:00
Jo-Philipp Wich
3553d308f6 [PATCH] Naive fix for bug #208
For SimpleSection, use the section name (always "1") instead of the
section type in the CBI-like string used to identify the upload.  This
allows upload fields to be placed in SimpleSections.  The fix changes a
minimal number of lines, but does introduce some unnecessary confusion,
it may or may not be better than a more thorough/invasive fix.

Set the enctype for the form element in the simpleform view to be
multipart/form-data because the default
application/x-www-form-urlencoded does not support input files.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2011-12-20 17:52:10 +00:00
Jo-Philipp Wich
8358175f25 libs/web: show input/forward hints in zonelist widget only if bnoth allowany and allowlocal are enabled 2011-12-20 17:51:44 +00:00
Jo-Philipp Wich
b89300eb67 libs/web: prevent break between action buttons in tblsection template 2011-12-20 03:57:40 +00:00
Jo-Philipp Wich
48838ea0f7 libs/web: fix placeholder attribute for DynList 2011-12-20 03:00:17 +00:00