From e085d4c8a32afa8b4ba2cc7beb746c6389b4fb89 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sat, 25 Jun 2022 10:22:45 +0100 Subject: [PATCH] Allow having a different url for pubsub. (#290) This would be useful for onion instances. --- src/main/java/me/kavin/piped/consts/Constants.java | 3 +++ src/main/java/me/kavin/piped/utils/ResponseHelper.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/kavin/piped/consts/Constants.java b/src/main/java/me/kavin/piped/consts/Constants.java index 6990876..3e00ef5 100644 --- a/src/main/java/me/kavin/piped/consts/Constants.java +++ b/src/main/java/me/kavin/piped/consts/Constants.java @@ -34,6 +34,8 @@ public class Constants { public static final String PUBLIC_URL; + public static final String PUBSUB_URL; + public static final String HTTP_PROXY; public static final String FRONTEND_URL; @@ -69,6 +71,7 @@ public class Constants { CAPTCHA_BASE_URL = getProperty(prop, "CAPTCHA_BASE_URL"); CAPTCHA_API_KEY = getProperty(prop, "CAPTCHA_API_KEY"); PUBLIC_URL = getProperty(prop, "API_URL"); + PUBSUB_URL = getProperty(prop, "PUBSUB_URL", PUBLIC_URL); HTTP_PROXY = getProperty(prop, "HTTP_PROXY"); FRONTEND_URL = getProperty(prop, "FRONTEND_URL", "https://piped.kavin.rocks"); COMPROMISED_PASSWORD_CHECK = Boolean.parseBoolean(getProperty(prop, "COMPROMISED_PASSWORD_CHECK", "true")); diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 1ba83b7..31c0d51 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -1418,7 +1418,7 @@ public class ResponseHelper { if (pubsub == null || System.currentTimeMillis() - pubsub.getSubbedAt() > TimeUnit.DAYS.toMillis(4)) { - String callback = Constants.PUBLIC_URL + "/webhooks/pubsub"; + String callback = Constants.PUBSUB_URL + "/webhooks/pubsub"; String topic = "https://www.youtube.com/xml/feeds/videos.xml?channel_id=" + channelId; var builder = new Request.Builder()