-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented a new WebUI patch to force addon version download URLs to
carry a valid text/plain content-type no matter what the corresponding addon URL returns. This fixes #480.
- Loading branch information
Showing
3 changed files
with
1,101 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
buildroot-external/patches/occu/0047-WebUI-ForceAddonVersionContentType.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- occu/WebUI/www/config/cp_software.cgi.orig | ||
+++ occu/WebUI/www/config/cp_software.cgi | ||
@@ -452,18 +452,21 @@ | ||
puts "<script type=\"text/javascript\">translatePage('#messagebox')</script>" | ||
global swVersion swUpdate | ||
cgi_javascript { | ||
+ puts "function getVersion(url, callback) {" | ||
+ puts " var xhr = new XMLHttpRequest();" | ||
+ puts " xhr.onreadystatechange = function () {" | ||
+ puts " if (xhr.readyState === 4 && xhr.status === 200) callback(xhr.responseText);" | ||
+ puts " };" | ||
+ puts " xhr.open(\"GET\", url, true);" | ||
+ puts " xhr.overrideMimeType(\"text/plain; charset=iso-8859-1\");" | ||
+ puts " xhr.send();" | ||
+ puts "}" | ||
for {set i 0} {$i <= $loop} {incr i} { | ||
if { [info exists swUpdate($i)] } { | ||
- puts "var anchor = document.getElementById(\"availableSWVersion_$i\");" | ||
- puts "var iframe = document.createElement(\"iframe\");" | ||
- puts "iframe.src = \"$swUpdate($i)?cmd=check_version&version=$swVersion($i)\";" | ||
- puts "iframe.frameBorder=0;" | ||
- puts "iframe.marginHeight=0;" | ||
- puts "iframe.marginWidth=0;" | ||
- puts "iframe.width=100;" | ||
- puts "iframe.height=20;" | ||
- puts "iframe.scrolling='no';" | ||
- puts "anchor.appendChild(iframe);" | ||
+ puts "getVersion(\"$swUpdate($i)?cmd=check_version&version=$swVersion($i)\", function(contents) {" | ||
+ puts " document.getElementById(\"availableSWVersion_$i\").innerHTML = contents;" | ||
+ puts "});" | ||
+ puts "document.getElementById(\"availableSWVersion_$i\").innerHTML = \"n/a\";" | ||
} | ||
} | ||
} |
Oops, something went wrong.