From c1dcb7abe7ed1bfb4ac1e00f16eb47e7887ccf8f Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 20 Mar 2013 20:04:33 +0545 Subject: DynDNS status widget async update The Dynamic DNS status widget performs remote operations to the www to check the cached dynamic DNS IP against the actual current public-facing IP. When an external link is slow, or particularly when the cable is plugged in (it seems up) but actually the internet is down, it takes a long time for a response from http://checkip.dyndns.com/ to time out. The dashboard page hangs in a half-drawn state (up to drawing the DynDNS status table) for up to 30 seconds. This change puts the code that does these external operations into some ajax/Java script that runs after the dashboard has drawn up. Code concept unashamedly stolen from the system information widget. --- .../www/widgets/widgets/dyn_dns_status.widget.php | 74 ++++++++++++++++------ 1 file changed, 56 insertions(+), 18 deletions(-) (limited to 'usr/local/www/widgets/widgets/dyn_dns_status.widget.php') diff --git a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php index e177b8d..0c35e4e 100644 --- a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php +++ b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php @@ -1,8 +1,8 @@ $cached_ip) + echo ""; + else + echo ""; + echo htmlspecialchars($cached_ip); + echo ""; + } else { + echo "N/A"; + } + } + exit; +} + ?> @@ -101,23 +128,34 @@ $a_dyndns = &$config['dyndnses']['dyndns']; ?>
- $cached_ip) - echo ""; - else - echo ""; - echo htmlspecialchars($cached_ip); - echo ""; - } else { - echo "N/A"; - } - ?> +
+ -- cgit v1.1