Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dragdrop for URLs to read infotext #15262

Merged
merged 4 commits into from Mar 17, 2024

Conversation

catboxanon
Copy link
Collaborator

@catboxanon catboxanon commented Mar 15, 2024

Description

Adds the ability to drag and drop URLs (like an address from the browser address bar) or images that originate from URLs. The usecase for this is dragdropping images from another website or another browser instance of the webui to read the infotext.

Update: this now works on the frontend rather than the backend to avoid some potentially security issues.

Screenshots/videos:

Example with dragdropping between two separate browser windows.

example

Checklist:

@AUTOMATIC1111
Copy link
Owner

If the request is made and fails, there should be some form of feedback, at least output to console (but possibly also gr.Warning for UI). Are there any considerations from security side?

@w-e-w
Copy link
Collaborator

w-e-w commented Mar 16, 2024

update:
drag and drop image works in chrome but not firefox


drag and drop image from other websites or between web UI instances has always worked without this PR
this PR only adds the ability to drag urls (text)

if a user already opens the URL in the browser tab they can just drag the image
so unless the user wishes to drag URL text and not the image this feature does not do much

personally I don't see this being too useful as the user is unlikely to know what a without opening the image
which means they will most likely open a URL in a separate tab, confirm that this is what they then drag it to webui
but at this point I think it's easier for user to just drag the big image across and the small text


security issue
this will have will cause SSRF like

in my opinion if this were to be implemented the web request should be made by the Client using JavaScript and not server on side
reasons

  1. security, no risk of ssrf
  2. using browser is less likely to be blocked likey to get blocked by servers that block bots

@w-e-w
Copy link
Collaborator

w-e-w commented Mar 16, 2024

drag and drop image works in chrome but not firefox

image drag and drop works in chrome / min / edge but not in firefox / librewolf

@catboxanon
Copy link
Collaborator Author

drag and drop image works in chrome but not firefox

This hadn't occurred to me actually. I ran into that over a year ago when making a userscript though. I think this is a case where Firefox follows the browser spec but Chrome doesn't, annoyingly.

in my opinion if this were to be implemented the web request should be made by the Client using JavaScript and not server on side

I agree with this. I admittedly implemented it server-side since it was the path of least resistance in this case.

Thanks for the feedback. I'll close this PR and open a new one when I get a chance to address all this.

@catboxanon catboxanon closed this Mar 16, 2024
@missionfloyd missionfloyd reopened this Mar 16, 2024
@missionfloyd
Copy link
Collaborator

@missionfloyd missionfloyd marked this pull request as draft March 16, 2024 22:01
@catboxanon
Copy link
Collaborator Author

Nice, that's much better. I'll just add some error handling to this now.

@catboxanon catboxanon marked this pull request as ready for review March 17, 2024 00:19
@AUTOMATIC1111 AUTOMATIC1111 merged commit 6d8b7ec into AUTOMATIC1111:dev Mar 17, 2024
2 of 3 checks passed
AUTOMATIC1111 added a commit that referenced this pull request Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants