Skip to content

Fix RSS Headers #1268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion application/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@
}
],
"fallbackChannelPattern": "java-news-and-changes",
"pollIntervalInMinutes": 10
"pollIntervalInMinutes": 10,
"clientRequestHeaders": {
"User-Agent": "Mozilla",
"Accept": "application/xml;",
"Accept-Language": "en-US;"
}
},
"memberCountCategoryPattern": "Info"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
Expand All @@ -12,18 +13,21 @@
* @param feeds The list of RSS feeds to subscribe to.
* @param fallbackChannelPattern The pattern used to identify the fallback text channel to use.
* @param pollIntervalInMinutes The interval (in minutes) for polling the RSS feeds for updates.
* @param clientRequestHeaders The headers that will be sent with each request to the RSS feeds.
*/
public record RSSFeedsConfig(@JsonProperty(value = "feeds", required = true) List<RSSFeed> feeds,
@JsonProperty(value = "fallbackChannelPattern",
required = true) String fallbackChannelPattern,
@JsonProperty(value = "pollIntervalInMinutes", required = true) int pollIntervalInMinutes) {
@JsonProperty(value = "pollIntervalInMinutes", required = true) int pollIntervalInMinutes,
@JsonProperty(value = "clientRequestHeaders") Map<String, String> clientRequestHeaders) {

/**
* Constructs a new {@link RSSFeedsConfig}.
*
* @param feeds The list of RSS feeds to subscribe to.
* @param fallbackChannelPattern The pattern used to identify the fallback text channel to use.
* @param pollIntervalInMinutes The interval (in minutes) for polling the RSS feeds for updates.
* @param clientRequestHeaders The headers that will be sent with each request to the RSS feeds.
* @throws NullPointerException if any of the parameters (feeds or fallbackChannelPattern) are
* null
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public RSSHandlerRoutine(Config config, Database database) {
targetChannelPatterns.put(feed, predicate);
}
});

this.rssReader = new RssReader();
this.config.clientRequestHeaders().forEach(this.rssReader::addHeader);
}

@Override
Expand Down
Loading