Skip to content

Commit

Permalink
updated update-check.cgi with proper error checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Oct 9, 2015
1 parent 8030c49 commit 81fbfa1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 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 &]
Expand All @@ -11,12 +14,14 @@ catch {
}

if { [info exists cmd ] && $cmd == "download"} {
if { [info exists version ] } {
puts "<meta http-equiv='refresh' content='0; url=https://github.com/jens-maus/scriptparser/releases/tag/$version' />"
puts "<meta http-equiv='refresh' content='0; url=$downloadURL' />"
} else {
catch {
set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $checkURL ]
}
if { [info exists newversion] } {
puts $newversion
} else {
puts "<meta http-equiv='refresh' content='0; url=https://github.com/jens-maus/scriptparser/releases' />"
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
}

0 comments on commit 81fbfa1

Please sign in to comment.