Merge pull request #1572 from Cyb3rzombie/paperlessngx_token

Enhancement: add support for auth token in paperless-ngx widget
pull/1575/head
shamoon 2 years ago committed by GitHub
commit c1a68a79ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,6 +55,12 @@ export default async function credentialedProxyHandler(req, res, map) {
} else {
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}
} else if (widget.type === "paperlessngx") {
if (widget.key) {
headers.Authorization = `Token ${widget.key}`;
} else {
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}/api/{endpoint}",
proxyHandler: genericProxyHandler,
proxyHandler: credentialedProxyHandler,
mappings: {
"statistics": {

Loading…
Cancel
Save