mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Better proxying of images.
This commit is contained in:
parent
a395115f18
commit
26b92c751a
1 changed files with 9 additions and 3 deletions
|
@ -234,6 +234,9 @@ public class ResponseHelper {
|
|||
if (Constants.debug)
|
||||
return old;
|
||||
|
||||
if (old == null || old.isEmpty())
|
||||
return null;
|
||||
|
||||
URL url = null;
|
||||
|
||||
try {
|
||||
|
@ -246,14 +249,17 @@ public class ResponseHelper {
|
|||
|
||||
String query = url.getQuery();
|
||||
|
||||
final boolean hasQuery = query != null;
|
||||
boolean hasQuery = query != null;
|
||||
|
||||
String path = url.getPath();
|
||||
|
||||
path = path.replace("-rj", "-rw");
|
||||
|
||||
if (!hasQuery && path.startsWith("/vi/"))
|
||||
path = path.replace("/vi/", "/vi_webp/").replace(".jpg", ".webp");
|
||||
if (path.startsWith("/vi/") && !path.contains("_live")) {
|
||||
path = path.replace("/vi/", "/vi_webp/").replace(".jpg", ".webp").replace("hq720", "mqdefault")
|
||||
.replace("hqdefault", "mqdefault");
|
||||
hasQuery = false;
|
||||
}
|
||||
|
||||
return Constants.PROXY_PART + path + (hasQuery ? "?" + query + "&host=" : "?host=")
|
||||
+ URLUtils.silentEncode(host);
|
||||
|
|
Loading…
Reference in a new issue