bfg-common 1.5.506 → 1.5.508

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/assets/localization/local_be.json +12 -2
  2. package/assets/localization/local_en.json +12 -2
  3. package/assets/localization/local_hy.json +12 -2
  4. package/assets/localization/local_kk.json +12 -2
  5. package/assets/localization/local_ru.json +12 -2
  6. package/assets/localization/local_zh.json +12 -2
  7. package/components/common/pages/backups/Backups.vue +54 -61
  8. package/components/common/pages/backups/BackupsOld.vue +80 -0
  9. package/components/common/pages/backups/backupsNew/BackupsNew.vue +356 -0
  10. package/components/common/pages/backups/backupsNew/contextMenuView/ContextMenuView.vue +101 -0
  11. package/components/common/pages/backups/backupsNew/contextMenuView/lib/config/contextMenuItems.ts +29 -0
  12. package/components/common/pages/backups/backupsNew/lib/models/interfaces.ts +12 -0
  13. package/components/common/pages/backups/backupsNew/lib/utils/contextMenu.ts +29 -0
  14. package/components/common/pages/backups/backupsNew/lib/utils/details.ts +30 -0
  15. package/components/common/pages/backups/modals/deleteBackup/DeleteBackup.vue +17 -4
  16. package/components/common/pages/backups/tools/Tools.vue +75 -75
  17. package/components/common/pages/backups/tools/lib/config/tabs.ts +37 -36
  18. package/components/common/spiceConsole/Drawer.vue +29 -2
  19. package/components/common/spiceConsole/lib/models/types.ts +1 -0
  20. package/package.json +1 -1
  21. package/plugins/console.ts +21 -22
  22. package/plugins/mouse.ts +21 -0
  23. package/public/spice-console/process/inputprocess.js +227 -203
  24. package/public/spice-console/process/mainprocess.js +82 -78
  25. package/public/spice-console-minify/run.min.js +1 -1
