Skip to content

Commit 1767f81

Browse files
committed
Removed hotslogs, hotsapi references and switched to new API storage url
1 parent d4ab8f0 commit 1767f81

File tree

5 files changed

+10
-56
lines changed

5 files changed

+10
-56
lines changed

Heroesprofile.Uploader.Common/IUploader.cs

-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ namespace Heroesprofile.Uploader.Common
66
{
77
public interface IUploader
88
{
9-
bool UploadToHotslogs { get; set; }
109
Task CheckDuplicate(IEnumerable<ReplayFile> replays);
11-
Task<int> GetMinimumBuild();
1210
Task Upload(Replay replay_results, ReplayFile file, bool PostMatchPage);
1311
Task<UploadStatus> Upload(Replay replay_results, string fingerprint, string file, bool PostMatchPage);
1412
}

Heroesprofile.Uploader.Common/Manager.cs

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ public async void Start(IMonitor monitor, ILiveMonitor live_monitor, IAnalyzer a
120120
_monitor.Start();
121121
StartBattleLobbyWatcherEvent();
122122

123-
_analyzer.MinimumBuild = await _uploader.GetMinimumBuild();
124-
125123
for (int i = 0; i < MaxThreads; i++) {
126124
Task.Run(UploadLoop).Forget();
127125
}

Heroesprofile.Uploader.Common/Uploader.cs

+7-49
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@ public class Uploader : IUploader
1616
{
1717
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
1818
#if DEBUG
19-
const string HeroesProfileApiEndpoint = "https://api.heroesprofile.com/api";
20-
const string HeroesProfileMatchParsed = "https://api.heroesprofile.com/openApi/Replay/Parsed/?replayID=";
21-
const string HeroesProfileMatchSummary = "https://www.heroesprofile.com/Match/Single/?replayID=";
22-
const string HotsAPIApiEndpoint = "http://hotsapi.local/api/v1";
19+
const string HeroesProfileApiEndpoint = "http://127.0.0.1:8000/api";
20+
const string HeroesProfileMatchParsed = "http://127.0.0.1:8000/openApi/Replay/Parsed/?replayID=";
21+
const string HeroesProfileMatchSummary = "http://localhost/Match/Single/?replayID=";
22+
23+
2324

2425
#else
2526
const string HeroesProfileApiEndpoint = "https://api.heroesprofile.com/api";
2627
const string HeroesProfileMatchParsed = "https://api.heroesprofile.com/openApi/Replay/Parsed/?replayID=";
2728
const string HeroesProfileMatchSummary = "https://www.heroesprofile.com/Match/Single/?replayID=";
28-
const string HotsAPIApiEndpoint = "https://hotsapi.net/api/v1";
2929
#endif
3030

31-
public bool UploadToHotslogs { get; set; }
3231
/// <summary>
3332
/// New instance of replay uploader
3433
/// </summary>
@@ -62,23 +61,10 @@ public async Task<UploadStatus> Upload(Replay replay_results, string fingerprint
6261
try {
6362
string response;
6463
using (var client = new WebClient()) {
65-
//var bytes = await client.UploadFileTaskAsync($"{HeroesProfileApiEndpoint}/upload?fingerprint={fingerprint}&data={replay_json}", file);
66-
67-
var bytes = await client.UploadFileTaskAsync($"{HeroesProfileApiEndpoint}/upload?fingerprint={fingerprint}", file);
64+
var bytes = await client.UploadFileTaskAsync($"{HeroesProfileApiEndpoint}/upload/heroesprofile/desktop/?fingerprint={fingerprint}", file);
6865
response = Encoding.UTF8.GetString(bytes);
6966
}
7067

71-
//Try upload to HotsApi as well
72-
string hotsapiResponse;
73-
try {
74-
using (var client = new WebClient()) {
75-
var bytes = await client.UploadFileTaskAsync($"{HotsAPIApiEndpoint}/upload?uploadToHotslogs={UploadToHotslogs}", file);
76-
hotsapiResponse = Encoding.UTF8.GetString(bytes);
77-
}
78-
}
79-
catch {
80-
81-
}
8268
dynamic json = JObject.Parse(response);
8369

8470
try {
@@ -195,35 +181,7 @@ public async Task CheckDuplicate(IEnumerable<ReplayFile> replays)
195181
}
196182

197183
/// <summary>
198-
/// Get minimum HotS client build supported by HotsApi
199-
/// </summary>
200-
public async Task<int> GetMinimumBuild()
201-
{
202-
//We likely want to track which replays arn't supported by HotsApi so that we don't send them to HotsApi,
203-
//but I would like to change this so that it doesn't prevent replays uploading to our own storage, as we can support any replay build
204-
205-
206-
try {
207-
using (var client = new WebClient()) {
208-
var response = await client.DownloadStringTaskAsync($"{HeroesProfileApiEndpoint}/replays/hotsapi-min-build");
209-
if (!int.TryParse(response, out int build)) {
210-
_log.Warn($"Error parsing minimum build: {response}");
211-
return 0;
212-
}
213-
return 0;
214-
}
215-
}
216-
catch (WebException ex) {
217-
if (await CheckApiThrottling(ex.Response)) {
218-
return await GetMinimumBuild();
219-
}
220-
_log.Warn(ex, $"Error getting minimum build");
221-
return 0;
222-
}
223-
}
224-
225-
/// <summary>
226-
/// Check if Hotsapi request limit is reached and wait if it is
184+
/// Check if Heroes Profile API request limit is reached and wait if it is
227185
/// </summary>
228186
/// <param name="response">Server response to examine</param>
229187
private async Task<bool> CheckApiThrottling(WebResponse response)

Heroesprofile.Uploader.Windows/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
// You can specify all the values or you can default the Build and Revision Numbers
5353
// by using the '*' as shown below:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("2.1.2")]
56-
[assembly: AssemblyFileVersion("2.1.2")]
55+
[assembly: AssemblyVersion("2.3.0")]
56+
[assembly: AssemblyFileVersion("2.3.0")]
5757
[assembly: AssemblyInformationalVersion("1.0.0")]

Heroesprofile.Uploader.Windows/SquirrelRelease.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
5: CD to Installer directory
1010

11-
6: Squirrel --releasify=Heroesprofile.Uploader.2.1.2.nupkg --no-msi --setupIcon=uploader_icon_light.ico
11+
6: Squirrel --releasify=Heroesprofile.Uploader.2.3.0.nupkg --no-msi --setupIcon=uploader_icon_light.ico

0 commit comments

Comments
 (0)