Komga Widget (#922)

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Bryan
2023-02-02 22:48:40 -05:00
committed by GitHub
parent aee8ba1e1d
commit f851085ebf
5 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
import { jsonArrayFilter } from "utils/proxy/api-helpers";
const widget = {
api: "{url}/api/v1/{endpoint}",
proxyHandler: genericProxyHandler,
mappings: {
libraries: {
endpoint: "libraries",
map: (data) => ({
total: jsonArrayFilter(data, (item) => !item.unavailable).length,
}),
},
series: {
endpoint: "series",
validate: [
"totalElements"
]
},
books: {
endpoint: "books",
validate: [
"totalElements"
]
},
},
};
export default widget;