Add support of NC-Token to Nextcloud widget

pull/1121/head
Mirek Szajowski 2 years ago
parent b488d6a13c
commit 94dc5ad0e5

@ -48,6 +48,14 @@ export default async function credentialedProxyHandler(req, res, map) {
headers.Authorization = `Token ${widget.key}`;
} else if (widget.type === "miniflux") {
headers["X-Auth-Token"] = `${widget.key}`;
} else if (widget.type === "nextcloud") {
if ('key' in widget) {
logger.debug("Setting nextcloud to use NC-Token");
headers["NC-Token"] = `${widget.key}`;
} else {
logger.debug("Setting nextcloud to use username", widget.username);
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}
} else {
headers["X-API-Key"] = `${widget.key}`;
}

@ -1,8 +1,8 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/{endpoint}",
proxyHandler: genericProxyHandler,
proxyHandler: credentialedProxyHandler,
mappings: {
serverinfo: {
@ -11,4 +11,4 @@ const widget = {
},
};
export default widget;
export default widget;

Loading…
Cancel
Save