added api key authentication

might work, unable to test
This commit is contained in:
zmweske 2024-02-24 22:08:50 -06:00 committed by GitHub
parent da57b2779a
commit 50c26e2524
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,9 @@ export default async function genericProxyHandler(req, res, map) {
const headers = req.extraHeaders ?? widget.headers ?? {};
if (widget.username && widget.password) {
if (widget.key) {
headers.Authorization = `${widget.key}`;
} else if (widget.username && widget.password) {
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}