Skip to content

Commit f4abff2

Browse files
committed
Add auth headers when used on cloud
1 parent 537f3a0 commit f4abff2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-videohelpersuite"
33
description = "Nodes related to video workflows"
4-
version = "1.7.8"
4+
version = "1.7.9"
55
license = { file = "LICENSE" }
66
dependencies = ["opencv-python", "imageio-ffmpeg"]
77

web/js/VHS.core.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,17 @@ function allowDragFromWidget(widget) {
458458
}
459459
}
460460

461+
//Cloud specific auth code. Short circuits if not on cloud
462+
async function getAuthHeader() {
463+
try {
464+
const authStore = await api.getAuthStore()
465+
return authStore ? await authStore.getAuthHeader() : null
466+
} catch (error) {
467+
console.warn('Failed to get auth header:', error)
468+
return null
469+
}
470+
}
471+
461472
async function uploadFile(file, progressCallback) {
462473
try {
463474
// Wrap file in formdata so it includes filename
@@ -478,7 +489,12 @@ async function uploadFile(file, progressCallback) {
478489
req.upload.onprogress = (e) => progressCallback?.(e.loaded/e.total)
479490
req.onload = () => resolve(req)
480491
req.open('post', url, true)
481-
req.send(body)
492+
getAuthHeader().then((headers) => {
493+
headers ??= {}
494+
for (const key in headers)
495+
req.set(key, headers[key])
496+
req.send(body)
497+
})
482498
})
483499

484500
if (resp.status !== 200) {

0 commit comments

Comments
 (0)