aerokube / selenoid-ui

Graphical user interface for Selenoid project
https://aerokube.com/selenoid-ui/latest/
Apache License 2.0
305 stars 76 forks source link

Bug in or how to use copy and paste feature #499

Closed benzman81 closed 7 months ago

benzman81 commented 1 year ago

Hi, either I can not figure out how to use the new copy and paste feature or it does not work. My assumption is, that, if I copy some text on my windows machine, then click on pasteToSelenoid in an unlocked session, that I can than paste the text within it. But it does not work. Same I assume the other way around. When I copy some text in an unlocked selenoid session an click on copyFromSelenoid, that I can then paste it on my windows machine. Both does not work. Access to clipboard is allowed for the selenoid-ui server.

Tested in:

Am I doing something wrong?

vania-pooh commented 1 year ago

@carl-pki any thoughts?

kaylezhangzhaoLin commented 1 year ago

Firstly, you are point is right. but it just can work on two modes(The local deploy or The HTTPS protocol) beacuse NAVIGATOR api just can work on tow modes.

kaylezhangzhaoLin commented 1 year ago

this is my nginx.conf

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    keepalive_requests 10000;
    client_max_body_size     50m;
    client_body_buffer_size  10m;
    client_header_timeout    1m;
    client_body_timeout      1m;

    gzip on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_comp_level  4;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;

server {

        listen  443 ssl;
        ## need replace
        server_name  domain name;

        ssl on;
        ## need replace
        ssl_certificate    path to your .pem file;
        ## need replace
        ssl_certificate_key  path to your .key file;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_verify_client off;

       location  / {
                    ## need replace
                    proxy_pass http://your ip:8080;
                    proxy_set_header   Host             $host;
                    proxy_set_header   X-Real-IP        $remote_addr;
                    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
                }

       location ^~ /clipboard {
            ## need replace
            proxy_pass http:// your ip:4444;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }

       location /ws {
                   ## need replace
                   proxy_pass http://your ip:8080;
                   proxy_http_version 1.1;
                   proxy_set_header Upgrade $http_upgrade;
                   proxy_set_header Connection "upgrade";
                   proxy_set_header Host $host;
                   proxy_set_header X-Real-IP $remote_addr;
                   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                   proxy_set_header X-Forwarded-Proto $scheme;

    }

server {
        listen       80;
        ## need replace
        server_name  ## your domain name;
        rewrite ^(.*)$  https://$host$1 permanent;

    }
}
}
benzman81 commented 1 year ago

@carl-pki sorry, I don't get it. I start the docker image like this docker run -d --name selenoid-ui -p 8080:8080 aerokube/selenoid-ui --selenoid-uri http://${SELENOID_HOST}:4444 and expect it to work. What has nginx to do with it?

kaylezhangzhaoLin commented 1 year ago

@benzman81 image you can open your selenoid-ui on chrome and open chrome console input navigator.clipboard.

for example: image

I guess you can get undefined.

kaylezhangzhaoLin commented 1 year ago

@benzman81 If you open any https page and open console and type navigator.clipboard, you can get same as me.

kaylezhangzhaoLin commented 1 year ago

When you use HTTP protocol the navigator.clipboard == false.

https://stackoverflow.com/questions/51805395/navigator-clipboard-is-undefined

kaylezhangzhaoLin commented 1 year ago

the Clipboard request need not to reverse proxy by Nginx, It can reverse proxy by Selenoid-UI. next commit I will improve it.

@vania-pooh https://github.com/aerokube/selenoid-ui/pull/500/files

benzman81 commented 1 year ago

@carl-pki I get an object for the clipboard:

SelenoidClipboard

No clue, why it is not working.

kaylezhangzhaoLin commented 1 year ago

@benzman81 you are right. local deploy has a bug. next PR will resolve the bug.

please wait https://github.com/aerokube/selenoid-ui/pull/500/files

kaylezhangzhaoLin commented 1 year ago

@benzman81 Thank your report.

benzman81 commented 1 year ago

@carl-pki thank you

vania-pooh commented 1 year ago

@benzman81 try first with aerokube/selenoid-ui:latest and then we'll release.

benzman81 commented 1 year ago

@vania-pooh with aerokube/selenoid-ui:latest it works as expected. Happy to see this feature working, good job. Now I just need to wait for a static release version number ;-)

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

benzman81 commented 7 months ago

Works as expected in static releases.