Giter VIP home page Giter VIP logo

padarom / guacamole-common-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glyptodon/guacamole-client

39.0 39.0 18.0 22.66 MB

:avocado: The JavaScript Guacamole client library modified for easy installation and usage via npm

Home Page: http://guac-dev.org/

License: Apache License 2.0

Java 62.23% JavaScript 31.04% CSS 2.89% HTML 1.70% Shell 0.96% Dockerfile 0.04% Python 0.18% TSQL 0.95%
guacamole hacktoberfest

guacamole-common-js's People

Contributors

ceharris avatar darksimpson avatar dg-hasimoto avatar douglasheriot avatar echu2013 avatar elijahnicpon avatar flintriversystems avatar frodeskytap avatar gabibbo97 avatar it-experte avatar jaredfrees avatar jbpaux avatar jmuehlner avatar joelb avatar jolentes avatar leetxyz avatar m-khan-glyptodon avatar mike-jumper avatar mlewissmith avatar myjimmy avatar nacx avatar necouchman avatar netromnetrom avatar nrbrt avatar nw-engineer avatar octopuset avatar padarom avatar petzsch avatar somerandow avatar vict0rc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

guacamole-common-js's Issues

Cannot read properties of undefined (reading 'onend')

guacamole-common-js version

"guacamole-common-js": "^1.3.0",

I connected to guaca using vue3 normally, but got the following error

Uncaught TypeError: Cannot read properties of undefined (reading 'onend')
    at end (guacamole-common.js?a9c6:1324:1)
    at tunnel.oninstruction (guacamole-common.js?a9c6:1633:1)
    at socket.onmessage (guacamole-common.js?a9c6:8587:1)

can not get socket obj in WebSocketTunnel

hello,I want to customize some of my own actions based on the messages the websocket receives. but the socket obj is private in WebSocketTunnel. can you make it public?

Missing opcode "img"

