Files
homepage/src/widgets/gitea/widget.js
T
Mustafa 11ca29104a
Docker CI / Docker Build & Push (push) Waiting to run
Lint / Linting Checks (push) Waiting to run
Release Drafter / Update Release Draft (push) Waiting to run
Release Drafter / Auto Label PR (push) Waiting to run
Tests / vitest (1) (push) Waiting to run
Tests / vitest (2) (push) Waiting to run
Tests / vitest (3) (push) Waiting to run
Tests / vitest (4) (push) Waiting to run
Chore: send Gitea/Forgejo API key as Authorization header (#7245)
2026-10-14 16:29:58 -07:00

34 lines
813 B
JavaScript

import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
// Get total from header to avoid pagination limit
export function totalCount(data, headers) {
const count = parseInt(headers?.["x-total-count"], 10);
return { count: Number.isNaN(count) ? null : count };
}
const widget = {
api: "{url}/api/v1/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
notifications: {
endpoint: "notifications?limit=1",
map: totalCount,
},
issues: {
endpoint: "repos/issues/search?type=issues&limit=1",
map: totalCount,
},
pulls: {
endpoint: "repos/issues/search?type=pulls&limit=1",
map: totalCount,
},
repositories: {
endpoint: "repos/search?limit=1",
map: totalCount,
},
},
};
export default widget;