Closed Owaan closed 5 months ago
@Owaan Thank you for this PR! Can you explain a bit more the reasoning behind the changes? Is the current code for associating profiles with tarkov tracker tokens not working as intended?
@Razzmatazzz All good!
I've fixed two issues in this PR caused by the profileId
changes. My general thoughts are that both of these issues are caused by using a dictionary to map a profileId
to the API tokens when you might not need to. I have left that the same in my changes incase you had future plans regarding that.
Fixed by this commit
Testing Steps:
AppData/Local/TarkovMonitor/<path>/<version>/user.config
Expected Result: API success response
Actual Result: "TarkovTracker API error: The given key '' was not present in the dictionary."
Solution:
The original code here, currentProfile
could be an empty string so you'd never find the token in the dictionary.
return Task.Run<string>(() => {
return tokens[currentProfile];
});
I'm now passing the profileId into the TestToken
method.
Fixed by this commit and this commit
Testing Steps:
AppData/Local/TarkovMonitor/<path>/<version>/user.config
C:\Battlestate Games\EFT\Logs
directory (leaving one log which doesn't include a profileId)Expected Result: A graceful error indicating the game needs to be started at least once to track progress
Actual Result: An ambiguous error (I can't even recall exactly what it was at this point)
Solution:
I've just tried to catch a few places to handle if the profileId
couldn't be found.
Thanks for the explanation, and for the fixes!
@Razzmatazzz oh yeah you might be right I think I misread something and also forgot to use the profileId I passed in anyways lol... Will clean it up in a bit, test and recommit
@Razzmatazzz All changes fixed, first time using C#, apologies that wasn't so clean the first go around
I've just used your existing GetToken
method in the AuthorizationHeaderValueGetter
method now.
The main issue was in InitializeProgress
, we needed to set the TarkovTracker
profile before calling TarkovTracker.TestToken()
Resolves #73
Not sure if the profile ID needs to be mapped to the API key as TarkovTracker isn't separating profiles (yet). This should do the job though 👍
This also fixes the scenario where a user could be confused launching TarkovMonitor before launching Tarkov or having a profile reported in their logs. You'll still need to handle launching TarkovMonitor without even having Tarkov installed though....