mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 16:37:23 +01:00
add multi chracter key checks
This commit is contained in:
parent
c67add20d6
commit
9daf9b42a2
7 changed files with 35 additions and 16 deletions
|
|
@ -126,7 +126,18 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||
return;
|
||||
}
|
||||
|
||||
var secretKey = _serverManager.GetSecretKey();
|
||||
var secretKey = _serverManager.GetSecretKey(out bool multi);
|
||||
if (multi)
|
||||
{
|
||||
Logger.LogWarning("Multiple secret keys for current character");
|
||||
_connectionDto = null;
|
||||
Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Mare.",
|
||||
NotificationType.Error));
|
||||
await StopConnection(ServerState.MultiChara).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (secretKey.IsNullOrEmpty())
|
||||
{
|
||||
Logger.LogWarning("No secret key set for current character");
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||
tokenUri = MareAuth.AuthFullPath(new Uri(_serverManager.CurrentApiUrl
|
||||
.Replace("wss://", "https://", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("ws://", "http://", StringComparison.OrdinalIgnoreCase)));
|
||||
var secretKey = _serverManager.GetSecretKey()!;
|
||||
var secretKey = _serverManager.GetSecretKey(out _)!;
|
||||
var auth = secretKey.GetHash256();
|
||||
result = await _httpClient.PostAsync(tokenUri, new FormUrlEncodedContent(new[]
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||
{
|
||||
jwtIdentifier = new(_serverManager.CurrentApiUrl,
|
||||
_dalamudUtil.GetPlayerNameHashedAsync().GetAwaiter().GetResult(),
|
||||
_serverManager.GetSecretKey()!);
|
||||
_serverManager.GetSecretKey(out _)!);
|
||||
_lastJwtIdentifier = jwtIdentifier;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ public enum ServerState
|
|||
VersionMisMatch,
|
||||
RateLimited,
|
||||
NoSecretKey,
|
||||
MultiChara,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue