mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add support for an external proxy.
This commit is contained in:
parent
41395b47d0
commit
f18f87c736
3 changed files with 8 additions and 1 deletions
|
@ -2,3 +2,6 @@
|
|||
# The port to Listen on.
|
||||
PORT: 8080
|
||||
|
||||
# Proxy
|
||||
PROXY_PART: https://pipedproxy.kavin.rocks
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ public class Constants {
|
|||
|
||||
public static final int PORT;
|
||||
|
||||
public static final String PROXY_PART;
|
||||
|
||||
public static final StreamingService YOUTUBE_SERVICE;
|
||||
|
||||
public static final HttpClient h2client = HttpClient.newBuilder().followRedirects(Redirect.NORMAL)
|
||||
|
@ -34,6 +36,7 @@ public class Constants {
|
|||
prop.load(new FileReader("config.properties"));
|
||||
|
||||
PORT = Integer.parseInt(prop.getProperty("PORT"));
|
||||
PROXY_PART = prop.getProperty("PROXY_PART");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,8 @@ public class ResponseHelper {
|
|||
if (!hasQuery && path.startsWith("/vi/"))
|
||||
path = path.replace("/vi/", "/vi_webp/").replace(".jpg", ".webp");
|
||||
|
||||
return path + (hasQuery ? "?" + query + "&host=" : "?host=") + URLUtils.silentEncode(host);
|
||||
return Constants.PROXY_PART + path + (hasQuery ? "?" + query + "&host=" : "?host=")
|
||||
+ URLUtils.silentEncode(host);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue