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

feature: replicate default webui copy name / hash context menu functions #277

Closed
beyondmeat opened this issue Aug 9, 2021 · 19 comments
Closed

Comments

@beyondmeat
Copy link

I select torrents and use the context menu to copy the torrent names with the default webui, can't do it with vuetorrent.

Also can't select to copy any text in the info panel.

WDaan added a commit that referenced this issue Aug 14, 2021
@WDaan WDaan closed this as completed Aug 14, 2021
@BachoSeven
Copy link

@WDaan, I just tested this on the new version, and it doesn't work(i.e. clicking on copy and then any of the three options didn't copy anything onto my clipboard).

System: Arch Linux, qbittorrent-vuetorrent-bin(AUR package), latest qbittorent-nox version.

@WDaan WDaan reopened this Aug 16, 2021
@WDaan
Copy link
Collaborator

WDaan commented Aug 16, 2021

Which browser are you using? I only tested on chrome because I thought it was standardised functionality

@BachoSeven
Copy link

ungoogled-chromium, version 92.0.4515.131

@BachoSeven
Copy link

I also tried it on Vieb(an Electron-based browser), and I get the same behaviour.

@beyondmeat beyondmeat changed the title feature: recliplate default webui copy name / hash context menu functions feature: replicate default webui copy name / hash context menu functions Aug 24, 2021
@WDaan
Copy link
Collaborator

WDaan commented Aug 24, 2021

Tested on Chrome, Safari and Firefox & didn't notice any issues.

@BachoSeven
Copy link

BachoSeven commented Aug 24, 2021

I also tested it on Firefox, and it doesn't work. Opening the Firefox console, I noticed this:

TypeError: navigator.clipboard is undefined
    copyToClipBoard TorrentRightClickMenu.vue:407
    click TorrentRightClickMenu.vue:11
    VueJS 4
        ie
        n
        ie
        $emit
    click VListItem.ts:126
    VueJS 3
        ie
        n
        _wrapper
vue.runtime.esm.js:1897:12

And then I thought of also looking at Chromium's console:

vue.runtime.esm.js:1897 TypeError: Cannot read property 'writeText' of undefined
    at o.copyToClipBoard (TorrentRightClickMenu.vue:407)
    at click (TorrentRightClickMenu.vue?18e3:11)
    at ie (vue.runtime.esm.js:1863)
    at o.n (vue.runtime.esm.js:2188)
    at ie (vue.runtime.esm.js:1863)
    at o.In.t.$emit (vue.runtime.esm.js:3903)
    at o.click (VListItem.ts:126)
    at ie (vue.runtime.esm.js:1863)
    at HTMLDivElement.n (vue.runtime.esm.js:2188)
    at HTMLDivElement.Qr.a._wrapper (vue.runtime.esm.js:6961)

@WDaan
Copy link
Collaborator

WDaan commented Aug 24, 2021

Thank you for this! It means for some reason the clipboard API is not supported for both your browsers 😮😮

The compatibility list is shown here, it should be globaly supported 🤔🤔

@BachoSeven
Copy link

BachoSeven commented Aug 24, 2021

But I installed and tested on stock Firefox(!)

@WDaan
Copy link
Collaborator

WDaan commented Aug 24, 2021

I believe you 😅 you don't have to convince me.
I'm just trying to figure out why it does not work for you

@BachoSeven
Copy link

Sorry I thought by both browsers you meant the chromium-based ones I mentioned earlier.

Maybe this is relevant, since I don't use https on the server and the linked issue mentions that:

https://github.com/storybookjs/storybook/pull/13777/files

@WDaan
Copy link
Collaborator

WDaan commented Aug 24, 2021

Well after some further reading here and here. It might be due to a permission issue (AND Firefox doesn't seem to fully support those permissions according to their website). I will have to investigate on what to use as a fallback

@beyondmeat
Copy link
Author

beyondmeat commented Sep 2, 2021

I tried the latest release and it works for me. However it only works for a single torrent selected. The qbit webui allows multiple torrents to be selected and you can still copy the name, hash, and url. Select multiple torrents and copy the name, it will put each name on a single line, so when you paste you have a list of torrent names.

Please make this work with multiple torrents are selected. Right now the copy menu isn't an option when multiple torrents are selected.

Thank you for the quick turn around and quick implementation!

@WDaan
Copy link
Collaborator

WDaan commented Sep 3, 2021

Just out of curiosity... When do you actually need to copy the name/hash/magnet of multiple torrents? What is the use case?

@beyondmeat
Copy link
Author

beyondmeat commented Sep 3, 2021

I have a script that copies my torrents and renames them.

I paste the names of the torrents (which matches the download location). The script knows where the torrents are, adds the torrent name to the path, copies the downloaded torrent files and processes them. I need the names because I need to control what torrents to process. Also the torrent client is not accessible (and I don't want it to be) to the processing server. So it's useful for me when using 2 machines to do different tasks.

It's a slightly manual process but it works. I also used that in cases where I want to compare the list of torrents in my client to another list.

Sure, I could find a way to automate it by working with the client API or something but the manual process of copying the names hasn't bothered me that much yet.

As for magnets, I could see the use case for quickly copying torrents from one client to another.

@WDaan
Copy link
Collaborator

WDaan commented Sep 3, 2021

Thanks for the explanation!

@beyondmeat
Copy link
Author

beyondmeat commented Oct 18, 2021

@WDaan unfortunately, the latest versions of Edge, it no longer copies to the clipboard.

I recommend looking at the copy button that github now has. (Could be a feature preview, so check that if you don't see it below). Hover over my code block below to see it. This type of button would be very nice for the Show Info panel details as well.

copy test passed

You should be able to view the source and dig in to find the JS code they are using to copy to the clipboard and use that in VueTorrent.

@beyondmeat
Copy link
Author

OK, looks like they are using this NPM package: https://www.npmjs.com/package/clipboard-copy

@lieuweberg
Copy link

This is a permissions issue. The Clipboard API is only available in secure contexts, meaning pages served over HTTPS, localhost or 127.0.0.1.

If you want to bypass this for a chromium browser you can head to chrome://flags/#unsafely-treat-insecure-origin-as-secure and add your domain/ip to the list in the supported format (i.e. http://192.168.178.60:8989), then enable the feature.

Better would of course be to reverse proxy your site with something like ✨ caddy ✨ or nginx.

@WDaan
Copy link
Collaborator

WDaan commented Feb 12, 2022

Thanks for the analysis!

My proxy of choice is NginxManager 🙃

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

No branches or pull requests

4 participants