mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
stop cloudflare from jumbling up png/svg icons;
chrome crashes if there's more than 2000 unique SVGs on one page, so there was serverside useragent-sniffing to determine if the icon should be an svg or a raster however since the useragent is not in our vary, cloudflare wouldn't see the difference and cache everything equally, meaning most folders would display a random mix of png and svg thumbnails move browser detection to the clientside to ensure unique URLs
This commit is contained in:
parent
8a38101e48
commit
43ee6b9f5b
|
@ -3142,8 +3142,9 @@ class HttpCli(object):
|
||||||
ext = "~" + ext[-9:]
|
ext = "~" + ext[-9:]
|
||||||
|
|
||||||
# chrome cannot handle more than ~2000 unique SVGs
|
# chrome cannot handle more than ~2000 unique SVGs
|
||||||
chrome = " rv:" not in self.ua
|
# so url-param "raster" returns a png/webp instead
|
||||||
mime, ico = self.ico.get(ext, not exact, chrome)
|
# (useragent-sniffing kinshi due to caching proxies)
|
||||||
|
mime, ico = self.ico.get(ext, not exact, "raster" in self.uparam)
|
||||||
|
|
||||||
lm = formatdate(self.E.t0, usegmt=True)
|
lm = formatdate(self.E.t0, usegmt=True)
|
||||||
self.reply(ico, mime=mime, headers={"Last-Modified": lm})
|
self.reply(ico, mime=mime, headers={"Last-Modified": lm})
|
||||||
|
|
|
@ -4847,6 +4847,8 @@ var thegrid = (function () {
|
||||||
ihref = SR + '/.cpr/ico/' + ext;
|
ihref = SR + '/.cpr/ico/' + ext;
|
||||||
}
|
}
|
||||||
ihref += (ihref.indexOf('?') > 0 ? '&' : '?') + 'cache=i&_=' + ACB;
|
ihref += (ihref.indexOf('?') > 0 ? '&' : '?') + 'cache=i&_=' + ACB;
|
||||||
|
if (CHROME)
|
||||||
|
ihref += "&raster";
|
||||||
|
|
||||||
html.push('<a href="' + ohref + '" ref="' + ref +
|
html.push('<a href="' + ohref + '" ref="' + ref +
|
||||||
'"' + ac + ' ttt="' + esc(name) + '"><img style="height:' +
|
'"' + ac + ' ttt="' + esc(name) + '"><img style="height:' +
|
||||||
|
|
Loading…
Reference in a new issue