homebridge-xbox-tv 2.10.0-beta.21 → 2.10.0-beta.22
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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.10.0-beta.
|
|
4
|
+
"version": "2.10.0-beta.22",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/localApi/message.js
CHANGED
|
@@ -9,9 +9,10 @@ class MESSAGE {
|
|
|
9
9
|
//type
|
|
10
10
|
this.type = type;
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
this.packet =
|
|
12
|
+
//structure
|
|
13
|
+
const packets = new Packets();
|
|
14
|
+
this.packet = packets[type];
|
|
15
|
+
this.packets = packets;
|
|
15
16
|
|
|
16
17
|
//channelId
|
|
17
18
|
this.channelId = '\x00\x00\x00\x00\x00\x00\x00\x00';
|
|
@@ -201,7 +202,9 @@ class MESSAGE {
|
|
|
201
202
|
packet.payloadDecrypted = new Structure(payloadDecrypted).toBuffer();
|
|
202
203
|
packet.payloadProtected = {};
|
|
203
204
|
|
|
204
|
-
const
|
|
205
|
+
const packets = new Packets();
|
|
206
|
+
const packetProtected = packets[packet.type];
|
|
207
|
+
|
|
205
208
|
const structureDecrypted = new Structure(payloadDecrypted);
|
|
206
209
|
for (const name in packetProtected) {
|
|
207
210
|
packet.payloadProtected[name] = packetProtected[name].unpack(structureDecrypted);
|
package/src/localApi/simple.js
CHANGED
|
@@ -7,10 +7,10 @@ class SIMPLE {
|
|
|
7
7
|
//type
|
|
8
8
|
this.type = type;
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
this.packet =
|
|
13
|
-
this.packetProtected =
|
|
10
|
+
//structure
|
|
11
|
+
const packets = new Packets();
|
|
12
|
+
this.packet = packets[type];
|
|
13
|
+
this.packetProtected = packets.payloadProtected !== undefined ? packets[`${type}Protected`] : false;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
set(key, value, isProtected = false) {
|
|
@@ -166,7 +166,9 @@ class SIMPLE {
|
|
|
166
166
|
const payloadDecrypted = crypto.decrypt(packet.payloadProtected, packet.iv).slice(0, packet.payloadProtectedLength);
|
|
167
167
|
packet.payloadProtected = {};
|
|
168
168
|
|
|
169
|
-
const
|
|
169
|
+
const packets = new Packets();
|
|
170
|
+
const packetProtected = packets[`${packet.type}Protected`];
|
|
171
|
+
|
|
170
172
|
const structureDecrypted = new Structure(payloadDecrypted);
|
|
171
173
|
for (const name in packetProtected) {
|
|
172
174
|
packet.payloadProtected[name] = packetProtected[name].unpack(structureDecrypted);
|