Commit graph

1487 commits

Author SHA1 Message Date
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