mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Reset metrics key if data is corrupted
This commit is contained in:
parent
4c0119561a
commit
124704939d
@ -19,9 +19,21 @@ namespace Wabbajack.Common
|
||||
using var _ = await _creationLock.WaitAsync();
|
||||
if (!Utils.HaveEncryptedJson(Consts.MetricsKeyHeader))
|
||||
{
|
||||
await Utils.MakeRandomKey().ToEcryptedJson(Consts.MetricsKeyHeader);
|
||||
var key = Utils.MakeRandomKey();
|
||||
await key.ToEcryptedJson(Consts.MetricsKeyHeader);
|
||||
return key;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return await Utils.FromEncryptedJson<string>(Consts.MetricsKeyHeader);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
var key = Utils.MakeRandomKey();
|
||||
await key.ToEcryptedJson(Consts.MetricsKeyHeader);
|
||||
return key;
|
||||
}
|
||||
return await Utils.FromEncryptedJson<string>(Consts.MetricsKeyHeader);
|
||||
}
|
||||
/// <summary>
|
||||
/// This is all we track for metrics, action, and value. The action will be like
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@ -46,13 +46,10 @@ namespace Wabbajack.Lib
|
||||
public static async Task<Common.Http.Client> GetClient()
|
||||
{
|
||||
var client = new Common.Http.Client();
|
||||
if (Utils.HaveEncryptedJson(Consts.MetricsKeyHeader))
|
||||
client.Headers.Add((Consts.MetricsKeyHeader, await Utils.FromEncryptedJson<string>(Consts.MetricsKeyHeader)));
|
||||
client.Headers.Add((Consts.MetricsKeyHeader, await Metrics.GetMetricsKey()));
|
||||
return client;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static async Task<Uri> GetModUpgrade(Archive oldArchive, Archive newArchive, TimeSpan? maxWait = null, TimeSpan? waitBetweenTries = null)
|
||||
{
|
||||
maxWait ??= TimeSpan.FromMinutes(10);
|
||||
|
Loading…
Reference in New Issue
Block a user