Enhancement: support dockhand api key auth (#6848)

This commit is contained in:
shamoon
2026-07-07 18:44:31 -07:00
committed by GitHub
parent 1b027912f4
commit c323b5b2e4
2 changed files with 9 additions and 2 deletions
+8 -2
View File
@@ -38,12 +38,18 @@ export default async function dockhandProxyHandler(req, res) {
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
const headers = {};
if (widget.key) {
headers.Authorization = `Bearer ${widget.key}`;
}
let [status, contentType, data] = await httpProxy(url, {
method: req.method,
headers,
});
// Attempt login and retrying once
if (status === 401) {
// Attempt login (username + password only) and retry once
if (status === 401 && !widget.key) {
const loggedIn = await login(widget);
if (loggedIn) {
[status, contentType, data] = await httpProxy(url, {