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,10 +19,22 @@ namespace Wabbajack.Common
|
|||||||
using var _ = await _creationLock.WaitAsync();
|
using var _ = await _creationLock.WaitAsync();
|
||||||
if (!Utils.HaveEncryptedJson(Consts.MetricsKeyHeader))
|
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);
|
return await Utils.FromEncryptedJson<string>(Consts.MetricsKeyHeader);
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
var key = Utils.MakeRandomKey();
|
||||||
|
await key.ToEcryptedJson(Consts.MetricsKeyHeader);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is all we track for metrics, action, and value. The action will be like
|
/// This is all we track for metrics, action, and value. The action will be like
|
||||||
/// "downloaded", the value "Joe's list".
|
/// "downloaded", the value "Joe's list".
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@ -46,13 +46,10 @@ namespace Wabbajack.Lib
|
|||||||
public static async Task<Common.Http.Client> GetClient()
|
public static async Task<Common.Http.Client> GetClient()
|
||||||
{
|
{
|
||||||
var client = new Common.Http.Client();
|
var client = new Common.Http.Client();
|
||||||
if (Utils.HaveEncryptedJson(Consts.MetricsKeyHeader))
|
client.Headers.Add((Consts.MetricsKeyHeader, await Metrics.GetMetricsKey()));
|
||||||
client.Headers.Add((Consts.MetricsKeyHeader, await Utils.FromEncryptedJson<string>(Consts.MetricsKeyHeader)));
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static async Task<Uri> GetModUpgrade(Archive oldArchive, Archive newArchive, TimeSpan? maxWait = null, TimeSpan? waitBetweenTries = null)
|
public static async Task<Uri> GetModUpgrade(Archive oldArchive, Archive newArchive, TimeSpan? maxWait = null, TimeSpan? waitBetweenTries = null)
|
||||||
{
|
{
|
||||||
maxWait ??= TimeSpan.FromMinutes(10);
|
maxWait ??= TimeSpan.FromMinutes(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user