Fix UpdateAuthorizationHeader method
This commit is contained in:
@@ -88,7 +88,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
|||||||
{
|
{
|
||||||
_tubeArchivistApiKey = value;
|
_tubeArchivistApiKey = value;
|
||||||
Plugin.Instance?.LogTAApiConnectionStatus();
|
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.AllowAutoRedirect = false;
|
||||||
handler.CheckCertificateRevocationList = true;
|
handler.CheckCertificateRevocationList = true;
|
||||||
HttpClient = new HttpClient(handler);
|
HttpClient = new HttpClient(handler);
|
||||||
|
UpdateAuthorizationHeader(Configuration.TubeArchivistApiKey);
|
||||||
UpdateAuthorizationHeader();
|
|
||||||
|
|
||||||
SessionManager = sessionManager;
|
SessionManager = sessionManager;
|
||||||
sessionManager.PlaybackProgress += OnPlaybackProgress;
|
sessionManager.PlaybackProgress += OnPlaybackProgress;
|
||||||
@@ -133,12 +132,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the HTTP client's Authorization header with the current API key.
|
/// Updates the HTTP client's Authorization header with the current API key.
|
||||||
/// </summary>
|
/// </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 =
|
HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Token", apiKey);
|
||||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Token", Configuration.TubeArchivistApiKey);
|
|
||||||
Logger.LogInformation("{Message}", "Updated Authorization header with API key");
|
Logger.LogInformation("{Message}", "Updated Authorization header with API key");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user