gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
11.52k stars 639 forks source link

Copy to clipboard not working with http #654

Closed ecker00 closed 6 months ago

ecker00 commented 6 months ago

Copy to clipboard does not work on http setup. For those who just use Gotify it on internal network/vpn/http, the browsers navigator.clipboard API is not available, so the copy to clipboard button does not work. I see this feature was added in pull request: https://github.com/gotify/server/pull/561

Solution

This would be solved if the fallback could use the old fashioned way, something like:

const temp = document.createElement('textarea');
temp.value = value;
document.body.appendChild(temp);
temp.select();
document.execCommand('copy');
document.body.removeChild(temp);

Here: https://github.com/gotify/server/blob/a4c19c3a986ca8a2fbdfbb3ea68947a3b73c4196/ui/src/common/CopyableSecret.tsx#L38-L47

jmattheis commented 6 months ago

execCommand is deprecated. While it may work now, It likely breaks in the future. You should use https even if your inside internal network / vpn.