add support for using an API key with Kavita

This commit is contained in:
pointless-existence 2024-10-07 19:47:08 +01:00
parent cd8c224ffa
commit 710b79fdc8
2 changed files with 2 additions and 1 deletions

View File

@ -15,4 +15,5 @@ widget:
url: http://kavita.host.or.ip:port url: http://kavita.host.or.ip:port
username: username username: username
password: password password: password
apiKey: apikeyapikeyapikeyapikeyapikey
``` ```

View File

@ -14,7 +14,7 @@ async function login(widget, service) {
const endpoint = "Account/login"; const endpoint = "Account/login";
const api = widgets?.[widget.type]?.api; const api = widgets?.[widget.type]?.api;
const loginUrl = new URL(formatApiCall(api, { endpoint, ...widget })); const loginUrl = new URL(formatApiCall(api, { endpoint, ...widget }));
const loginBody = { username: widget.username, password: widget.password }; const loginBody = { username: widget.username || "", password: widget.password || "", apiKey: widget.apiKey || "" };
const headers = { "Content-Type": "application/json", accept: "text/plain" }; const headers = { "Content-Type": "application/json", accept: "text/plain" };
const [, , data] = await httpProxy(loginUrl, { const [, , data] = await httpProxy(loginUrl, {