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

[Bug] Copy download link doesn't work #818

Closed
IvanMazzoli opened this issue Apr 18, 2024 · 7 comments
Closed

[Bug] Copy download link doesn't work #818

IvanMazzoli opened this issue Apr 18, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@IvanMazzoli
Copy link

IvanMazzoli commented Apr 18, 2024

RomM version
RomM 3.1.0-rc.3

Describe the bug
When clicking the copy download link button, nothing happens.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any game in your library
  2. Click on the copy button
  3. Try to paste (eg. in a txt file)
  4. Nothing has been copied

Expected behavior
When clicking the copy button, the download link should be copied to the clipboard. Even better, a small toast with "Download link copied to the clipboard" should be displayed to the user.

Screenshots
image

Desktop:

  • OS: Windows 10
  • Browser: Google Chrome
  • Version: 124.0.6367.60 (Official build) (64 bit) (cohort: M124 Rollout)

Additional context
Also tried with Microsoft Edge, can reproduce the issue. Tried with single file ROMs games (eg. NES) and multi file ROMs (eg. PS1) and both produces the same issue.

@IvanMazzoli IvanMazzoli added the bug Something isn't working label Apr 18, 2024
@zurdi15
Copy link
Member

zurdi15 commented Apr 18, 2024

To be honest I only tested it in Firefox. Could you test with firefox and post the results?
About the toast it will appear when you copy the link, but didn't add any if the copy somehow fail! I'll add it for the final 3.1 release

I'll test myself in chrome and edge of course

@IvanMazzoli
Copy link
Author

IvanMazzoli commented Apr 18, 2024

I had to switch PC, now I'm on Windows 11 and with Firefox (fresh installation) I still can't copy the download link. Here's the console error message:
image

EDIT: surfing StackOverflow I might have found what's causing the issue: https://stackoverflow.com/questions/51805395/navigator-clipboard-is-undefined
In fact I'm not using HTTPS and Romm is in a different machine than the one I'm using the browser on. I tried to change the flag in Chrome as suggested in Simon Dehaut's answer but it still doesn't work. Do you think it's possible to try the "hack" he suggested on SO?

@gantoine
Copy link
Member

gantoine commented Apr 18, 2024

lmaooooo i can't believe i didn't see this in the PR 🤦🏼 navigator.clipboard is only available in secure contexts (https pages), and looking at your screenshots you're accessing it via an ip address.

@zurdi15 you used to be able to use document.execCommand as a workaround, but that was deprecated years ago and browsers are finally starting to remove it. i think the best thing is to just hide the button if the context isn't secure (not https web page)

@IvanMazzoli
Copy link
Author

I don't really like the idea of not being able to just share the link if my connection isn't secure... what about a different approach like Google Photos?
image
If a secure context isn't available, just grey out the copy button but allow the user to copy it manually. In this case a better icon for the copy button would be a share one, like share-variant.

@zurdi15
Copy link
Member

zurdi15 commented Apr 19, 2024

lmaooooo i can't believe i didn't see this in the PR 🤦🏼 navigator.clipboard is only available in secure contexts (https pages), and looking at your screenshots you're accessing it via an ip address.

wow how is this possible? how could I use navigator.clipboard then? is it because localhost is taken as secure context?

In any case I like the google photos approach, if that method is not available we show a popup with the link to copy it manually

@gantoine
Copy link
Member

is it because localhost is taken as secure context?

yes something like that!

if that method is not available we show a popup with the link to copy it manually

makes sense to me, assigning this to you and backlogging it

@gantoine
Copy link
Member

This will be available in the next release (3.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants