Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion SHM.Utilities/BrewProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public async Task<IEnumerable<RawBrew>> RetrieveRawAsync(string source)
public async Task<IEnumerable<RawVitaDbBrew>> RetrieveRawFromVitaDbAsync(string source = null)
{
source = source ?? Constants.VitaDBBrewsListUri;
return await Try.ItAsync(async () => await source.GetJsonAsync<List<RawVitaDbBrew>>()) ?? new List<RawVitaDbBrew>();
return await Try.ItAsync(async () =>
await source
.WithHeader("User-Agent", "Other")
.GetJsonAsync<List<RawVitaDbBrew>>())
?? new List<RawVitaDbBrew>();
}

public bool IsKindRetrievable(BrewKind kind)
Expand Down
2 changes: 2 additions & 0 deletions SHM/FormGetHomebrew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ private void LoadVitadb_sync(string path, Action<List<Item>> result)// bool addD
try
{
WebClient wc = new WebClient();
wc.Headers.Add("User-Agent: Other");
string content = wc.DownloadString(new Uri(path));
wc.Dispose();
content = Encoding.UTF8.GetString(Encoding.Default.GetBytes(content));
Expand Down Expand Up @@ -187,6 +188,7 @@ private void LoadDatabase_sync(string path, Action<List<Item>> result)// bool ad
try
{
WebClient wc = new WebClient();
wc.Headers.Add("User-Agent: Other");
string content = wc.DownloadString(new Uri(path));
wc.Dispose();
content = Encoding.UTF8.GetString(Encoding.Default.GetBytes(content));
Expand Down