From 81fbfa1726cdc8d9676654b5c79da90452cad88f Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Fri, 9 Oct 2015 15:42:50 +0200 Subject: [PATCH] updated update-check.cgi with proper error checking. --- script/update-check.cgi | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/script/update-check.cgi b/script/update-check.cgi index 2d6308a..d61e1b8 100755 --- a/script/update-check.cgi +++ b/script/update-check.cgi @@ -1,5 +1,8 @@ #!/bin/tclsh +set checkURL "https://raw.githubusercontent.com/jens-maus/scriptparser/master/VERSION" +set downloadURL "https://github.com/jens-maus/scriptparser/releases" + catch { set input $env(QUERY_STRING) set pairs [split $input &] @@ -11,12 +14,14 @@ catch { } if { [info exists cmd ] && $cmd == "download"} { - if { [info exists version ] } { - puts "" + puts "" +} else { + catch { + set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $checkURL ] + } + if { [info exists newversion] } { + puts $newversion } else { - puts "" + puts "n/a" } -} else { - set version [ exec /usr/bin/wget -qO- --no-check-certificate https://raw.githubusercontent.com/jens-maus/scriptparser/master/VERSION ] - puts $version }