@iobroker/socket-classes 1.1.1 → 1.1.2
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/LICENSE +1 -1
- package/README.md +4 -1
- package/lib/socketCommands.js +29 -29
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2023 bluefox <dogafox@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -888,6 +888,9 @@ Read all instances of the given adapter, or all instances of all adapters if ada
|
|
|
888
888
|
-->
|
|
889
889
|
|
|
890
890
|
## Changelog
|
|
891
|
+
### 1.1.2 (2023-03-03)
|
|
892
|
+
* (bluefox) Allow deletion of fullcalendar objects
|
|
893
|
+
|
|
891
894
|
### 1.1.1 (2022-12-22)
|
|
892
895
|
* (bluefox) Corrected error with subscribe
|
|
893
896
|
|
|
@@ -991,7 +994,7 @@ Read all instances of the given adapter, or all instances of all adapters if ada
|
|
|
991
994
|
## License
|
|
992
995
|
The MIT License (MIT)
|
|
993
996
|
|
|
994
|
-
Copyright (c) 2020-
|
|
997
|
+
Copyright (c) 2020-2023 Bluefox <dogafox@gmail.com>
|
|
995
998
|
|
|
996
999
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
997
1000
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/socketCommands.js
CHANGED
|
@@ -176,7 +176,7 @@ class SocketCommands {
|
|
|
176
176
|
return true;
|
|
177
177
|
}
|
|
178
178
|
} else {
|
|
179
|
-
this.adapter.log.warn(
|
|
179
|
+
this.adapter.log.warn(`No rule for command: ${command}`);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
if (typeof callback === 'function') {
|
|
@@ -622,7 +622,7 @@ class SocketCommands {
|
|
|
622
622
|
this.commands['error'] = (socket, error) => {
|
|
623
623
|
// Write error into ioBroker log
|
|
624
624
|
// @param {string} error - error text
|
|
625
|
-
this.adapter.log.error(
|
|
625
|
+
this.adapter.log.error(`Socket error: ${error}`);
|
|
626
626
|
};
|
|
627
627
|
|
|
628
628
|
this.commands['log'] = (socket, text, level) => {
|
|
@@ -659,7 +659,7 @@ class SocketCommands {
|
|
|
659
659
|
this.adapter.getHistory(id, options, (error, ...args) =>
|
|
660
660
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
661
661
|
} catch (error) {
|
|
662
|
-
this.adapter.log.error(
|
|
662
|
+
this.adapter.log.error(`[getHistory] ERROR: ${error.toString()}`);
|
|
663
663
|
SocketCommands._fixCallback(callback, error);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
@@ -833,7 +833,7 @@ class SocketCommands {
|
|
|
833
833
|
this.adapter.readFile(_adapter, fileName, {user: socket._acl.user}, (error, ...args) =>
|
|
834
834
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
835
835
|
} catch (error) {
|
|
836
|
-
this.adapter.log.error(
|
|
836
|
+
this.adapter.log.error(`[readFile] ERROR: ${error.toString()}`);
|
|
837
837
|
SocketCommands._fixCallback(callback, error);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
@@ -860,7 +860,7 @@ class SocketCommands {
|
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
862
|
} catch (error) {
|
|
863
|
-
this.adapter.log.error(
|
|
863
|
+
this.adapter.log.error(`[readFile64] Cannot convert data: ${error.toString()}`);
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
|
|
@@ -872,7 +872,7 @@ class SocketCommands {
|
|
|
872
872
|
}
|
|
873
873
|
});
|
|
874
874
|
} catch (error) {
|
|
875
|
-
this.adapter.log.error(
|
|
875
|
+
this.adapter.log.error(`[readFile64] ERROR: ${error.toString()}`);
|
|
876
876
|
SocketCommands._fixCallback(callback, error);
|
|
877
877
|
}
|
|
878
878
|
}
|
|
@@ -904,8 +904,8 @@ class SocketCommands {
|
|
|
904
904
|
this.adapter.writeFile(_adapter, fileName, buffer, options, (error, ...args) =>
|
|
905
905
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
906
906
|
} catch (error) {
|
|
907
|
-
this.adapter.log.error(
|
|
908
|
-
SocketCommands._fixCallback(callback,
|
|
907
|
+
this.adapter.log.error(`[writeFile64] Cannot convert data: ${error.toString()}`);
|
|
908
|
+
SocketCommands._fixCallback(callback, `Cannot convert data: ${error.toString()}`);
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
911
|
};
|
|
@@ -931,7 +931,7 @@ class SocketCommands {
|
|
|
931
931
|
this.adapter.writeFile(_adapter, fileName, data, options, (error, ...args) =>
|
|
932
932
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
933
933
|
} catch (error) {
|
|
934
|
-
this.adapter.log.error(
|
|
934
|
+
this.adapter.log.error(`[writeFile] ERROR: ${error.toString()}`);
|
|
935
935
|
SocketCommands._fixCallback(callback, error);
|
|
936
936
|
}
|
|
937
937
|
}
|
|
@@ -964,7 +964,7 @@ class SocketCommands {
|
|
|
964
964
|
this.adapter.unlink(_adapter, name, {user: socket._acl.user}, (error, ...args) =>
|
|
965
965
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
966
966
|
} catch (error) {
|
|
967
|
-
this.adapter.log.error(
|
|
967
|
+
this.adapter.log.error(`[deleteFile] ERROR: ${error.toString()}`);
|
|
968
968
|
SocketCommands._fixCallback(callback, error);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
@@ -981,7 +981,7 @@ class SocketCommands {
|
|
|
981
981
|
.then(() => SocketCommands._fixCallback(callback, null))
|
|
982
982
|
.catch(error => SocketCommands._fixCallback(callback, error));
|
|
983
983
|
} catch (error) {
|
|
984
|
-
this.adapter.log.error(
|
|
984
|
+
this.adapter.log.error(`[deleteFolder] ERROR: ${error.toString()}`);
|
|
985
985
|
SocketCommands._fixCallback(callback, error);
|
|
986
986
|
}
|
|
987
987
|
}
|
|
@@ -998,7 +998,7 @@ class SocketCommands {
|
|
|
998
998
|
this.adapter.rename(_adapter, oldName, newName, {user: socket._acl.user}, (error, ...args) =>
|
|
999
999
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1000
1000
|
} catch (error) {
|
|
1001
|
-
this.adapter.log.error(
|
|
1001
|
+
this.adapter.log.error(`[renameFile] ERROR: ${error.toString()}`);
|
|
1002
1002
|
SocketCommands._fixCallback(callback, error);
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
@@ -1016,7 +1016,7 @@ class SocketCommands {
|
|
|
1016
1016
|
.then(() => SocketCommands._fixCallback(callback))
|
|
1017
1017
|
.catch(error => SocketCommands._fixCallback(callback, error));
|
|
1018
1018
|
} catch (error) {
|
|
1019
|
-
this.adapter.log.error(
|
|
1019
|
+
this.adapter.log.error(`[rename] ERROR: ${error.toString()}`);
|
|
1020
1020
|
SocketCommands._fixCallback(callback, error);
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
@@ -1032,7 +1032,7 @@ class SocketCommands {
|
|
|
1032
1032
|
this.adapter.mkdir(_adapter, dirName, {user: socket._acl.user}, (error, ...args) =>
|
|
1033
1033
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1034
1034
|
} catch (error) {
|
|
1035
|
-
this.adapter.log.error(
|
|
1035
|
+
this.adapter.log.error(`[mkdir] ERROR: ${error.toString()}`);
|
|
1036
1036
|
SocketCommands._fixCallback(callback, error);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
@@ -1060,7 +1060,7 @@ class SocketCommands {
|
|
|
1060
1060
|
this.adapter.readDir(_adapter, dirName, {user: socket._acl.user}, (error, ...args) =>
|
|
1061
1061
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1062
1062
|
} catch (error) {
|
|
1063
|
-
this.adapter.log.error(
|
|
1063
|
+
this.adapter.log.error(`[readDir] ERROR: ${error.toString()}`);
|
|
1064
1064
|
SocketCommands._fixCallback(callback, error);
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
@@ -1178,7 +1178,7 @@ class SocketCommands {
|
|
|
1178
1178
|
});
|
|
1179
1179
|
|
|
1180
1180
|
} catch (error) {
|
|
1181
|
-
this.adapter.log.error(
|
|
1181
|
+
this.adapter.log.error(`[getAdapterInstances] ERROR: ${error.toString()}`);
|
|
1182
1182
|
SocketCommands._fixCallback(callback, error);
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
@@ -1201,7 +1201,7 @@ class SocketCommands {
|
|
|
1201
1201
|
this.adapter.getForeignStates(pattern || '*', {user: socket._acl.user}, (error, ...args) =>
|
|
1202
1202
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1203
1203
|
} catch (error) {
|
|
1204
|
-
this.adapter.log.error(
|
|
1204
|
+
this.adapter.log.error(`[getStates] ERROR: ${error.toString()}`);
|
|
1205
1205
|
SocketCommands._fixCallback(callback, error);
|
|
1206
1206
|
}
|
|
1207
1207
|
} else {
|
|
@@ -1242,7 +1242,7 @@ class SocketCommands {
|
|
|
1242
1242
|
this.adapter.getForeignState(id, {user: socket._acl.user}, (error, ...args) =>
|
|
1243
1243
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1244
1244
|
} catch (error) {
|
|
1245
|
-
this.adapter.log.error(
|
|
1245
|
+
this.adapter.log.error(`[getState] ERROR: ${error.toString()}`);
|
|
1246
1246
|
SocketCommands._fixCallback(callback, error);
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
@@ -1271,7 +1271,7 @@ class SocketCommands {
|
|
|
1271
1271
|
this.adapter.setForeignState(id, state, {user: socket._acl.user}, (error, ...args) =>
|
|
1272
1272
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1273
1273
|
} catch (error) {
|
|
1274
|
-
this.adapter.log.error(
|
|
1274
|
+
this.adapter.log.error(`[setState] ERROR: ${error.toString()}`);
|
|
1275
1275
|
SocketCommands._fixCallback(callback, error);
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
@@ -1290,7 +1290,7 @@ class SocketCommands {
|
|
|
1290
1290
|
try {
|
|
1291
1291
|
data = Buffer.from(data).toString('base64');
|
|
1292
1292
|
} catch (error) {
|
|
1293
|
-
this.adapter.log.error(
|
|
1293
|
+
this.adapter.log.error(`[getBinaryState] Cannot convert data: ${error.toString()}`);
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
1296
|
SocketCommands._fixCallback(callback, error, data);
|
|
@@ -1301,7 +1301,7 @@ class SocketCommands {
|
|
|
1301
1301
|
try {
|
|
1302
1302
|
data = Buffer.from(data).toString('base64');
|
|
1303
1303
|
} catch (error) {
|
|
1304
|
-
this.adapter.log.error(
|
|
1304
|
+
this.adapter.log.error(`[getBinaryState] Cannot convert data: ${error.toString()}`);
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
1307
|
SocketCommands._fixCallback(callback, error, data);
|
|
@@ -1328,7 +1328,7 @@ class SocketCommands {
|
|
|
1328
1328
|
try {
|
|
1329
1329
|
data = Buffer.from(base64, 'base64')
|
|
1330
1330
|
} catch (error) {
|
|
1331
|
-
this.adapter.log.warn(
|
|
1331
|
+
this.adapter.log.warn(`[setBinaryState] Cannot convert base64 data: ${error.toString()}`);
|
|
1332
1332
|
}
|
|
1333
1333
|
|
|
1334
1334
|
try {
|
|
@@ -1340,7 +1340,7 @@ class SocketCommands {
|
|
|
1340
1340
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1341
1341
|
}
|
|
1342
1342
|
} catch (error) {
|
|
1343
|
-
this.adapter.log.error(
|
|
1343
|
+
this.adapter.log.error(`[setBinaryState] ERROR: ${error.toString()}`);
|
|
1344
1344
|
SocketCommands._fixCallback(callback, error);
|
|
1345
1345
|
}
|
|
1346
1346
|
} else {
|
|
@@ -1393,7 +1393,7 @@ class SocketCommands {
|
|
|
1393
1393
|
SocketCommands._fixCallback(callback, error, obj);
|
|
1394
1394
|
});
|
|
1395
1395
|
} catch (error) {
|
|
1396
|
-
this.adapter.log.error(
|
|
1396
|
+
this.adapter.log.error(`[getObject] ERROR: ${error.toString()}`);
|
|
1397
1397
|
SocketCommands._fixCallback(callback, error);
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
@@ -1417,7 +1417,7 @@ class SocketCommands {
|
|
|
1417
1417
|
Object.assign(objs, channels, devices, enums);
|
|
1418
1418
|
objs['system.config'] = config;
|
|
1419
1419
|
} catch (e) {
|
|
1420
|
-
this.adapter.log.error(
|
|
1420
|
+
this.adapter.log.error(`[getObjects] ERROR: ${e.toString()}`);
|
|
1421
1421
|
}
|
|
1422
1422
|
// overload language
|
|
1423
1423
|
if (this.adapter._language && objs['system.config'] && objs['system.config'].common) {
|
|
@@ -1430,7 +1430,7 @@ class SocketCommands {
|
|
|
1430
1430
|
this.adapter.log.warn('[getObjects] Invalid callback');
|
|
1431
1431
|
}
|
|
1432
1432
|
} catch (error) {
|
|
1433
|
-
this.adapter.log.error(
|
|
1433
|
+
this.adapter.log.error(`[getObjects] ERROR: ${error.toString()}`);
|
|
1434
1434
|
SocketCommands._fixCallback(callback, error);
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
@@ -1514,7 +1514,7 @@ class SocketCommands {
|
|
|
1514
1514
|
this.adapter.setForeignObject(id, obj, {user: socket._acl.user}, (error, ...args) =>
|
|
1515
1515
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1516
1516
|
} catch (error) {
|
|
1517
|
-
this.adapter.log.error(
|
|
1517
|
+
this.adapter.log.error(`[setObject] ERROR: ${error.toString()}`);
|
|
1518
1518
|
SocketCommands._fixCallback(callback, error);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
@@ -1526,13 +1526,13 @@ class SocketCommands {
|
|
|
1526
1526
|
// @param {string} id - Object ID like, 'flot.0.myChart'
|
|
1527
1527
|
// @param {string} options - ignored
|
|
1528
1528
|
// @param {function} callback - `function (error)`
|
|
1529
|
-
if (id.startsWith('flot.')) {
|
|
1529
|
+
if (id.startsWith('flot.') || id.startsWith('fullcalendar.')) {
|
|
1530
1530
|
if (this._checkPermissions(socket, 'delObject', callback, id)) {
|
|
1531
1531
|
try {
|
|
1532
1532
|
this.adapter.delForeignObject(id, {user: socket._acl.user}, (error, ...args) =>
|
|
1533
1533
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1534
1534
|
} catch (error) {
|
|
1535
|
-
this.adapter.log.error(
|
|
1535
|
+
this.adapter.log.error(`[delObject] ERROR: ${error.toString()}`);
|
|
1536
1536
|
SocketCommands._fixCallback(callback, error);
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/socket-classes",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "ioBroker server-side web sockets",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@iobroker/adapter-core": "^2.6.7",
|
|
25
25
|
"passport": "^0.6.0",
|
|
26
26
|
"cookie-parser": "^1.4.6",
|
|
27
|
-
"axios": "^
|
|
27
|
+
"axios": "^1.3.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@alcalzone/release-script": "^3.5.9",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"iobroker.js-controller": "dev",
|
|
33
33
|
"gulp": "^4.0.2",
|
|
34
34
|
"chai": "^4.3.7",
|
|
35
|
-
"mocha": "^10.
|
|
35
|
+
"mocha": "^10.2.0"
|
|
36
36
|
},
|
|
37
37
|
"bugs": {
|
|
38
38
|
"url": "https://github.com/ioBroker/ioBroker.web/issues"
|