padarom / guacamole-common-js

:avocado: The JavaScript Guacamole client library modified for easy installation and usage via npm
http://guac-dev.org/
Apache License 2.0
41 stars 18 forks source link

Missing opcode "img" #20

Closed cedricbieder closed 1 year ago

cedricbieder commented 2 years ago

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?

padarom commented 2 years ago

The img handler is still present in the current code: https://github.com/padarom/guacamole-common-js/blob/6c456d68cb24bc5867c4a6512ea45564c1764da2/guacamole-common-js/src/main/webapp/modules/Client.js#L1312-L1328

@illgrenoble/guacamole-common-js only imported the upstream guacamole-common-js library once 5 years ago and then never again. Their code might match https://github.com/glyptodon/guacamole-client/tree/18136d5146ee98374df60a3b8dfbb1c411d5dd6b which was committed a couple days prior to theirs. At that point Guacamole was at version 0.9.14, now it is at version 1.4.0. It is very likely that some breaking changes were introduced when upstream bumped their major version to 1, so it could just be that the remaining code is somewhat incompatible as well.