Skip to content

Commit

Permalink
Merge pull request #25 from comtel2000/patch-1
Browse files Browse the repository at this point in the history
Download Update URL fixed
  • Loading branch information
thkl authored Apr 30, 2020
2 parents e215153 + ce77041 commit b5204bc
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions addon_installer/etc/www/update-check.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
set version_url "https://raw.githubusercontent.com/thkl/hap-homematic/master/addon_installer/VERSION"
set package_url "https://github.com/thkl/hap-homematic/releases/latest"

set cmd ""
if {[info exists env(QUERY_STRING)]} {
regexp {cmd=([^&]+)} $env(QUERY_STRING) match cmd
catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
foreach pair $pairs {
if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
set $varname $val
}
}
}
if {$cmd == "download"} {
puts "<html><head><meta http-equiv=\"refresh\" content=\"0; url=${package_url}\" /></head><body><a href=\"${package_url}\">${package_url}</a></body></html>"

if { [info exists cmd ] && $cmd == "download"} {
puts -nonewline "Content-Type: text/html; charset=utf-8\r\n\r\n"
puts -nonewline "<html><head><meta http-equiv='refresh' content='0; url=$package_url' /></head><body></body></html>"
} else {
puts [exec /usr/bin/wget -q --no-check-certificate -O- "${version_url}"]
}
puts -nonewline "Content-Type: text/plain; charset=utf-8\r\n\r\n"
catch {
set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $version_url ]
}
if { [info exists newversion] } {
puts $newversion
} else {
puts "n/a"
}
}

0 comments on commit b5204bc

Please sign in to comment.