Commit graph

1466 commits

Author SHA1 Message Date
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
Jo-Philipp Wich
161218a576 libs/web: fix undesired autofocus of DynamicList widget 2011-12-20 02:56:03 +00:00
Jo-Philipp Wich
6ae669da06 libs/web: improve ip6addr datype validation, accept both CIDR and IP/Mask notation 2011-12-20 02:44:32 +00:00
Jo-Philipp Wich
24c4cce3ae libs/web: add "any" option to firewall_zonelist widget 2011-12-19 20:09:20 +00:00
Jo-Philipp Wich
21a0fcc4c1 libs/web: rework DynamicList widget to support dynamic lists composed of comboboxes 2011-12-19 18:55:59 +00:00
Jo-Philipp Wich
375a476d27 libs/web: rework hostname match to not allow arbritary sequences of numbers and dots 2011-12-16 06:05:51 +00:00
Jo-Philipp Wich
3a0905f21c libs/web: add list(...) datatype for space separated lists of arbritary datatypes 2011-12-16 05:52:24 +00:00
Jo-Philipp Wich
ca7bc48ebc [PATCH] Abstract address UNIX sockets not binding properly (by capnbry@gmail.com, #366)
In #274, I stated abstract namespace and autobound abstract namespace datagram UNIX domain sockets work perfectly with nixio. However, I may have jumped the gun on that conclusion. Turns out they work perfectly for only one 
concurrent connection.

The problem is that when binding to an abstract address socket, which begins with a NULL byte, nixio strncpy's the name into the sockaddr_un structure, which effectively copies nothing. It then binds to an address of 180 NULLs, 
which is completely legal, but obviously you run into problems when a second client tries to bind to the same address.

The rules are as follows ( http://linux.die.net/man/7/unix) for the names:

  * If the name is blank, bind() should pass that the addrlen of sizeof(sa_family_t) and Linux will autobind a name that begins with null and is followed by 5 digits.
  * If the first character of the name is non-null, the name is a pathname and is null-terminated. addrlen should be sizeof(sockaddr_un), but the length can also be the pathname len + sizeof(sa_family_t) as the value will be 
null-terminated by the kernel unix socket driver
  * If the first character is null, the address is abstract and the value should not be null-terminated and addrlen is pathname + sizeof(sa_family_t) 

The attached patch fixes bind/connect/sendto by shortening the addrlen passed to be pathname len + sizeof(sa_family_t), which generates the correct socket names for all 3 cases above.
It also fixes the address returned by recvfrom, which currently returns a blank string for any abstract address socket (as they begin with a null).
2011-12-16 02:10:37 +00:00
Jo-Philipp Wich
757e9c2f1c libs/web: add missing parts of previous commit 2011-12-16 01:18:34 +00:00
Jo-Philipp Wich
cdcfb5502b libs/web: implement "network" cbi datatype 2011-12-16 01:18:15 +00:00
Jo-Philipp Wich
c5811d52d0 libs/web: allow one-character hostnames 2011-12-14 15:01:54 +00:00
Jo-Philipp Wich
df3ee4c199 libs/core: fix undefined tostring() in network model 2011-12-05 19:36:50 +00:00
Jo-Philipp Wich
fd130ead81 libs/core: expose txpower offset values in network model 2011-12-05 18:34:22 +00:00
Jo-Philipp Wich
f6ee6322f9 From c63e369d57cb6862a8890c7b2ee1b6b449b2c42d Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 5 Dec 2011 14:36:34 +0100
Subject: [PATCH] libs/sys: read model name from /tmp/sysinfo/model if present

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
2011-12-05 16:38:54 +00:00
Jo-Philipp Wich
099e97532c libs/web: add assert() statements for unresolvable function case 2011-11-30 12:50:32 +00:00
Jo-Philipp Wich
3face70859 libs/nixio: link with libcrypto when using OpenSSL as digest backend 2011-11-20 18:18:46 +00:00