mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +08:00
OpenAPI ImageRequestParameter node uses a Chrome user-agent to facilitate external URLs better
This commit is contained in:
parent
188eff3376
commit
d11aed87ba
@ -271,6 +271,9 @@ KNOWN_CONTROLNETS = [
|
||||
HuggingFile("lllyasviel/sd_control_collection", "thibaud_xl_openpose.safetensors"),
|
||||
HuggingFile("lllyasviel/sd_control_collection", "thibaud_xl_openpose_256lora.safetensors"),
|
||||
HuggingFile("jschoormans/controlnet-densepose-sdxl", "diffusion_pytorch_model.safetensors", save_with_filename="controlnet-densepose-sdxl.safetensors", convert_to_16_bit=True, size=2502139104),
|
||||
HuggingFile("stabilityai/stable-cascade", "controlnet/canny.safetensors", save_with_filename="stable_cascade_canny.safetensors"),
|
||||
HuggingFile("stabilityai/stable-cascade", "controlnet/inpainting.safetensors", save_with_filename="stable_cascade_inpainting.safetensors"),
|
||||
HuggingFile("stabilityai/stable-cascade", "controlnet/super_resolution.safetensors", save_with_filename="stable_cascade_super_resolution.safetensors"),
|
||||
]
|
||||
|
||||
KNOWN_DIFF_CONTROLNETS = [
|
||||
|
||||
@ -647,7 +647,17 @@ class ImageRequestParameter(CustomNode):
|
||||
def execute(self, uri: str = "", *args, **kwargs) -> ValidatedNodeResult:
|
||||
output_images = []
|
||||
|
||||
with fsspec.open(uri, mode="rb") as f:
|
||||
f: OpenFile
|
||||
kwargs_for_fsspec = {}
|
||||
if uri.startswith('http'):
|
||||
kwargs_for_fsspec.update({
|
||||
"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'
|
||||
}
|
||||
})
|
||||
# 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
|
||||
with fsspec.open(uri, mode="rb", **kwargs_for_fsspec) as f:
|
||||
# from LoadImage
|
||||
img = Image.open(f)
|
||||
for i in ImageSequence.Iterator(img):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user