diff --git a/config.properties b/config.properties index 766df34..100e187 100644 --- a/config.properties +++ b/config.properties @@ -2,3 +2,6 @@ # The port to Listen on. PORT: 8080 +# Proxy +PROXY_PART: https://pipedproxy.kavin.rocks + diff --git a/src/main/java/me/kavin/piped/consts/Constants.java b/src/main/java/me/kavin/piped/consts/Constants.java index 7cd724b..7981bcf 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -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); } diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index dfef8ad..7dd0b42 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -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); } }