diff --git a/TarkovMonitor/Blazor/Pages/Settings/Settings.razor b/TarkovMonitor/Blazor/Pages/Settings/Settings.razor
index 48fd1f8..b5b4ee1 100644
--- a/TarkovMonitor/Blazor/Pages/Settings/Settings.razor
+++ b/TarkovMonitor/Blazor/Pages/Settings/Settings.razor
@@ -119,17 +119,26 @@
@LocalizationService.GetString("TarkovTracker")
- @LocalizationService.GetString("GetAToken")
- @LocalizationService.GetString("TestToken")
- @LocalizationService.GetString("CurrentProfile"):
- @TarkovDev.GetPlayerName(GameWatcher.CurrentProfile) (@GameWatcher.CurrentProfile.Type)
-
@foreach (var pair in TarkovTracker.Domains)
{
@pair.Value
}
+ @if (IsRetiredTrackerService)
+ {
+
+ Support for TarkovTracker.io has been retired. Switch to TarkovTracker.org for continued support.
+
+ }
+ @if (!IsRetiredTrackerService)
+ {
+ @LocalizationService.GetString("GetAToken")
+ @LocalizationService.GetString("TestToken")
+ @LocalizationService.GetString("CurrentProfile"):
+ @TarkovDev.GetPlayerName(GameWatcher.CurrentProfile) (@GameWatcher.CurrentProfile.Type)
+
+ }
@@ -486,7 +495,7 @@
{
get
{
- return TarkovTracker.GetToken(GameWatcher.CurrentProfile.Id).Length != 22;
+ return TarkovTracker.IsLegacyService || TarkovTracker.GetToken(GameWatcher.CurrentProfile.Id).Length != 22;
}
set
{
@@ -534,11 +543,14 @@
{
get
{
- return TarkovTracker.GetToken(GameWatcher.CurrentProfile.Id);
+ return TarkovTracker.IsLegacyService ? "" : TarkovTracker.GetToken(GameWatcher.CurrentProfile.Id);
}
set
{
- TarkovTracker.SetToken(GameWatcher.CurrentProfile.Id, value);
+ if (!TarkovTracker.IsLegacyService)
+ {
+ TarkovTracker.SetToken(GameWatcher.CurrentProfile.Id, value);
+ }
}
}
public string TarkovTrackerDomain
@@ -554,12 +566,41 @@
return;
}
Properties.Settings.Default.tarkovTrackerDomain = value;
- TarkovTrackerToken = "";
+ TarkovTracker.ResetActiveState();
TarkovTracker.InitAPI();
Properties.Settings.Default.Save();
+ if (!TarkovTracker.IsLegacyService)
+ {
+ _ = RevalidateTrackerProfile();
+ }
}
}
+ private async Task RevalidateTrackerProfile()
+ {
+ if (string.IsNullOrWhiteSpace(GameWatcher.CurrentProfile.Id))
+ {
+ return;
+ }
+
+ try
+ {
+ await TarkovTracker.SetProfile(GameWatcher.CurrentProfile.Id);
+ }
+ catch (Exception ex)
+ {
+ messageLog.AddMessage(ex.Message, "exception");
+ }
+ }
+
+ private bool IsRetiredTrackerService => string.Equals(
+ TarkovTrackerDomain,
+ "tarkovtracker.io",
+ StringComparison.OrdinalIgnoreCase);
+
+ private string CurrentProfileUrl =>
+ $"https://tarkov.dev/players/{GameWatcher.CurrentProfile.Type.ToString().ToLower()}/{GameWatcher.CurrentProfile.AccountId}";
+
void TokenShowClick()
{
if (tokenShow)
diff --git a/TarkovMonitor/TarkovTracker.cs b/TarkovMonitor/TarkovTracker.cs
index 823bf58..71f6486 100644
--- a/TarkovMonitor/TarkovTracker.cs
+++ b/TarkovMonitor/TarkovTracker.cs
@@ -34,6 +34,10 @@ internal interface ITarkovTrackerAPI
public static ProgressResponse Progress { get; private set; } = new();
public static bool ValidToken { get; private set; } = false;
+ public static bool IsLegacyService => string.Equals(
+ Properties.Settings.Default.tarkovTrackerDomain,
+ "tarkovtracker.io",
+ StringComparison.OrdinalIgnoreCase);
private static Dictionary tokens = new();
private static string currentProfile = "";
public static string CurrentProfileId { get { return currentProfile; } }
@@ -65,6 +69,13 @@ public static ITarkovTrackerAPI InitAPI()
return api;
}
+ public static void ResetActiveState()
+ {
+ currentProfile = "";
+ ValidToken = false;
+ Progress = new();
+ }
+
public static string GetToken(string profileId)
{
if (!tokens.ContainsKey(profileId))
@@ -76,6 +87,10 @@ public static string GetToken(string profileId)
public static void SetToken(string profileId, string token)
{
+ if (IsLegacyService)
+ {
+ return;
+ }
if (profileId == "")
{
throw new Exception("No PVP or PVE profile initialized, please launch Escape from Tarkov first");
@@ -87,6 +102,11 @@ public static void SetToken(string profileId, string token)
public static async Task SetProfile(string profileId)
{
+ if (IsLegacyService)
+ {
+ ResetActiveState();
+ return Progress;
+ }
if (profileId == "") {
throw new Exception("Can't set PVP or PVE profile, please launch Escape from Tarkov and then restart this application");
}
@@ -145,7 +165,7 @@ private static void SyncStoredStatus(string questId, TaskStatus status)
public static async Task SetTaskStatus(string questId, TaskStatus status)
{
- if (!ValidToken)
+ if (IsLegacyService || !ValidToken)
{
throw new Exception("Invalid token");
}
@@ -231,7 +251,7 @@ public static async Task SetTaskStarted(string questId)
public static async Task SetTaskStatuses(Dictionary statuses)
{
- if (!ValidToken)
+ if (IsLegacyService || !ValidToken)
{
throw new Exception("Invalid token");
}
@@ -271,6 +291,11 @@ public static async Task SetTaskStatuses(Dictionary
public static async Task GetProgress()
{
+ if (IsLegacyService)
+ {
+ ResetActiveState();
+ return Progress;
+ }
if (!ValidToken)
{
throw new Exception("Invalid token");
@@ -301,6 +326,11 @@ public static async Task GetProgress()
public static async Task TestToken(string apiToken)
{
+ if (IsLegacyService)
+ {
+ throw new InvalidOperationException(
+ "Support for TarkovTracker.io has been retired. Switch to TarkovTracker.org.");
+ }
try
{
var response = await api.TestToken(apiToken);