n4bb12 / verdaccio-github-oauth-ui

📦🔐 GitHub OAuth plugin for Verdaccio
https://verdaccio.org
MIT License
73 stars 45 forks source link

Can't copy clipped long string to clipboard #145

Closed ranqn closed 2 years ago

ranqn commented 2 years ago

Bug Report

Versions

Version
node.js
verdaccio 5.4.0
verdaccio-github-oauth-ui (Plugin) 3.2.0
verdaccio-github-oauth-ui (CLI)

Expected behavior

Click Copy to clipboard button should always copy the text.

Observed behaviour

Copy failed with error when copy long text (end with ...)

Steps to reproduce

  1. Open Registry Info window
  2. Find a long string (clipped by the window) to copy
  3. Click Copy to clipboard button
  4. The string is not copied to clipboard

Additional context

image

Browser error after click, filename: /-/static/github-oauth-ui/verdaccio-5.js

image
n4bb12 commented 2 years ago

Hi @Ran-QUAN, which browser and version are you using?

ranqn commented 2 years ago

@n4bb12 Microsoft Edge 97.0.1072.76 on Windows 11 Currently I switched back to version 3.0.0, and the copy function works without any problem.

n4bb12 commented 2 years ago

Thank you.

That's strange because it's a native browser feature and your browser supports it. https://caniuse.com/mdn-api_clipboard_writetext

Actually, I'm using the same browser, and it works for me 😪

Is it possible the feature is disabled by default or disabled for the page? edge://settings/content/clipboard?search=clipboard edge://settings/content/all?search=clipboard

ranqn commented 2 years ago

@n4bb12 It seems like clipboard API is only available for HTTPS sites, and we're hosting verdaccio on an internal server via HTTP. https://stackoverflow.com/a/51823007/3556176

n4bb12 commented 2 years ago

In that case I would rather keep the built-in clipboard implementation. This plugin exchanges secrets and therefore should not be communicating over HTTP. If it works, great, but it's not something I want to officially support.