@@ -1,203 +1,227 @@
1
- /*
2
- Copyright (c) 2016 eyeOS
3
-
4
- This file is part of Open365.
5
-
6
- Open365 is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU Affero General Public License as
8
- published by the Free Software Foundation, either version 3 of the
9
- License, or (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU Affero General Public License for more details.
15
-
16
- You should have received a copy of the GNU Affero General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
-
20
- wdi.InputProcess = $.spcExtend(wdi.EventObject.prototype, {
21
- clientGui: null,
22
- spiceConnection: null,
23
- capsLockPressed: false,
24
- numLockPressed: false,
25
- shiftPressed: false,
26
-
27
- init: function (c) {
28
- this.superInit()
29
- this.clientGui = c.clientGui
30
- this.spiceConnection = c.spiceConnection
31
- },
32
-
33
- dispose: function () {
34
- this.clearEvents()
35
- this.clientGui = null
36
- this.spiceConnection = null
37
- },
38
-
39
- process: function (spiceMessage) {
40
- switch (spiceMessage.messageType) {
41
- case wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:
42
- this.clientGui.motion_ack()
43
- break
44
- }
45
- },
46
-
47
- send: function (data, type) {
48
- var packet, scanCodes, i
49
-
50
- if (type == 'mousemove') {
51
- packet = new wdi.SpiceMessage({
52
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_POSITION,
53
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
54
- args: new wdi.RedcMousePosition({
55
- x: data[1][0] + wdi.VirtualMouse.hotspot.x,
56
- y: data[1][1] + wdi.VirtualMouse.hotspot.y,
57
- buttons_state: data[1][2],
58
- display_id: 0,
59
- }),
60
- })
61
- this.spiceConnection.send(packet)
62
- } else if (type == 'mousedown') {
63
- packet = new wdi.SpiceMessage({
64
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_PRESS,
65
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
66
- args: new wdi.RedcMousePress({
67
- button_id: data[1] + 1,
68
- buttons_state: 1 << data[1],
69
- }),
70
- })
71
- this.spiceConnection.send(packet)
72
- } else if (type == 'mouseup') {
73
- packet = new wdi.SpiceMessage({
74
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_RELEASE,
75
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
76
- args: new wdi.RedcMousePress({
77
- button_id: data[1] + 1,
78
- buttons_state: 0,
79
- }),
80
- })
81
- this.spiceConnection.send(packet)
82
- } else if (type == 'keydown' || type == 'keypress') {
83
- scanCodes = wdi.Keymap.getScanCodes(data[1][0])
84
-
85
- const originalEvent = data[1][0].originalEvent
86
-
87
- if (
88
- type == 'keydown' &&
89
- data[1][0].keyCode !== 20 &&
90
- ((!wdi.Keymap.isVirtualKeyboard &&
91
- originalEvent &&
92
- originalEvent.getModifierState &&
93
- wdi.Keymap.capsLock !== originalEvent.getModifierState('CapsLock')) ||
94
- (wdi.Keymap.isVirtualKeyboard &&
95
- wdi.Keymap.isVirtualCapsLockOn !== wdi.Keymap.capsLock))
96
- ) {
97
- const capsLockPacket = new wdi.SpiceMessage({
98
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
99
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
100
- args: new wdi.SpiceScanCode([58, 0, 0]),
101
- })
102
- this.capsLockPressed = true
103
- this.spiceConnection.send(capsLockPacket)
104
- }
105
-
106
- if (
107
- type == 'keydown' &&
108
- originalEvent &&
109
- originalEvent.getModifierState &&
110
- data[1][0].keyCode !== 144 &&
111
- wdi.Keymap.numLock !== originalEvent.getModifierState('NumLock')
112
- ) {
113
- const numLockPacket = new wdi.SpiceMessage({
114
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
115
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
116
- args: new wdi.SpiceScanCode([69, 0, 0]),
117
- })
118
- this.numLockPressed = true
119
- this.spiceConnection.send(numLockPacket)
120
- }
121
-
122
- for (i = 0; i < scanCodes.length; i++) {
123
- packet = new wdi.SpiceMessage({
124
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
125
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
126
- args: new wdi.SpiceScanCode(scanCodes[i]),
127
- })
128
-
129
- if (scanCodes[0] && scanCodes[0][0] === 42) {
130
- this.shiftPressed = true
131
- }
132
- this.spiceConnection.send(packet)
133
- }
134
- } else if (type == 'keyup') {
135
- scanCodes = wdi.Keymap.getScanCodes(data[1][0])
136
-
137
- if (
138
- scanCodes &&
139
- scanCodes[0] &&
140
- scanCodes[0][0] === 199 &&
141
- scanCodes[0][1] === 0 &&
142
- scanCodes[0][2] === 0
143
- ) {
144
- scanCodes = [[224, 199, 0, 0]]
145
- }
146
-
147
- if (this.capsLockPressed) {
148
- const capsLockPacket = new wdi.SpiceMessage({
149
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
150
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
151
- args: new wdi.SpiceScanCode([186, 0, 0]),
152
- })
153
- this.spiceConnection.send(capsLockPacket)
154
- this.capsLockPressed = false
155
- }
156
-
157
- if (this.numLockPressed) {
158
- const numLockPacket = new wdi.SpiceMessage({
159
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
160
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
161
- args: new wdi.SpiceScanCode([197, 0, 0]),
162
- })
163
- this.spiceConnection.send(numLockPacket)
164
- this.numLockPressed = false
165
- }
166
-
167
- if (scanCodes[0] && scanCodes[0][0] === 142) {
168
- this.shiftPressed = false
169
- }
170
-
171
- for (i = 0; i < scanCodes.length; i++) {
172
- packet = new wdi.SpiceMessage({
173
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
174
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
175
- args: new wdi.SpiceScanCode(scanCodes[i]),
176
- })
177
-
178
- this.spiceConnection.send(packet)
179
- }
180
- this.clientGui.inputManager.input.val('_')
181
- } else if (type == 'joystick') {
182
- packet = new wdi.SpiceMessage({
183
- messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_MOTION,
184
- channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
185
- args: new wdi.RedcMouseMotion({
186
- x: data[1][0],
187
- y: data[1][1],
188
- buttons_state: 0,
189
- }),
190
- })
191
- this.spiceConnection.send(packet)
192
- }
193
- },
194
-
195
- isKeyboardShortcut: function (type, event) {
196
- if (type === 'keydown') {
197
- var keycode = event['keyCode']
198
- wdi.Keymap.controlPressed(keycode, type, event)
199
- var ctrlShortcut = wdi.Keymap.handledByCtrlKeyCode(type, keycode, true)
200
- return ctrlShortcut
201
- }
202
- },
203
- })
1
+ /*
2
+ Copyright (c) 2016 eyeOS
3
+
4
+ This file is part of Open365.
5
+
6
+ Open365 is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as
8
+ published by the Free Software Foundation, either version 3 of the
9
+ License, or (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ wdi.InputProcess = $.spcExtend(wdi.EventObject.prototype, {
21
+ clientGui: null,
22
+ spiceConnection: null,
23
+ capsLockPressed: false,
24
+ numLockPressed: false,
25
+ shiftPressed: false,
26
+ mouseLastX: -1,
27
+ mouseLastY: -1,
28
+
29
+ init: function (c) {
30
+ this.superInit()
31
+ this.clientGui = c.clientGui
32
+ this.spiceConnection = c.spiceConnection
33
+ },
34
+
35
+ dispose: function () {
36
+ this.clearEvents()
37
+ this.clientGui = null
38
+ this.spiceConnection = null
39
+ },
40
+
41
+ process: function (spiceMessage) {
42
+ switch (spiceMessage.messageType) {
43
+ case wdi.SpiceVars.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:
44
+ this.clientGui.motion_ack()
45
+ break
46
+ }
47
+ },
48
+
49
+ send: function (data, type) {
50
+ var packet, scanCodes, i
51
+
52
+ const { $mouse } = useNuxtApp()
53
+ if (type == 'mousemove') {
54
+ if (
55
+ $mouse.mode.value === wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT
56
+ ) {
57
+ packet = new wdi.SpiceMessage({
58
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_POSITION,
59
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
60
+ args: new wdi.RedcMousePosition({
61
+ x: data[1][0] + wdi.VirtualMouse.hotspot.x,
62
+ y: data[1][1] + wdi.VirtualMouse.hotspot.y,
63
+ buttons_state: data[1][2],
64
+ display_id: 0,
65
+ }),
66
+ })
67
+ } else if (
68
+ $mouse.mode.value === wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_SERVER
69
+ ) {
70
+ const dx = this.mouseLastX !== -1 ? data[1][0] - this.mouseLastX : 0
71
+ const dy = this.mouseLastY !== -1 ? data[1][1] - this.mouseLastY : 0
72
+ packet = new wdi.SpiceMessage({
73
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_MOTION,
74
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
75
+ args: new wdi.RedcMouseMotion({
76
+ x: dx,
77
+ y: dy,
78
+ buttons_state: 0,
79
+ }),
80
+ })
81
+ this.mouseLastX = data[1][0]
82
+ this.mouseLastY = data[1][1]
83
+ }
84
+
85
+ this.spiceConnection.send(packet)
86
+ } else if (type == 'mousedown') {
87
+ packet = new wdi.SpiceMessage({
88
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_PRESS,
89
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
90
+ args: new wdi.RedcMousePress({
91
+ button_id: data[1] + 1,
92
+ buttons_state: 1 << data[1],
93
+ }),
94
+ })
95
+ this.spiceConnection.send(packet)
96
+ } else if (type == 'mouseup') {
97
+ packet = new wdi.SpiceMessage({
98
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_RELEASE,
99
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
100
+ args: new wdi.RedcMousePress({
101
+ button_id: data[1] + 1,
102
+ buttons_state: 0,
103
+ }),
104
+ })
105
+ this.spiceConnection.send(packet)
106
+ } else if (type == 'keydown' || type == 'keypress') {
107
+ scanCodes = wdi.Keymap.getScanCodes(data[1][0])
108
+
109
+ const originalEvent = data[1][0].originalEvent
110
+
111
+ if (
112
+ type == 'keydown' &&
113
+ data[1][0].keyCode !== 20 &&
114
+ ((!wdi.Keymap.isVirtualKeyboard &&
115
+ originalEvent &&
116
+ originalEvent.getModifierState &&
117
+ wdi.Keymap.capsLock !== originalEvent.getModifierState('CapsLock')) ||
118
+ (wdi.Keymap.isVirtualKeyboard &&
119
+ wdi.Keymap.isVirtualCapsLockOn !== wdi.Keymap.capsLock))
120
+ ) {
121
+ const capsLockPacket = new wdi.SpiceMessage({
122
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
123
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
124
+ args: new wdi.SpiceScanCode([58, 0, 0]),
125
+ })
126
+ this.capsLockPressed = true
127
+ this.spiceConnection.send(capsLockPacket)
128
+ }
129
+
130
+ if (
131
+ type == 'keydown' &&
132
+ originalEvent &&
133
+ originalEvent.getModifierState &&
134
+ data[1][0].keyCode !== 144 &&
135
+ wdi.Keymap.numLock !== originalEvent.getModifierState('NumLock')
136
+ ) {
137
+ const numLockPacket = new wdi.SpiceMessage({
138
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
139
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
140
+ args: new wdi.SpiceScanCode([69, 0, 0]),
141
+ })
142
+ this.numLockPressed = true
143
+ this.spiceConnection.send(numLockPacket)
144
+ }
145
+
146
+ for (i = 0; i < scanCodes.length; i++) {
147
+ packet = new wdi.SpiceMessage({
148
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_DOWN,
149
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
150
+ args: new wdi.SpiceScanCode(scanCodes[i]),
151
+ })
152
+
153
+ if (scanCodes[0] && scanCodes[0][0] === 42) {
154
+ this.shiftPressed = true
155
+ }
156
+ this.spiceConnection.send(packet)
157
+ }
158
+ } else if (type == 'keyup') {
159
+ scanCodes = wdi.Keymap.getScanCodes(data[1][0])
160
+
161
+ if (
162
+ scanCodes &&
163
+ scanCodes[0] &&
164
+ scanCodes[0][0] === 199 &&
165
+ scanCodes[0][1] === 0 &&
166
+ scanCodes[0][2] === 0
167
+ ) {
168
+ scanCodes = [[224, 199, 0, 0]]
169
+ }
170
+
171
+ if (this.capsLockPressed) {
172
+ const capsLockPacket = new wdi.SpiceMessage({
173
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
174
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
175
+ args: new wdi.SpiceScanCode([186, 0, 0]),
176
+ })
177
+ this.spiceConnection.send(capsLockPacket)
178
+ this.capsLockPressed = false
179
+ }
180
+
181
+ if (this.numLockPressed) {
182
+ const numLockPacket = new wdi.SpiceMessage({
183
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
184
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
185
+ args: new wdi.SpiceScanCode([197, 0, 0]),
186
+ })
187
+ this.spiceConnection.send(numLockPacket)
188
+ this.numLockPressed = false
189
+ }
190
+
191
+ if (scanCodes[0] && scanCodes[0][0] === 142) {
192
+ this.shiftPressed = false
193
+ }
194
+
195
+ for (i = 0; i < scanCodes.length; i++) {
196
+ packet = new wdi.SpiceMessage({
197
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_KEY_UP,
198
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
199
+ args: new wdi.SpiceScanCode(scanCodes[i]),
200
+ })
201
+
202
+ this.spiceConnection.send(packet)
203
+ }
204
+ this.clientGui.inputManager.input.val('_')
205
+ } else if (type == 'joystick') {
206
+ packet = new wdi.SpiceMessage({
207
+ messageType: wdi.SpiceVars.SPICE_MSGC_INPUTS_MOUSE_MOTION,
208
+ channel: wdi.SpiceVars.SPICE_CHANNEL_INPUTS,
209
+ args: new wdi.RedcMouseMotion({
210
+ x: data[1][0],
211
+ y: data[1][1],
212
+ buttons_state: 0,
213
+ }),
214
+ })
215
+ this.spiceConnection.send(packet)
216
+ }
217
+ },
218
+
219
+ isKeyboardShortcut: function (type, event) {
220
+ if (type === 'keydown') {
221
+ var keycode = event['keyCode']
222
+ wdi.Keymap.controlPressed(keycode, type, event)
223
+ var ctrlShortcut = wdi.Keymap.handledByCtrlKeyCode(type, keycode, true)
224
+ return ctrlShortcut
225
+ }
226
+ },
227
+ })
@@ -1,78 +1,82 @@
1
- /*
2
- Copyright (c) 2016 eyeOS
3
-
4
- This file is part of Open365.
5
-
6
- Open365 is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU Affero General Public License as
8
- published by the Free Software Foundation, either version 3 of the
9
- License, or (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU Affero General Public License for more details.
15
-
16
- You should have received a copy of the GNU Affero General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
-
20
- wdi.MainProcess = $.spcExtend(wdi.EventObject.prototype, {
21
- init: function(c) {
22
- this.superInit();
23
- this.app = c.app;
24
- this.spiceConnection = c.app.spiceConnection;
25
- this.agent = c.app.agent;
26
- },
27
-
28
- dispose: function() {
29
- this.clearEvents();
30
- this.app = null;
31
- this.spiceConnection = null;
32
- this.agent = null;
33
- },
34
-
35
- process: function(spiceMessage) {
36
- var channel = this.spiceConnection.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN];
37
-
38
- switch(spiceMessage.messageType) {
39
- case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:
40
- channel.connectionId = spiceMessage.args.session_id;
41
- channel.fire('connectionId', channel.connectionId);
42
- if(spiceMessage.args.agent_connected == 1) {
43
- channel.fire('initAgent', spiceMessage.args.agent_tokens);
44
- }
45
- if (spiceMessage.args.current_mouse_mode == 1) {
46
- channel.fire('mouseMode', spiceMessage.args.current_mouse_mode);
47
- }
48
- // the mouse mode must be change both if we have agent or not
49
- this.changeMouseMode();
50
- break;
51
- case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:
52
- var packet = spiceMessage.args;
53
- this.agent.onAgentData(packet);
54
- break;
55
- case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:
56
- channel.fire('initAgent', spiceMessage.args.agent_tokens);
57
- this.changeMouseMode();
58
- break;
59
- case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:
60
- this.app.multimediaTime = spiceMessage.args.multimedia_time;
61
- break;
62
- case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:
63
- channel.fire('channelListAvailable', spiceMessage.args.channels);
64
- break;
65
- }
66
- },
67
-
68
- changeMouseMode: function() {
69
- var packet = new wdi.SpiceMessage({
70
- messageType: wdi.SpiceVars.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
71
- channel: wdi.SpiceVars.SPICE_CHANNEL_MAIN,
72
- args: new wdi.SpiceMouseModeRequest({
73
- request_mode: wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT
74
- })
75
- });
76
- this.spiceConnection.send(packet);
77
- }
78
- });
1
+ /*
2
+ Copyright (c) 2016 eyeOS
3
+
4
+ This file is part of Open365.
5
+
6
+ Open365 is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as
8
+ published by the Free Software Foundation, either version 3 of the
9
+ License, or (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ wdi.MainProcess = $.spcExtend(wdi.EventObject.prototype, {
21
+ init: function(c) {
22
+ this.superInit();
23
+ this.app = c.app;
24
+ this.spiceConnection = c.app.spiceConnection;
25
+ this.agent = c.app.agent;
26
+ this.currentMouseMode = wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT;
27
+ },
28
+
29
+ dispose: function() {
30
+ this.clearEvents();
31
+ this.app = null;
32
+ this.spiceConnection = null;
33
+ this.agent = null;
34
+ },
35
+
36
+ process: function(spiceMessage) {
37
+ var channel = this.spiceConnection.channels[wdi.SpiceVars.SPICE_CHANNEL_MAIN];
38
+
39
+ switch(spiceMessage.messageType) {
40
+ case wdi.SpiceVars.SPICE_MSG_MAIN_INIT:
41
+ channel.connectionId = spiceMessage.args.session_id;
42
+ channel.fire('connectionId', channel.connectionId);
43
+ if(spiceMessage.args.agent_connected == 1) {
44
+ channel.fire('initAgent', spiceMessage.args.agent_tokens);
45
+ }
46
+ if (spiceMessage.args.current_mouse_mode == 1) {
47
+ channel.fire('mouseMode', spiceMessage.args.current_mouse_mode);
48
+ }
49
+ // the mouse mode must be change both if we have agent or not
50
+ this.changeMouseMode();
51
+ break;
52
+ case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_DATA:
53
+ var packet = spiceMessage.args;
54
+ this.agent.onAgentData(packet);
55
+ break;
56
+ case wdi.SpiceVars.SPICE_MSG_MAIN_AGENT_CONNECTED:
57
+ channel.fire('initAgent', spiceMessage.args.agent_tokens);
58
+ this.changeMouseMode();
59
+ break;
60
+ case wdi.SpiceVars.SPICE_MSG_MAIN_MULTI_MEDIA_TIME:
61
+ this.app.multimediaTime = spiceMessage.args.multimedia_time;
62
+ break;
63
+ case wdi.SpiceVars.SPICE_MSG_MAIN_CHANNELS_LIST:
64
+ channel.fire('channelListAvailable', spiceMessage.args.channels);
65
+ break;
66
+ }
67
+ },
68
+
69
+ changeMouseMode: function(mode = wdi.SpiceMouseModeTypes.SPICE_MOUSE_MODE_CLIENT) {
70
+ var packet = new wdi.SpiceMessage({
71
+ messageType: wdi.SpiceVars.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
72
+ channel: wdi.SpiceVars.SPICE_CHANNEL_MAIN,
73
+ args: new wdi.SpiceMouseModeRequest({
74
+ request_mode: mode // Custom code
75
+ })
76
+ });
77
+ this.spiceConnection.send(packet);
78
+ this.currentMouseMode = mode // Custom code
79
+ const { $mouse } = useNuxtApp()
80
+ $mouse.changeMode(mode)
81
+ }
82
+ });