mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-21 11:50:16 +08:00
Fix parameters and user agent for ImageRequestParameter.
This commit is contained in:
parent
78e340e2d8
commit
355f2aef3a
@ -633,7 +633,7 @@ class ImageRequestParameter(CustomNode):
|
|||||||
def INPUT_TYPES(cls) -> InputTypes:
|
def INPUT_TYPES(cls) -> InputTypes:
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"uri": ("STRING", {"default": ""})
|
"value": ("STRING", {"default": ""})
|
||||||
},
|
},
|
||||||
"optional": {
|
"optional": {
|
||||||
**_open_api_common_schema,
|
**_open_api_common_schema,
|
||||||
@ -644,12 +644,12 @@ class ImageRequestParameter(CustomNode):
|
|||||||
FUNCTION = "execute"
|
FUNCTION = "execute"
|
||||||
CATEGORY = "api/openapi"
|
CATEGORY = "api/openapi"
|
||||||
|
|
||||||
def execute(self, uri: str = "", *args, **kwargs) -> ValidatedNodeResult:
|
def execute(self, value: str = "", *args, **kwargs) -> ValidatedNodeResult:
|
||||||
output_images = []
|
output_images = []
|
||||||
|
|
||||||
f: OpenFile
|
f: OpenFile
|
||||||
kwargs_for_fsspec = {}
|
kwargs_for_fsspec = {}
|
||||||
if uri.startswith('http'):
|
if value.startswith('http'):
|
||||||
kwargs_for_fsspec.update({
|
kwargs_for_fsspec.update({
|
||||||
"headers": {
|
"headers": {
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.64 Safari/537.36'
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.64 Safari/537.36'
|
||||||
@ -657,7 +657,7 @@ class ImageRequestParameter(CustomNode):
|
|||||||
})
|
})
|
||||||
# todo: additional security is needed here to prevent users from accessing local paths
|
# todo: additional security is needed here to prevent users from accessing local paths
|
||||||
# however this generally needs to be done with user accounts on all OSes
|
# however this generally needs to be done with user accounts on all OSes
|
||||||
with fsspec.open(uri, mode="rb", **kwargs_for_fsspec) as f:
|
with fsspec.open(value, mode="rb", **kwargs_for_fsspec) as f:
|
||||||
# from LoadImage
|
# from LoadImage
|
||||||
img = Image.open(f)
|
img = Image.open(f)
|
||||||
for i in ImageSequence.Iterator(img):
|
for i in ImageSequence.Iterator(img):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user