1
0
mirror of https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git synced 2023-10-10 13:37:40 +02:00

Manually follow redirects

This commit is contained in:
Jan Schneider 2018-12-22 21:17:52 +01:00
parent 081b9c6d88
commit bcca15671a

View File

@ -1521,6 +1521,11 @@ proc ::rmupdate::get_addon_info {{fetch_available_version 0} {fetch_download_url
} else { } else {
# Not a direct download link # Not a direct download link
set data3 [exec /usr/bin/wget --no-check-certificate --quiet --output-document=- "${download_url}"] set data3 [exec /usr/bin/wget --no-check-certificate --quiet --output-document=- "${download_url}"]
write_log 4 $data3
if {[regexp {meta.*http-equiv.*refresh.*url=(.*)['"][\s/>]} $data3 match href]} {
set download_url $href
set data3 [exec /usr/bin/wget --no-check-certificate --quiet --output-document=- "${href}"]
}
set best_prio 0 set best_prio 0
set best_href "" set best_href ""
regsub -all {\.} $available_version "\\." regex_version regsub -all {\.} $available_version "\\." regex_version
@ -1530,6 +1535,7 @@ proc ::rmupdate::get_addon_info {{fetch_available_version 0} {fetch_download_url
regsub -all {<a} $oneline "\n<a" alines regsub -all {<a} $oneline "\n<a" alines
foreach d [split $alines "\n"] { foreach d [split $alines "\n"] {
if {[regexp {<a[^>]*\shref\s*=\s*"([^"]+)"[^>]*>(.*)</a} $d match href text]} { if {[regexp {<a[^>]*\shref\s*=\s*"([^"]+)"[^>]*>(.*)</a} $d match href text]} {
#write_log 4 "Processing link ${href} - ${text}"
set filename "" set filename ""
if {[regexp {\s*(\S.+\.tar.gz)\s*} $href match fn]} { if {[regexp {\s*(\S.+\.tar.gz)\s*} $href match fn]} {
set filename $fn set filename $fn