Fix UpdateAuthorizationHeader method
This commit is contained in:
@@ -88,7 +88,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
{
|
||||
_tubeArchivistApiKey = value;
|
||||
Plugin.Instance?.LogTAApiConnectionStatus();
|
||||
Plugin.Instance?.UpdateAuthorizationHeader();
|
||||
Plugin.Instance?.UpdateAuthorizationHeader(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogDebug("Set JFUsernamesTo to: {Message}", value);
|
||||
_logger.LogDebug("Set JFUsernamesTo to: {Message}", string.Join(", ", _jfUsernamesTo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
handler.AllowAutoRedirect = false;
|
||||
handler.CheckCertificateRevocationList = true;
|
||||
HttpClient = new HttpClient(handler);
|
||||
|
||||
UpdateAuthorizationHeader();
|
||||
UpdateAuthorizationHeader(Configuration.TubeArchivistApiKey);
|
||||
|
||||
SessionManager = sessionManager;
|
||||
sessionManager.PlaybackProgress += OnPlaybackProgress;
|
||||
@@ -133,12 +132,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
/// <summary>
|
||||
/// Updates the HTTP client's Authorization header with the current API key.
|
||||
/// </summary>
|
||||
public void UpdateAuthorizationHeader()
|
||||
/// <param name="apiKey">TubeArchivist API key.</param>
|
||||
public void UpdateAuthorizationHeader(string apiKey)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration.TubeArchivistApiKey))
|
||||
if (!string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
HttpClient.DefaultRequestHeaders.Authorization =
|
||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Token", Configuration.TubeArchivistApiKey);
|
||||
HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Token", apiKey);
|
||||
Logger.LogInformation("{Message}", "Updated Authorization header with API key");
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user