configurable user agent

This commit is contained in:
Adam R Grey 2023-11-12 16:08:13 -05:00
parent c30deeed49
commit 983a57b3d7
3 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ namespace ttrss_co_client
public string OnDoneCopy { get; set; }
public string WorkingDirectory { get; set; } = "./working/";
public string ChatScript { get; set; }
public string UserAgent { get; set; }
public IEnumerable<FeedAction> feedActions { get; set; }
public class FeedAction
{

View File

@ -6,6 +6,7 @@
"onDoneCopy":"./",
"workingDirectory":"working/",
"chatScript": "miscChat.sh",
"userAgent": "Mozilla/5.0 (compatible; wget-is-not-a-crime/1.0)",
"feedActions":
[
{

View File

@ -25,7 +25,7 @@ namespace ttrss_co_client.tasks
var extensionUpstream = attachmentLink.Substring(attachmentLink.LastIndexOf('.'));
var downloadPath = Path.Combine(workingFolder, headline.title) + extensionUpstream;
var downloader = new HttpClient();
downloader.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)");
downloader.DefaultRequestHeaders.UserAgent.ParseAdd(Conf.UserAgent);
sw.Start();
var dlResult = (await downloader.GetAsync(attachmentLink));
File.WriteAllBytes(downloadPath, await dlResult.Content.ReadAsByteArrayAsync());