mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
c66ae7b2e4
Launch an Xspice and run: echo -ne "\033]844;127.0.0.1;9876\007" This will launch a SPiCE client connecting to 127.0.0.1:9876. Still need to add all the security stuff and generally be more defensive in the implementation.
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
wdi.MainProcess = $.spcExtend(wdi.EventObject.prototype, {
|
|
init: function(c) {
|
|
this.superInit();
|
|
this.app = c.app;
|
|
this.spiceConnection = c.app.spiceConnection;
|
|
this.agent = c.app.agent;
|
|
},
|
|
|
|
process: function(spiceMessage) {
|
|
var channel = this.spiceConnection.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN];
|
|
|
|
switch(spiceMessage.messageType) {
|
|
case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:
|
|
channel.connectionId = spiceMessage.args.session_id;
|
|
channel.fire('connectionId', channel.connectionId);
|
|
if(spiceMessage.args.agent_connected == 1) {
|
|
channel.fire('initAgent', spiceMessage.args.agent_tokens);
|
|
}
|
|
if (spiceMessage.args.current_mouse_mode == 1) {
|
|
channel.fire('mouseMode', spiceMessage.args.current_mouse_mode);
|
|
}
|
|
// the mouse mode must be change both if we have agent or not
|
|
this.changeMouseMode();
|
|
break;
|
|
case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:
|
|
var packet = spiceMessage.args;
|
|
this.agent.onAgentData(packet);
|
|
break;
|
|
case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:
|
|
channel.fire('initAgent', spiceMessage.args.agent_tokens);
|
|
this.changeMouseMode();
|
|
break;
|
|
case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:
|
|
this.app.multimediaTime = spiceMessage.args.multimedia_time;
|
|
break;
|
|
case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:
|
|
channel.fire('channelListAvailable', spiceMessage.args.channels);
|
|
break;
|
|
}
|
|
},
|
|
|
|
changeMouseMode: function() {
|
|
var packet = new wdi.SpiceMessage({
|
|
messageType: wdi.SpiceVars.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
|
|
channel: wdi.SpiceVars.SPICE_CHANNEL_MAIN,
|
|
args: new wdi.SpiceMouseModeRequest({
|
|
request_mode: 2
|
|
})
|
|
});
|
|
this.spiceConnection.send(packet);
|
|
}
|
|
});
|