Skip to content

Commit 52e6965

Browse files
committed
API TOKEN 2
1 parent 6a7eea8 commit 52e6965

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Jellyfin.Plugin.AudioMuseAi/Controller/AudioMuseController.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ public async Task<IActionResult> TestConnection([FromBody] string backendUrl, Ca
104104
var client = _httpClientFactory.CreateClient();
105105
var trimmed = backendUrl.TrimEnd('/');
106106
client.BaseAddress = new System.Uri(trimmed);
107+
108+
var apiToken = Plugin.Instance?.Configuration?.ApiToken;
109+
if (!string.IsNullOrWhiteSpace(apiToken))
110+
{
111+
client.DefaultRequestHeaders.Authorization =
112+
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", apiToken);
113+
}
114+
107115
var resp = await client.GetAsync("/api/active_tasks", cancellationToken).ConfigureAwait(false);
108116

109117
if (resp.IsSuccessStatusCode)

0 commit comments

Comments
 (0)