mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-08 08:42:07 +08:00
widget refactoring
This commit is contained in:
24
src/widgets/readarr/widget.js
Normal file
24
src/widgets/readarr/widget.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import genericProxyHandler from "utils/proxies/generic";
|
||||
import { jsonArrayFilter } from "utils/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/api/v1/{endpoint}?apikey={key}",
|
||||
proxyHandler: genericProxyHandler,
|
||||
|
||||
mappings: {
|
||||
book: {
|
||||
endpoint: "book",
|
||||
map: (data) => ({
|
||||
have: jsonArrayFilter(data, (item) => item?.statistics?.bookFileCount > 0).length,
|
||||
}),
|
||||
},
|
||||
"queue/status": {
|
||||
endpoint: "queue/status",
|
||||
},
|
||||
"wanted/missing": {
|
||||
endpoint: "wanted/missing",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default widget;
|
||||
Reference in New Issue
Block a user