Enhancement: support API key for Kavita (#4784)

This commit is contained in:
shamoon 2025-02-18 00:29:36 -08:00 committed by GitHub
parent 63b9d395dd
commit 68480a65db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

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