Skip to content

Commit 3bc3e7c

Browse files
potchristolis
andauthored
Fix RSS Headers (#1268)
* fix: add temp user agent and temp headers * wip(RSSHandlerRoutine.java): add headers to config Better to have it in the configuration file as default for those who need it than hardcoded in the code. Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com> * docs: add javadocs to rss feed config & update config with more minimal headers * Update to TJ agent * hardcode user agent --------- Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com> Co-authored-by: Chris Sdogkos <work@chris-sdogkos.com>
1 parent d2eb7ef commit 3bc3e7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

application/src/main/java/org/togetherjava/tjbot/features/rss/RSSHandlerRoutine.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public final class RSSHandlerRoutine implements Routine {
7474
private static final int MAX_CONTENTS = 1000;
7575
private static final ZonedDateTime ZONED_TIME_MIN =
7676
ZonedDateTime.of(LocalDateTime.MIN, ZoneId.systemDefault());
77+
private static final String HTTP_USER_AGENT =
78+
"TJ-Bot/1.0 (+https://github.com/Together-Java/TJ-Bot)";
7779
private final RssReader rssReader;
7880
private final RSSFeedsConfig config;
7981
private final Predicate<String> fallbackChannelPattern;
@@ -101,7 +103,9 @@ public RSSHandlerRoutine(Config config, Database database) {
101103
targetChannelPatterns.put(feed, predicate);
102104
}
103105
});
106+
104107
this.rssReader = new RssReader();
108+
this.rssReader.setUserAgent(HTTP_USER_AGENT);
105109
}
106110

107111
@Override

0 commit comments

Comments
 (0)