diff --git a/CONTROL/control b/CONTROL/control index 09ddd0b..d12a7fe 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.2.8-3 +Version: 1.2.8-4 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.1.20),lighttpd(>=1.4.39-1),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.1),hmt(>=2.0.9),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7) +Depends: tcpfix,webif-channelicons(>=1.1.20),lighttpd(>=1.4.39-1),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.1),hmt(>=2.0.9),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7) Suggests: Description: An evolving web interface for the Humax. Tags: http://hummy.tv/forum/threads/6484/ diff --git a/webif/cgi-bin/opkg.jim b/webif/cgi-bin/opkg.jim index 6bc03cf..eae2d63 100755 --- a/webif/cgi-bin/opkg.jim +++ b/webif/cgi-bin/opkg.jim @@ -9,28 +9,31 @@ cgi_input set cmd [cgi_get cmd update] +proc putsf {str} { + puts $str + flush stdout +} + proc opkg {cmd} { - puts ">>> opkg $cmd" + putsf ">>> opkg $cmd" set bcmd "|/mod/webif/lib/bin/opkg $cmd" set fd [open $bcmd r] while {[gets $fd line] >= 0} { - puts "$line" + putsf "$line" } close $fd - puts "" + putsf "" } -httpheader "text/plain" +httpheader "text/plain" 0 "Transfer-Encoding: chunked\r\n" set cmdargs [lassign $cmd cmd] set netcmds {install update upgrade} if {$cmd in $netcmds && ![system connectivity]} { - puts "" - puts "!! ERROR - No network connectivity to package repository !!" - puts "" - puts "Check your Internet connection and DNS service and then try again." + putsf "!! ERROR - No network connectivity to package repository !!" + putsf "Check your Internet connection and DNS service and then try again." exit } @@ -38,12 +41,13 @@ if {$cmd eq "upgrade"} { opkg update } opkg "$cmd $cmdargs" if {$cmd eq "update" || $cmd eq "upgrade"} { - puts "Updating package meta information" + putsf "Updating package meta information" pkg fetchmeta - puts "Done." - puts "" - puts "Updating diagnostic meta information" + putsf "Done." + putsf "" + putsf "Updating diagnostic meta information" pkg fetchdiagmeta - puts "Done." } +putsf "Done." + diff --git a/webif/html/diag/assets.jim b/webif/html/diag/assets.jim index 5402ba9..ce2a068 100755 --- a/webif/html/diag/assets.jim +++ b/webif/html/diag/assets.jim @@ -3,7 +3,11 @@ puts {
Completed.
+ ');
+ if (status) // Request completed
+ {
+ $('#resultscomplete').slideDown('slow');
+ $('#resultsheader').slideUp('slow', function() {
+ $(this).empty();
+ });
+ }
+// $('#d_results').animate({
+// scrollTop: $('#d_results').scrollTop() + ('#d_results').height()
+// }, 'slow');
+}
+
+function chunked_request(placeholder, url, data)
+{
+ $('#resultsheader').html('
' + placeholder)
+ .slideDown('slow');
+ $('#resultscomplete').hide();
+ $('#results').empty();
+ $('#d_results').dialog('open');
+
+ $.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ xhrFields: {
+ onprogress: function(x) {
+ if (x.target)
+ loaddata(x.target.responseText);
+ }
+ },
+ progressInterval: 500,
+ success: function(data, status) {
+ loaddata(data, status);
+ },
+ error: function(_, _, e) {
+ if (window.console)
+ console.log("ajax error");
+ alert(e);
+ }
+ });
+}
+
$('#rundiag').on('click', function() {
var val = $('#diagsel').val();
if (val == '0')
val = $('#seq').val();
- $('#results')
- .html('
Running diagnostic ' +
- '' + val + '')
- .load('rundiag.jim', { diag: val }, function() {
- $('#results').wrapInner('');
- });
- $('#d_results').dialog('open');
+
+ chunked_request('Running diagnostic ' + val + '',
+ 'rundiag.jim', { diag: val });
});
$('#runfopkg').on('click', function() {
var pkg = $('#fopkg').val();
- $('#results')
- .html('
' +
- 'Forcibly re-installing package ' + pkg + '')
- .load('/cgi-bin/opkg.jim', {
- cmd: 'install --force-reinstall ' + pkg
- }, function() {
- $('#results').wrapInner('');
- });
- $('#d_results').dialog('open');
+
+ chunked_request('Re-installing package ' + pkg + '',
+ '/cgi-bin/opkg.jim', { cmd: 'install --force-reinstall ' + pkg });
});
$('a.logclear').on('click', function(e) {
@@ -50,16 +84,9 @@ $('a.logclear').on('click', function(e) {
if (!confirm('Delete ' + file + '?'))
return;
- $('#results')
- .html('
Clearing log ' +
- '' + file + '')
- .load('/log/act.jim', {
- action: 'clear',
- file: file
- }, function() {
- $('#results').wrapInner('');
- });
- $('#d_results').dialog('open');
+
+ chunked_request('Clearing log ' + file + '',
+ '/log/act.jim', { action: 'clear', file: file });
});
$.getJSON('/diag/rpc.jim?act=getall', function(data) {
@@ -71,7 +98,6 @@ $.getJSON('/diag/rpc.jim?act=getall', function(data) {
});
});
-
$('#safe,#reset,#rma,#maint').on('click', function(e) {
e.preventDefault();
diff --git a/webif/html/pkg/index.jim b/webif/html/pkg/index.jim
index 2ad4de6..1dcd203 100755
--- a/webif/html/pkg/index.jim
+++ b/webif/html/pkg/index.jim
@@ -30,7 +30,7 @@ puts {
Processing request...
diff --git a/webif/html/pkg/script.js b/webif/html/pkg/script.js
index 2c9101c..105b5a1 100644
--- a/webif/html/pkg/script.js
+++ b/webif/html/pkg/script.js
@@ -1,169 +1,166 @@
-var opkg = '/cgi-bin/opkg.jim?cmd=';
+var opkg = '/cgi-bin/opkg.jim';
$(document).ready(function() {
- var busy = false;
- var tswitch = false;
- var stick = true;
+var busy = false;
+var tswitch = false;
+var stick = true;
- // Retrieve the stored selected tab from the hash portion of the URL.
- var curtab = ~~(window.location.hash.slice(1));
- if (curtab < 0 || curtab > 2)
- curtab = 0;
+// Retrieve the stored selected tab from the hash portion of the URL.
+var curtab = ~~(window.location.hash.slice(1));
+if (curtab < 0 || curtab > 2)
+ curtab = 0;
- $('#opkgupdate')
- .button()
- .click(function() { tswitch = 2; execopkg('update'); })
- .fadeIn('slow');
+$('#opkgupdate')
+ .button()
+ .click(function() { tswitch = 2; execopkg('update'); })
+ .fadeIn('slow');
- $('#opkgupgradeall')
- .button()
- .click(function() { tswitch = 2; execopkg('upgrade'); })
- .fadeIn('slow');
+$('#opkgupgradeall')
+ .button()
+ .click(function() { tswitch = 2; execopkg('upgrade'); })
+ .fadeIn('slow');
- $('#pkgtabs').tabs({
- active: curtab,
- create: function(event, ui) {
- $(ui.panel).html("
" +
- "Loading data... Please wait...");
- busy = true;
- $('#pkgtabs').tabs('disable');
- },
- activate: function(event, ui) {
- window.location.hash = ui.newTab.index();
- if (busy)
- {
- alert('Please wait until the current ' +
- 'operation completes.');
- return false;
- }
- $(ui.newPanel).html("
" +
- "Loading data... Please wait...");
- busy = true;
- $('#pkgtabs').tabs('disable');
- },
- load: function() {
- busy = false;
- setup_buttons();
- $('#pkgtabs').tabs('enable');
- },
- spinner: '
' +
- 'Loading...'
- });
-
- var $dialog = $('#dialogue').dialog({
- title: "Package Management Results",
- modal: false, autoOpen: false,
- height: 500, width: 700,
- show: 'scale', hide: 'fade',
- draggable: true, resizable: true,
- buttons: { "Close":
- function() {$(this).dialog('close');}},
- close: function(e,u) {
- if (tswitch)
- {
- var curtab = $('#pkgtabs')
- .tabs('option', 'active');
- if (curtab != tswitch)
- $('#pkgtabs').tabs('option',
- 'active', tswitch);
- else
- {
- $('.ui-tabs-panel')
- .html("
" +
- "Loading data... Please wait...");
- $('#pkgtabs').tabs('load', tswitch);
- }
- tswitch = false;
- $('button.va').enable();
- }
- else
- {
- var pkg = $('#dialogue').attr('pkg');
- $('tr[pkg="' + pkg + '"]')
- .disable()
- .find('button').removeClass('va');
- $('button.va').enable();
- }
- }
- });
-
- function loaddata(data, status)
- {
- if (window.console)
- {
- console.log('loaddata called, status=' + status);
- console.log('Data: ' + data);
- }
- if (status)
- {
- $('#dresults').text(data);
- $('#dspinner').hide('slow');
- $('#complete').show('slow');
- if (status == 'success' && !stick)
- $('#dialogue').dialog('close');
- //stick = false;
- }
- else
- $('#dresults').append(data);
- }
-
- function execopkg(arg, pkg)
- {
+$('#pkgtabs').tabs({
+ active: curtab,
+ create: function(event, ui) {
+ $(ui.panel).html("
" +
+ "Loading data... Please wait...");
+ busy = true;
+ $('#pkgtabs').tabs('disable');
+ },
+ activate: function(event, ui) {
+ window.location.hash = ui.newTab.index();
if (busy)
{
alert('Please wait until the current ' +
'operation completes.');
- return;
+ return false;
}
+ $(ui.newPanel).html("
" +
+ "Loading data... Please wait...");
busy = true;
- $('button.va').disable();
- $('#dspinner').show();
- $('#complete').hide();
- $('#dresults').empty();
- $('#dialogue').attr('pkg', pkg);
- $dialog.dialog('open');
-
- $.ajax({
- type: "GET",
- url: opkg + arg,
- progress: loaddata,
- progressInterval: 500,
- success: function(data, status) {
- loaddata(data, status);
- },
- error: function(_, _, e) {
- if (window.console)
- console.log("ajax error");
- alert(e);
- }
- });
+ $('#pkgtabs').tabs('disable');
+ },
+ load: function() {
busy = false;
- }
+ setup_buttons();
+ $('#pkgtabs').tabs('enable');
+ },
+ spinner: '
' +
+ 'Loading...'
+});
- function setup_buttons()
+var $dialog = $('#dialogue').dialog({
+ title: "Package Management Results",
+ modal: false, autoOpen: false,
+ height: 500, width: 700,
+ show: 'scale', hide: 'fade',
+ draggable: true, resizable: true,
+ buttons: { "Close":
+ function() {$(this).dialog('close');}},
+ close: function(e,u) {
+ if (tswitch)
+ {
+ var curtab = $('#pkgtabs')
+ .tabs('option', 'active');
+ if (curtab != tswitch)
+ $('#pkgtabs').tabs('option',
+ 'active', tswitch);
+ else
+ {
+ $('.ui-tabs-panel')
+ .html("
" +
+ "Loading data... Please wait...");
+ $('#pkgtabs').tabs('load', tswitch);
+ }
+ tswitch = false;
+ $('button.va').enable();
+ }
+ else
+ {
+ var pkg = $('#dialogue').attr('pkg');
+ $('tr[pkg="' + pkg + '"]')
+ .disable()
+ .find('button').removeClass('va');
+ $('button.va').enable();
+ }
+ }
+});
+
+function loaddata(data, status)
+{
+ $('#dresults').text(data).wrapInner('');
+ if (status) // Request completed
{
- $('button.remove, button.install, button.upgrade')
- .button()
- .click(function() {
- if ($(this).attr('action') == 'remove' &&
- !confirm('Please confirm removal of the ' +
- $(this).attr('id') + ' package.'))
- return;
-
- execopkg(encodeURIComponent($(this).attr('action') +
- ' ' + $(this).attr('id')),
- $(this).closest('tr').attr('pkg'));
- }).fadeIn('slow');
-
- $('a.depends').click(function(e) {
- e.preventDefault();
- var pkg = $(this).closest('tr').attr('pkg');
- stick = true;
- execopkg(encodeURIComponent('whatdepends ' + pkg),
- false);
- });
+ $('#dspinner').hide('slow');
+ $('#complete').show('slow');
+ if (status == 'success' && !stick)
+ $('#dialogue').dialog('close');
+ //stick = false;
}
+}
+
+function execopkg(arg, pkg)
+{
+ if (busy)
+ {
+ alert('Please wait until the current ' +
+ 'operation completes.');
+ return;
+ }
+ busy = true;
+ $('button.va').disable();
+ $('#dspinner').show();
+ $('#complete').hide();
+ $('#dresults').empty();
+ $('#dialogue').attr('pkg', pkg);
+ $dialog.dialog('open');
+
+ $.ajax({
+ type: "GET",
+ url: opkg,
+ data: { cmd: arg },
+ xhrFields: {
+ onprogress: function(x) {
+ if (x.target)
+ loaddata(x.target.responseText);
+ },
+ },
+ progressInterval: 500,
+ success: function(data, status) {
+ loaddata(data, status);
+ },
+ error: function(_, _, e) {
+ if (window.console)
+ console.log("ajax error");
+ alert(e);
+ }
+ });
+ busy = false;
+}
+
+function setup_buttons()
+{
+ $('button.remove, button.install, button.upgrade')
+ .button()
+ .click(function() {
+ if ($(this).attr('action') == 'remove' &&
+ !confirm('Please confirm removal of the ' +
+ $(this).attr('id') + ' package.'))
+ return;
+
+ execopkg($(this).attr('action') + ' ' + $(this).attr('id'),
+ $(this).closest('tr').attr('pkg'));
+ }).fadeIn('slow');
+
+ $('a.depends').click(function(e) {
+ e.preventDefault();
+ var pkg = $(this).closest('tr').attr('pkg');
+ stick = true;
+ execopkg('whatdepends ' + pkg, false);
+ });
+}
});
diff --git a/webif/lib/chunked b/webif/lib/chunked
index ff3427f..ff7da53 100755
--- a/webif/lib/chunked
+++ b/webif/lib/chunked
@@ -7,11 +7,12 @@ proc chunk {chk} {
proc chunk_pad {{len 256}} {
incr len
- chunk [string range [format "%${len}d" 0] 1 end-1]
+ chunk [string repeat " " $len]
}
proc start_chunked {{type "text/html"}} {
httpheader $type 0 "Transfer-Encoding: chunked\r\n"
+ #chunk_pad
}
proc end_chunked {} {