Hi I used before the guacamole npm-package from @ILLGrenoble (https://www.npmjs.com/package/@illgrenoble/guacamole-common-js) and decided to try out yours now to get the newer version of guacamole. But I run into some errors with your version ( and if i should address this problem with the npm here).
However after I compared the both packages I noticed that in your version the "instructionHandlers" which handels new opcodes by a Guacamole protocol client, is missing the "img" case which leads to an error.
If i add this case from @ILLGrenoble versions it workes fine.

` "img": function(parameters) {

        var stream_index = parseInt(parameters[0]);
        var channelMask = parseInt(parameters[1]);
        var layer = getLayer(parseInt(parameters[2]));
        var mimetype = parameters[3];
        var x = parseInt(parameters[4]);
        var y = parseInt(parameters[5]);

        // Create stream

        var stream = streams[stream_index] = new Guacamole.InputStream(guac_client, stream_index);
        var reader = new Guacamole.DataURIReader(stream, mimetype);

        // Draw image when stream is complete
        reader.onend = function drawImageBlob() {
            display.setChannelMask(layer, channelMask);
            display.draw(layer, x, y, reader.getURI());
        };
    },`

Can it be that here is something missing from your packages side or is this "img"-opcode just not available anymore and i should update the client?

How can I send clipboard data?

Hi, how can I send data to the clipboard. In older versions, there was the this.client.setClipboard(text) function for this.

     * Sets the clipboard of the remote client to the given text data.
     *
     * @deprecated Use createClipboardStream() instead.
     * @param {String} data The data to send as the clipboard contents.
     */
    this.setClipboard = function(data) {

        // Do not send requests if not connected
        if (!isConnected())
            return;

        // Open stream
        var stream = guac_client.createClipboardStream("text/plain");
        var writer = new Guacamole.StringWriter(stream);

        // Send text chunks
        for (var i=0; i<data.length; i += 4096)
            writer.sendText(data.substring(i, i+4096));

        // Close stream
        writer.sendEnd();

    };

In the newer version I cannot find something similar. How can I send there data to my connection clipboard?
The function is precated since 0.9.1 and was removed here 57d8154. But I dont know what to use now.

Found this implementation in the guacamole git:

https://github.com/apache/guacamole-client/blob/7c502fdd0e28cd7c9d16bfab5c0edf01c8e47122/guacamole/src/main/frontend/src/app/client/types/ManagedClient.js#L737
Overall the similar stuff, but I can not find this in the npm package.

How to access microphone data?

Hello,

I'm using Guacamole-common.js to create a remote desktop connection with a Windows machine. I've managed to establish the connection, add the keyboard and output audio.

Currently, I'm trying to activate the microphone. But it doesn't work. I try to use AudioWorklet.
I want to make calls using this Windows machine via guacamole. I have audio output but microphone is not detected in my Windows client. My microphone is detected by the browser. But in my windows machine, I still got the error 'No input devices found'.

Has anyone tried to enable microphone access?

I've also tried to use createScriptProcessor which is deprecated. But it's not working.
Any help would be appreciated.

     const tunnel = new Guacamole.WebSocketTunnel(WEB_SOCKET_TUNNEL);
     const client = new Guacamole.Client(tunnel);  

     var audioStream = client.createAudioStream("audio/L16");
     var writer = new Guacamole.ArrayBufferWriter(audioStream);

      // Attempt to retrieve an audio input stream from the browser
      navigator.mediaDevices.getUserMedia({ audio: true })
            .then(async function (stream) {

                const context = new AudioContext();
                const source = context.createMediaStreamSource(stream);

                // Load and execute the module script.
                await context.audioWorklet.addModule('worklet/processor.js');

                const processor = new AudioWorkletNode(context, "processor");

                source.connect(processor).connect(context.destination);
             
                console.log("Microphone access allowed");

              //How to send audio input ?

            })
            .catch(function (error) {
                console.log(error, 'error');
                console.log("Microphone access denied");
                writer.sendEnd();
            });





    // processor.js
    // This file is evaluated in the audio rendering thread
    // upon context.audioWorklet.addModule() call.
    
    class Processor extends AudioWorkletProcessor {
      process([input], [output]) {
        // Copy inputs to outputs.
        output[0].set(input[0]);
    
        return true;
      }
    }
    
    registerProcessor("processor", Processor);

Thanks for your support

Mozilla firefox incorrectly calculates remote mouse position

When launching guacamole-common-js in mozilla firefox, the mouse pointer only reaches the middle of the page.
Tried to inspect the behavior and found that the clientY parameter is calculated differently in css transform property. The range of translate function is defined from 657px to 1657px, whereas it should be defined from 0px to 1000px (offset depends on screen resolution). In Chrome browser remote mouse works as expected.
On the picture you can see the max clientY that is being reached by guacamole mouse pointer.
I'll be glad to recieve any help.

remote-mouse-firefox

The Guacamole.Keyboard only use Guacamole.Keyboard(document),but use in Guacamole.Keyboard(selfElement).

Guacamole.Keyboard(document) will cover global window ,event of window can't use it.
Event of Guacamole.Keyboard(selfElement) is invalid ,keyup and keydown can't trigger.
Keybord.reset() is also invalid.

var keyboard = new Guacamole.Keyboard(document); // events can use ,but cover global window object.
var keyboard = new Guacamole.Keyboard(document.getElementById('terminal')); // events can't use.

Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive

Non-passive event listeners are throwing warnings in Chrome Version 86.0.4240.111 (Official Build) (64-bit)

zone.js:1832 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
15:32:38.170 zone.js:1832 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
15:32:38.170 zone.js:1832 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
15:32:38.171 zone.js:1832 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

As I see from the related documentation the solution would be a simple syntax change on the event listeners.
Is there any particular reason (eg. browser support) why it had not been done?

Parameter "GUAC_ID" is required.

Hi! I keep receiving this error from my docker guacamole logs.
ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket tunnel to guacd failed: Parameter "GUAC_ID" is required.
After doing some research I came up to the conclusion I'm doing something wrong on the client. Any suggestion?
Thank you so much!

  function initializeGuacamoleClient() {

    var tunnel = new Guacamole.WebSocketTunnel(
      "ws://[virtualmachineaddress]:8080/guacamole/websocket-tunnel"
    );

    guacClient = new Guacamole.Client(tunnel);

 
    if (displayContainer) {
      displayContainer.appendChild(guacClient.getDisplay().getElement());
      displayContainer.style.display = "block";
      guacClient.connect("username=guacadmin&password=guacadmin");
    }
  }

The onaudio event cannot fire

I had no sound when connecting to Winodws10 using WebSocker, even though the log print was in Accepted format: 16-bit PCM with 2 channels at 44100 Hz.
Any help would be most appreciated.

Definition type generate an error in strict mode

Hi Christopher,
i'm building an app with your package, and i need to use React.StrictMode, when i create the tunnel this happen:

ERROR in src/components/MyTerminal.tsx:14:80
TS2345: Argument of type '{ 'X-PAM-Compute-UUID': any; }' is not assignable to parameter of type 'boolean | undefined'.
    12 |         console.log(props)
    13 |         var guac = new Guacamole.Client(
  > 14 |             new Guacamole.HTTPTunnel('https://myserver/tunnel', false, {'X-PAM-Compute-UUID': props.terminalId })
       |                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    15 |             
    16 |         );
    17 |

That's strange because in nostrict mode it works fine, so i went to the class definition and i found that in HTTPTunnels.d.ts the constructor is defined as:
constructor(tunnelURL: string, crossDomain?: boolean, extraTunnelHeaders?: boolean);
instead of (for example):
constructor(tunnelURL: string, crossDomain?: boolean, extraTunnelHeaders?: any);

Pls, could you solve?
Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.