Add auth headers when used on cloud

This commit is contained in:
Austin Mroz
2025-12-17 14:23:30 -08:00
committed by AustinMroz
parent 537f3a0226
commit 3234937ff5
2 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-videohelpersuite"
description = "Nodes related to video workflows"
version = "1.7.8"
version = "1.7.9"
license = { file = "LICENSE" }
dependencies = ["opencv-python", "imageio-ffmpeg"]
+17 -1
View File
@@ -458,6 +458,17 @@ function allowDragFromWidget(widget) {
}
}
//Cloud specific auth code. Short circuits if not on cloud
async function getAuthHeader() {
try {
const authStore = await api.getAuthStore()
return authStore ? await authStore.getAuthHeader() : null
} catch (error) {
console.warn('Failed to get auth header:', error)
return null
}
}
async function uploadFile(file, progressCallback) {
try {
// Wrap file in formdata so it includes filename
@@ -478,7 +489,12 @@ async function uploadFile(file, progressCallback) {
req.upload.onprogress = (e) => progressCallback?.(e.loaded/e.total)
req.onload = () => resolve(req)
req.open('post', url, true)
req.send(body)
getAuthHeader().then((headers) => {
headers ??= {}
for (const key in headers)
req.setRequestHeader(key, headers[key])
req.send(body)
})
})
if (resp.status !== 200) {