mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-14 22:30:29 +05:30
Better proxying of images.
This commit is contained in:
parent
a395115f18
commit
26b92c751a
@ -234,6 +234,9 @@ public class ResponseHelper {
|
|||||||
if (Constants.debug)
|
if (Constants.debug)
|
||||||
return old;
|
return old;
|
||||||
|
|
||||||
|
if (old == null || old.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -246,14 +249,17 @@ public class ResponseHelper {
|
|||||||
|
|
||||||
String query = url.getQuery();
|
String query = url.getQuery();
|
||||||
|
|
||||||
final boolean hasQuery = query != null;
|
boolean hasQuery = query != null;
|
||||||
|
|
||||||
String path = url.getPath();
|
String path = url.getPath();
|
||||||
|
|
||||||
path = path.replace("-rj", "-rw");
|
path = path.replace("-rj", "-rw");
|
||||||
|
|
||||||
if (!hasQuery && path.startsWith("/vi/"))
|
if (path.startsWith("/vi/") && !path.contains("_live")) {
|
||||||
path = path.replace("/vi/", "/vi_webp/").replace(".jpg", ".webp");
|
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=")
|
return Constants.PROXY_PART + path + (hasQuery ? "?" + query + "&host=" : "?host=")
|
||||||
+ URLUtils.silentEncode(host);
|
+ URLUtils.silentEncode(host);
|
||||||
|
Loading…
Reference in New Issue
Block a user