mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
configurable user agent string (#825)
This commit is contained in:
@@ -67,6 +67,9 @@ app:
|
|||||||
# announcement string displayed on the main page
|
# announcement string displayed on the main page
|
||||||
announcement:
|
announcement:
|
||||||
|
|
||||||
|
# user-agent string that will be used by the http client, leave empty for the default one
|
||||||
|
userAgent:
|
||||||
|
|
||||||
# Database connection
|
# Database connection
|
||||||
# -------------------
|
# -------------------
|
||||||
# for MySQL
|
# for MySQL
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ app:
|
|||||||
# announcement string displayed on the main page
|
# announcement string displayed on the main page
|
||||||
announcement:
|
announcement:
|
||||||
|
|
||||||
|
# user-agent string that will be used by the http client, leave empty for the default one
|
||||||
|
userAgent:
|
||||||
|
|
||||||
# Database connection
|
# Database connection
|
||||||
# -------------------
|
# -------------------
|
||||||
# for MySQL
|
# for MySQL
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ public class CommaFeedConfiguration extends Configuration {
|
|||||||
@Valid
|
@Valid
|
||||||
private String announcement;
|
private String announcement;
|
||||||
|
|
||||||
|
private String userAgent;
|
||||||
|
|
||||||
public Date getUnreadThreshold() {
|
public Date getUnreadThreshold() {
|
||||||
int keepStatusDays = getKeepStatusDays();
|
int keepStatusDays = getKeepStatusDays();
|
||||||
return keepStatusDays > 0 ? DateUtils.addDays(new Date(), -1 * keepStatusDays) : null;
|
return keepStatusDays > 0 ? DateUtils.addDays(new Date(), -1 * keepStatusDays) : null;
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ public class HttpGetter {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HttpGetter(CommaFeedConfiguration config) {
|
public HttpGetter(CommaFeedConfiguration config) {
|
||||||
this.userAgent = String.format("CommaFeed/%s (https://github.com/Athou/commafeed)", config.getVersion());
|
this.userAgent = config.getApplicationSettings().getUserAgent();
|
||||||
|
if (this.userAgent == null) {
|
||||||
|
this.userAgent = String.format("CommaFeed/%s (https://github.com/Athou/commafeed)", config.getVersion());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResult getBinary(String url, int timeout) throws ClientProtocolException, IOException, NotModifiedException {
|
public HttpResult getBinary(String url, int timeout) throws ClientProtocolException, IOException, NotModifiedException {
|
||||||
|
|||||||
Reference in New Issue
Block a user