fix empty identifier

This commit is contained in:
Stanley Dimant
2024-07-30 23:55:11 +02:00
committed by Loporrit
parent b2fa3b9f32
commit d39c79a227

View File

@@ -102,6 +102,13 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
try try
{ {
var playerIdentifier = await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false); var playerIdentifier = await _dalamudUtil.GetPlayerNameHashedAsync().ConfigureAwait(false);
if (string.IsNullOrEmpty(playerIdentifier))
{
_logger.LogTrace("GetIdentifier: PlayerIdentifier was null, returning last identifier {identifier}", _lastJwtIdentifier);
return _lastJwtIdentifier;
}
jwtIdentifier = new(_serverManager.CurrentApiUrl, jwtIdentifier = new(_serverManager.CurrentApiUrl,
playerIdentifier, playerIdentifier,
_serverManager.GetSecretKey(out _)!); _serverManager.GetSecretKey(out _)!);
@@ -111,15 +118,15 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
{ {
if (_lastJwtIdentifier == null) if (_lastJwtIdentifier == null)
{ {
_logger.LogError("GetOrUpdate: No last identifier found, aborting"); _logger.LogError("GetIdentifier: No last identifier found, aborting");
return null; return null;
} }
_logger.LogWarning(ex, "GetOrUpdate: Could not get JwtIdentifier for some reason or another, reusing last identifier {identifier}", _lastJwtIdentifier); _logger.LogWarning(ex, "GetIdentifier: Could not get JwtIdentifier for some reason or another, reusing last identifier {identifier}", _lastJwtIdentifier);
jwtIdentifier = _lastJwtIdentifier; jwtIdentifier = _lastJwtIdentifier;
} }
_logger.LogDebug("GetOrUpdate: Using identifier {identifier}", jwtIdentifier); _logger.LogDebug("GetIdentifier: Using identifier {identifier}", jwtIdentifier);
return jwtIdentifier; return jwtIdentifier;
} }