mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-19 21:06:19 +01:00
Enhancement: support API key for Kavita (#4784)
This commit is contained in:
parent
63b9d395dd
commit
68480a65db
@ -15,4 +15,5 @@ widget:
|
||||
url: http://kavita.host.or.ip:port
|
||||
username: username
|
||||
password: password
|
||||
key: kavitaapikey # Optional, e.g. if not using username and password
|
||||
```
|
||||
|
@ -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, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user