1
0
зеркало из https://github.com/karl0ss/homepage.git synced 2025-09-18 15:40:04 +01:00

Enhancement: support API key for Kavita (#4784)

Этот коммит содержится в:
shamoon 2025-02-18 00:29:36 -08:00 коммит произвёл GitHub
родитель 63b9d395dd
Коммит 68480a65db
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -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, {