diff --git a/CONTROL/control b/CONTROL/control index 6c8ba47e..a94a6668 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.13 +Version: 0.8.13-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-7),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.5),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2 diff --git a/var/mongoose/cgi-bin/settings.jim b/var/mongoose/cgi-bin/settings.jim index f5003232..1aea0b99 100755 --- a/var/mongoose/cgi-bin/settings.jim +++ b/var/mongoose/cgi-bin/settings.jim @@ -64,9 +64,6 @@ handle_str_update hostname $hostname Hostname _handle_update ascii smtp_server $smtp_server "SMTP Server" handle_int_update channel_group $channel_group "Channel Group" handle_str_update epg_style $epg_style "EPG Type" -if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} { - set _cgi(pkgdev) 0 -} handle_int_update pkgdev $pkgdev "Development Package Display" set acluser [cgi_get acluser "-"] @@ -318,34 +315,21 @@ $('button.pwchange').click(function(el) { } -puts " +puts -nonewline "

Advanced Settings -" - -puts " - - - -} - -puts "
Show development and advanced packages? - - - - -
+if {$pkgdev} { puts -nonewline " checked" } +puts ">
+
" diff --git a/var/mongoose/cgi-bin/settings.js b/var/mongoose/cgi-bin/settings.js index 24e54ebc..18645b1f 100644 --- a/var/mongoose/cgi-bin/settings.js +++ b/var/mongoose/cgi-bin/settings.js @@ -35,6 +35,25 @@ $(document).ready(function () { }); }); + $('#pkgdev').change(function() { + var arg = '0'; + if ($(this).attr('checked')) + arg = '1'; + + $(this).disable(); + + $('#pkgdev_output') + .empty() + .show('slow') + .load('/cgi-bin/settings.jim?pkgdev=' + arg, + function() { + $('#pkgdev').enable(); + $('#pkgdev_output') + .css('font-style', 'italic') + .delay(2000).fadeOut('slow'); + }); + }); + $('#https_toggle').change(function() { var arg = 'off'; if ($(this).attr('checked')) diff --git a/var/mongoose/include/mediatomb.jim b/var/mongoose/include/mediatomb.jim index 34db9311..1a1e1a86 100755 --- a/var/mongoose/include/mediatomb.jim +++ b/var/mongoose/include/mediatomb.jim @@ -1,5 +1,8 @@ #!/mod/bin/jimsh +source /mod/var/mongoose/lib/setup +require system.class + if { [catch {set fd [open "/mod/mediatomb/config/mediatomb.html" r]} fid] } { exit 0 } @@ -8,6 +11,10 @@ close $fd regexp {URL=([^"]*)} $data match set url [string range $match 4 [string length $match]] +set port [string range [lindex [split $url ":"] 2] 0 end-1] + +if {![system is_listening $port]} { exit 0 } + puts "
diff --git a/var/mongoose/include/transmission.jim b/var/mongoose/include/transmission.jim index 52287ef0..b4765108 100755 --- a/var/mongoose/include/transmission.jim +++ b/var/mongoose/include/transmission.jim @@ -1,6 +1,10 @@ #!/mod/bin/jimsh +source /mod/var/mongoose/lib/setup +require system.class + if {![file exists /mod/sbin/transmission-daemon]} { exit 0 } +if {![system is_listening 9091]} { exit 0 } set url "/cgi-bin/transmission.jim" diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index 326169c7..fe09ff0b 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -130,3 +130,23 @@ proc {system mkdir_p} {dir} { exec /mod/bin/busybox/mkdir -p $dir } +proc {system listening} {{mport 0}} { + set ret {} + foreach line [split [exec /mod/bin/busybox/netstat -lntpw] "\n"] { + # Remove repeated spaces + regsub -all -- {[[:space:]]+} $line " " line +# tcp 0 0 0.0.0.0:9955 0.0.0.0:* LISTEN 169/humaxtv + lassign [split $line " "] x x x port x type app + if {$type ne "LISTEN"} { continue } + lassign [split $port ":"] x port + + if {$mport && $mport != $port} { continue } + lappend ret [list $port [split $app "/"]] + } + return $ret +} + +proc {system is_listening} {mport} { + return [llength [system listening $mport]] +} +