|
|
|
@ -21,10 +21,14 @@ export default async function komgaProxyHandler(req, res) {
|
|
|
|
|
try {
|
|
|
|
|
const data = {};
|
|
|
|
|
const headers = {
|
|
|
|
|
Authorization: `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`,
|
|
|
|
|
Accept: "application/json",
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
if (widget.username && widget.password) {
|
|
|
|
|
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
|
|
|
|
} else if (widget.key) {
|
|
|
|
|
headers["X-Api-Key"] = widget.key;
|
|
|
|
|
}
|
|
|
|
|
const librariesURL = formatApiCall(widgets?.[widget.type].api, { ...widget, endpoint: "libraries" });
|
|
|
|
|
const [librariesStatus, , librariesData] = await httpProxy(librariesURL, {
|
|
|
|
|
method: "GET",
|
|
|
|
|