productiveops / dokemon

Docker Container Management GUI
https://dokemon.dev
MIT License
689 stars 25 forks source link

Copy Not Working When Trying to Register New Server #1

Closed dnburgess closed 11 months ago

dnburgess commented 11 months ago

Updated to the current version as of this morning.

Tried to register a new server for remote management.

When I click the "Copy" button to get the code to run on the new server, nothing happens.

I opened my browser console in Chrome Version 120.0.6099.71 to see what's going on in the background and am getting the following:

Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')
    at a (index-FZazDRvX.js:142:24931)
    at onClick (index-FZazDRvX.js:148:894)
    at Object.x2 (index-FZazDRvX.js:37:9864)
    at E2 (index-FZazDRvX.js:37:10018)
    at k2 (index-FZazDRvX.js:37:10075)
    at rg (index-FZazDRvX.js:37:31462)
    at R1 (index-FZazDRvX.js:37:31879)
    at index-FZazDRvX.js:37:36792
    at mm (index-FZazDRvX.js:40:36957)
    at Y_ (index-FZazDRvX.js:37:8999)
a @ index-FZazDRvX.js:142
onClick @ index-FZazDRvX.js:148
x2 @ index-FZazDRvX.js:37
E2 @ index-FZazDRvX.js:37
k2 @ index-FZazDRvX.js:37
rg @ index-FZazDRvX.js:37
R1 @ index-FZazDRvX.js:37
(anonymous) @ index-FZazDRvX.js:37
mm @ index-FZazDRvX.js:40
Y_ @ index-FZazDRvX.js:37
Yd @ index-FZazDRvX.js:37
zp @ index-FZazDRvX.js:37
H2 @ index-FZazDRvX.js:37

Looking through the container logs, I just see this:

2023-12-12T18:00:07Z Setting log level 
2023-12-12T18:00:07Z INF Starting Dokemon 
⇨ http server started on [::]:9090

I also tried this in Firefox Version 119.0.1 and am getting the same result with this in the console:

Uncaught TypeError: navigator.clipboard is undefined
    a http://192.168.0.27:9090/assets/index-FZazDRvX.js:142
    onClick http://192.168.0.27:9090/assets/index-FZazDRvX.js:148
    x2 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    E2 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    k2 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    rg http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    R1 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    Yd http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    mm http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    Y_ http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    Yd http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    zp http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    H2 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    T1 http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    Xd http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    Na http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    Na http://192.168.0.27:9090/assets/index-FZazDRvX.js:37
    GC http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    ky http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    Ey http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    rE http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    hu http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    Lg http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    Zs http://192.168.0.27:9090/assets/index-FZazDRvX.js:38
    sE http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    Js http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    by http://192.168.0.27:9090/assets/index-FZazDRvX.js:40
    x http://192.168.0.27:9090/assets/index-FZazDRvX.js:25
    $ http://192.168.0.27:9090/assets/index-FZazDRvX.js:25
    EventHandlerNonNull* http://192.168.0.27:9090/assets/index-FZazDRvX.js:25
    <anonymous> http://192.168.0.27:9090/assets/index-FZazDRvX.js:25
salilponde commented 11 months ago

Looks like its this: https://stackoverflow.com/a/51823007/22850013

I use localhost when testing locally and on my VMs I have DNS/https setup. So that might be the reason I did not encounter this issue while testing. Let me check with IP address and http and come up with a solution.

salilponde commented 11 months ago

Fixed in 1.1.1

Fix: I see the browsers do not allow copying when running over HTTP (navigation.clipboard object is not available)

So I have done the following fix:

  1. If navigation.clipboard object is not available, display the token value in the script. User has to select the script and copy it manually. There will be no Copy button.
  2. If the object is available, the token will show as HIDDEN in the script and the Copy button will be displayed to copy the script.

In future versions I will add a feature to run Dokemon with self-signed certificates for those who do not have an SSL enabled reverse proxy in front of it.