Allow having a different url for pubsub. (#290)

This would be useful for onion instances.
This commit is contained in:
Kavin 2022-06-25 10:22:45 +01:00 committed by GitHub
parent 160e6933d3
commit e085d4c8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -34,6 +34,8 @@ public class Constants {
public static final String PUBLIC_URL; public static final String PUBLIC_URL;
public static final String PUBSUB_URL;
public static final String HTTP_PROXY; public static final String HTTP_PROXY;
public static final String FRONTEND_URL; public static final String FRONTEND_URL;
@ -69,6 +71,7 @@ public class Constants {
CAPTCHA_BASE_URL = getProperty(prop, "CAPTCHA_BASE_URL"); CAPTCHA_BASE_URL = getProperty(prop, "CAPTCHA_BASE_URL");
CAPTCHA_API_KEY = getProperty(prop, "CAPTCHA_API_KEY"); CAPTCHA_API_KEY = getProperty(prop, "CAPTCHA_API_KEY");
PUBLIC_URL = getProperty(prop, "API_URL"); PUBLIC_URL = getProperty(prop, "API_URL");
PUBSUB_URL = getProperty(prop, "PUBSUB_URL", PUBLIC_URL);
HTTP_PROXY = getProperty(prop, "HTTP_PROXY"); HTTP_PROXY = getProperty(prop, "HTTP_PROXY");
FRONTEND_URL = getProperty(prop, "FRONTEND_URL", "https://piped.kavin.rocks"); FRONTEND_URL = getProperty(prop, "FRONTEND_URL", "https://piped.kavin.rocks");
COMPROMISED_PASSWORD_CHECK = Boolean.parseBoolean(getProperty(prop, "COMPROMISED_PASSWORD_CHECK", "true")); COMPROMISED_PASSWORD_CHECK = Boolean.parseBoolean(getProperty(prop, "COMPROMISED_PASSWORD_CHECK", "true"));

View File

@ -1418,7 +1418,7 @@ public class ResponseHelper {
if (pubsub == null || System.currentTimeMillis() - pubsub.getSubbedAt() > TimeUnit.DAYS.toMillis(4)) { 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; String topic = "https://www.youtube.com/xml/feeds/videos.xml?channel_id=" + channelId;
var builder = new Request.Builder() var builder = new Request.Builder()