@iobroker/socket-classes 1.1.0 → 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 +7 -1
- package/lib/socketCommands.js +61 -54
- 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,12 @@ 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
|
+
|
|
894
|
+
### 1.1.1 (2022-12-22)
|
|
895
|
+
* (bluefox) Corrected error with subscribe
|
|
896
|
+
|
|
891
897
|
### 1.1.0 (2022-12-22)
|
|
892
898
|
* (bluefox) Added user check to many commands
|
|
893
899
|
* (bluefox) Downgrade axios to 0.27.2
|
|
@@ -988,7 +994,7 @@ Read all instances of the given adapter, or all instances of all adapters if ada
|
|
|
988
994
|
## License
|
|
989
995
|
The MIT License (MIT)
|
|
990
996
|
|
|
991
|
-
Copyright (c) 2020-
|
|
997
|
+
Copyright (c) 2020-2023 Bluefox <dogafox@gmail.com>
|
|
992
998
|
|
|
993
999
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
994
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') {
|
|
@@ -280,19 +280,21 @@ class SocketCommands {
|
|
|
280
280
|
s.push({pattern: key, regex: new RegExp(p)});
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
const options = socket && socket._acl ? {user: socket._acl.user} : undefined;
|
|
284
|
+
|
|
283
285
|
if (this.subscribes[type][key] === undefined) {
|
|
284
286
|
this.subscribes[type][key] = 1;
|
|
285
287
|
if (type === 'stateChange') {
|
|
286
|
-
this.adapter.subscribeForeignStates(pattern,
|
|
288
|
+
this.adapter.subscribeForeignStates(pattern, options);
|
|
287
289
|
} else if (type === 'objectChange') {
|
|
288
|
-
this.adapter.subscribeForeignObjects && this.adapter.subscribeForeignObjects(pattern,
|
|
290
|
+
this.adapter.subscribeForeignObjects && this.adapter.subscribeForeignObjects(pattern, options);
|
|
289
291
|
} else if (type === 'log') {
|
|
290
292
|
if (!this.logEnabled && this.adapter.requireLog) {
|
|
291
293
|
this.logEnabled = true;
|
|
292
|
-
this.adapter.requireLog(true);
|
|
294
|
+
this.adapter.requireLog(true, options);
|
|
293
295
|
}
|
|
294
296
|
} else if (type === 'fileChange') {
|
|
295
|
-
this.adapter.subscribeForeignFiles && this.adapter.subscribeForeignFiles(pattern, patternFile,
|
|
297
|
+
this.adapter.subscribeForeignFiles && this.adapter.subscribeForeignFiles(pattern, patternFile, options);
|
|
296
298
|
}
|
|
297
299
|
} else {
|
|
298
300
|
this.subscribes[type][key]++;
|
|
@@ -317,6 +319,8 @@ class SocketCommands {
|
|
|
317
319
|
key = pattern;
|
|
318
320
|
}
|
|
319
321
|
|
|
322
|
+
const options = socket && socket._acl ? {user: socket._acl.user} : undefined;
|
|
323
|
+
|
|
320
324
|
if (socket && typeof socket === 'object') {
|
|
321
325
|
if (!socket.subscribe || !socket.subscribe[type]) {
|
|
322
326
|
return;
|
|
@@ -324,26 +328,25 @@ class SocketCommands {
|
|
|
324
328
|
|
|
325
329
|
for (let i = socket.subscribe[type].length - 1; i >= 0; i--) {
|
|
326
330
|
if (socket.subscribe[type][i].pattern === key) {
|
|
327
|
-
|
|
328
331
|
// Remove pattern from global list
|
|
329
332
|
if (this.subscribes[type][key] !== undefined) {
|
|
330
333
|
this.subscribes[type][key]--;
|
|
331
334
|
if (this.subscribes[type][key] <= 0) {
|
|
332
335
|
if (type === 'stateChange') {
|
|
333
336
|
//console.log((socket._name || socket.id) + ' unsubscribeForeignStates ' + pattern);
|
|
334
|
-
this.adapter.unsubscribeForeignStates(pattern,
|
|
337
|
+
this.adapter.unsubscribeForeignStates(pattern, options);
|
|
335
338
|
} else if (type === 'objectChange') {
|
|
336
339
|
//console.log((socket._name || socket.id) + ' unsubscribeForeignObjects ' + pattern);
|
|
337
|
-
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern,
|
|
340
|
+
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern, options);
|
|
338
341
|
} else if (type === 'log') {
|
|
339
342
|
//console.log((socket._name || socket.id) + ' requireLog false');
|
|
340
343
|
if (this.logEnabled && this.adapter.requireLog) {
|
|
341
344
|
this.logEnabled = false;
|
|
342
|
-
this.adapter.requireLog(false);
|
|
345
|
+
this.adapter.requireLog(false, options);
|
|
343
346
|
}
|
|
344
347
|
} else if (type === 'fileChange') {
|
|
345
348
|
//console.log((socket._name || socket.id) + ' requireLog false');
|
|
346
|
-
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(pattern, patternFile,
|
|
349
|
+
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(pattern, patternFile, options);
|
|
347
350
|
}
|
|
348
351
|
delete this.subscribes[type][pattern];
|
|
349
352
|
}
|
|
@@ -360,16 +363,16 @@ class SocketCommands {
|
|
|
360
363
|
this.subscribes[type][key]--;
|
|
361
364
|
if (this.subscribes[type][key] <= 0) {
|
|
362
365
|
if (type === 'stateChange') {
|
|
363
|
-
this.adapter.unsubscribeForeignStates(pattern,
|
|
366
|
+
this.adapter.unsubscribeForeignStates(pattern, options);
|
|
364
367
|
} else if (type === 'objectChange') {
|
|
365
|
-
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern,
|
|
368
|
+
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern, options);
|
|
366
369
|
} else if (type === 'log') {
|
|
367
370
|
if (this.adapter.requireLog && this.logEnabled) {
|
|
368
371
|
this.logEnabled = false;
|
|
369
|
-
this.adapter.requireLog(false);
|
|
372
|
+
this.adapter.requireLog(false, options);
|
|
370
373
|
}
|
|
371
374
|
} else if (type === 'fileChange') {
|
|
372
|
-
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(pattern, patternFile,
|
|
375
|
+
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(pattern, patternFile, options);
|
|
373
376
|
}
|
|
374
377
|
delete this.subscribes[type][key];
|
|
375
378
|
}
|
|
@@ -378,19 +381,19 @@ class SocketCommands {
|
|
|
378
381
|
Object.keys(this.subscribes[type]).forEach(pattern => {
|
|
379
382
|
if (type === 'stateChange') {
|
|
380
383
|
//console.log((socket._name || socket.id) + ' unsubscribeForeignStates ' + pattern);
|
|
381
|
-
this.adapter.unsubscribeForeignStates(pattern,
|
|
384
|
+
this.adapter.unsubscribeForeignStates(pattern, options);
|
|
382
385
|
} else if (type === 'objectChange') {
|
|
383
386
|
//console.log((socket._name || socket.id) + ' unsubscribeForeignObjects ' + pattern);
|
|
384
|
-
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern,
|
|
387
|
+
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern, options);
|
|
385
388
|
} else if (type === 'log') {
|
|
386
389
|
//console.log((socket._name || socket.id) + ' requireLog false');
|
|
387
390
|
if (this.adapter.requireLog && this.logEnabled) {
|
|
388
391
|
this.logEnabled = false;
|
|
389
|
-
this.adapter.requireLog(false);
|
|
392
|
+
this.adapter.requireLog(false, options);
|
|
390
393
|
}
|
|
391
394
|
} else if (type === 'fileChange') {
|
|
392
395
|
const [id, fileName] = pattern.split('####');
|
|
393
|
-
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(id, fileName,
|
|
396
|
+
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(id, fileName, options);
|
|
394
397
|
}
|
|
395
398
|
});
|
|
396
399
|
|
|
@@ -413,22 +416,24 @@ class SocketCommands {
|
|
|
413
416
|
return;
|
|
414
417
|
}
|
|
415
418
|
|
|
419
|
+
const options = socket && socket._acl ? {user: socket._acl.user} : undefined;
|
|
420
|
+
|
|
416
421
|
for (let i = 0; i < socket.subscribe[type].length; i++) {
|
|
417
422
|
const pattern = socket.subscribe[type][i].pattern;
|
|
418
423
|
if (this.subscribes[type][pattern] === undefined) {
|
|
419
424
|
this.subscribes[type][pattern] = 1;
|
|
420
425
|
if (type === 'stateChange') {
|
|
421
|
-
this.adapter.subscribeForeignStates(pattern,
|
|
426
|
+
this.adapter.subscribeForeignStates(pattern, options);
|
|
422
427
|
} else if (type === 'objectChange') {
|
|
423
|
-
this.adapter.subscribeForeignObjects && this.adapter.subscribeForeignObjects(pattern,
|
|
428
|
+
this.adapter.subscribeForeignObjects && this.adapter.subscribeForeignObjects(pattern, options);
|
|
424
429
|
} else if (type === 'log') {
|
|
425
430
|
if (this.adapter.requireLog && !this.logEnabled) {
|
|
426
431
|
this.logEnabled = true;
|
|
427
|
-
this.adapter.requireLog(true);
|
|
432
|
+
this.adapter.requireLog(true, options);
|
|
428
433
|
}
|
|
429
434
|
} else if (type === 'fileChange') {
|
|
430
435
|
const [id, fileName] = pattern.split('####');
|
|
431
|
-
this.adapter.subscribeForeignFiles && this.adapter.subscribeForeignFiles(id, fileName,
|
|
436
|
+
this.adapter.subscribeForeignFiles && this.adapter.subscribeForeignFiles(id, fileName, options);
|
|
432
437
|
}
|
|
433
438
|
} else {
|
|
434
439
|
this.subscribes[type][pattern]++;
|
|
@@ -451,23 +456,25 @@ class SocketCommands {
|
|
|
451
456
|
return;
|
|
452
457
|
}
|
|
453
458
|
|
|
459
|
+
const options = socket && socket._acl ? {user: socket._acl.user} : undefined;
|
|
460
|
+
|
|
454
461
|
for (let i = 0; i < socket.subscribe[type].length; i++) {
|
|
455
462
|
const pattern = socket.subscribe[type][i].pattern;
|
|
456
463
|
if (this.subscribes[type][pattern] !== undefined) {
|
|
457
464
|
this.subscribes[type][pattern]--;
|
|
458
465
|
if (this.subscribes[type][pattern] <= 0) {
|
|
459
466
|
if (type === 'stateChange') {
|
|
460
|
-
this.adapter.unsubscribeForeignStates(pattern,
|
|
467
|
+
this.adapter.unsubscribeForeignStates(pattern, options);
|
|
461
468
|
} else if (type === 'objectChange') {
|
|
462
|
-
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern,
|
|
469
|
+
this.adapter.unsubscribeForeignObjects && this.adapter.unsubscribeForeignObjects(pattern, options);
|
|
463
470
|
} else if (type === 'log') {
|
|
464
471
|
if (this.adapter.requireLog && !this.logEnabled) {
|
|
465
472
|
this.logEnabled = true;
|
|
466
|
-
this.adapter.requireLog(true);
|
|
473
|
+
this.adapter.requireLog(true, options);
|
|
467
474
|
}
|
|
468
475
|
} else if (type === 'fileChange') {
|
|
469
476
|
const [id, fileName] = pattern.split('####');
|
|
470
|
-
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(id, fileName,
|
|
477
|
+
this.adapter.unsubscribeForeignFiles && this.adapter.unsubscribeForeignFiles(id, fileName, options);
|
|
471
478
|
}
|
|
472
479
|
delete this.subscribes[type][pattern];
|
|
473
480
|
}
|
|
@@ -615,7 +622,7 @@ class SocketCommands {
|
|
|
615
622
|
this.commands['error'] = (socket, error) => {
|
|
616
623
|
// Write error into ioBroker log
|
|
617
624
|
// @param {string} error - error text
|
|
618
|
-
this.adapter.log.error(
|
|
625
|
+
this.adapter.log.error(`Socket error: ${error}`);
|
|
619
626
|
};
|
|
620
627
|
|
|
621
628
|
this.commands['log'] = (socket, text, level) => {
|
|
@@ -652,7 +659,7 @@ class SocketCommands {
|
|
|
652
659
|
this.adapter.getHistory(id, options, (error, ...args) =>
|
|
653
660
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
654
661
|
} catch (error) {
|
|
655
|
-
this.adapter.log.error(
|
|
662
|
+
this.adapter.log.error(`[getHistory] ERROR: ${error.toString()}`);
|
|
656
663
|
SocketCommands._fixCallback(callback, error);
|
|
657
664
|
}
|
|
658
665
|
}
|
|
@@ -826,7 +833,7 @@ class SocketCommands {
|
|
|
826
833
|
this.adapter.readFile(_adapter, fileName, {user: socket._acl.user}, (error, ...args) =>
|
|
827
834
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
828
835
|
} catch (error) {
|
|
829
|
-
this.adapter.log.error(
|
|
836
|
+
this.adapter.log.error(`[readFile] ERROR: ${error.toString()}`);
|
|
830
837
|
SocketCommands._fixCallback(callback, error);
|
|
831
838
|
}
|
|
832
839
|
}
|
|
@@ -853,7 +860,7 @@ class SocketCommands {
|
|
|
853
860
|
}
|
|
854
861
|
}
|
|
855
862
|
} catch (error) {
|
|
856
|
-
this.adapter.log.error(
|
|
863
|
+
this.adapter.log.error(`[readFile64] Cannot convert data: ${error.toString()}`);
|
|
857
864
|
}
|
|
858
865
|
}
|
|
859
866
|
|
|
@@ -865,7 +872,7 @@ class SocketCommands {
|
|
|
865
872
|
}
|
|
866
873
|
});
|
|
867
874
|
} catch (error) {
|
|
868
|
-
this.adapter.log.error(
|
|
875
|
+
this.adapter.log.error(`[readFile64] ERROR: ${error.toString()}`);
|
|
869
876
|
SocketCommands._fixCallback(callback, error);
|
|
870
877
|
}
|
|
871
878
|
}
|
|
@@ -897,8 +904,8 @@ class SocketCommands {
|
|
|
897
904
|
this.adapter.writeFile(_adapter, fileName, buffer, options, (error, ...args) =>
|
|
898
905
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
899
906
|
} catch (error) {
|
|
900
|
-
this.adapter.log.error(
|
|
901
|
-
SocketCommands._fixCallback(callback,
|
|
907
|
+
this.adapter.log.error(`[writeFile64] Cannot convert data: ${error.toString()}`);
|
|
908
|
+
SocketCommands._fixCallback(callback, `Cannot convert data: ${error.toString()}`);
|
|
902
909
|
}
|
|
903
910
|
}
|
|
904
911
|
};
|
|
@@ -924,7 +931,7 @@ class SocketCommands {
|
|
|
924
931
|
this.adapter.writeFile(_adapter, fileName, data, options, (error, ...args) =>
|
|
925
932
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
926
933
|
} catch (error) {
|
|
927
|
-
this.adapter.log.error(
|
|
934
|
+
this.adapter.log.error(`[writeFile] ERROR: ${error.toString()}`);
|
|
928
935
|
SocketCommands._fixCallback(callback, error);
|
|
929
936
|
}
|
|
930
937
|
}
|
|
@@ -957,7 +964,7 @@ class SocketCommands {
|
|
|
957
964
|
this.adapter.unlink(_adapter, name, {user: socket._acl.user}, (error, ...args) =>
|
|
958
965
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
959
966
|
} catch (error) {
|
|
960
|
-
this.adapter.log.error(
|
|
967
|
+
this.adapter.log.error(`[deleteFile] ERROR: ${error.toString()}`);
|
|
961
968
|
SocketCommands._fixCallback(callback, error);
|
|
962
969
|
}
|
|
963
970
|
}
|
|
@@ -974,7 +981,7 @@ class SocketCommands {
|
|
|
974
981
|
.then(() => SocketCommands._fixCallback(callback, null))
|
|
975
982
|
.catch(error => SocketCommands._fixCallback(callback, error));
|
|
976
983
|
} catch (error) {
|
|
977
|
-
this.adapter.log.error(
|
|
984
|
+
this.adapter.log.error(`[deleteFolder] ERROR: ${error.toString()}`);
|
|
978
985
|
SocketCommands._fixCallback(callback, error);
|
|
979
986
|
}
|
|
980
987
|
}
|
|
@@ -991,7 +998,7 @@ class SocketCommands {
|
|
|
991
998
|
this.adapter.rename(_adapter, oldName, newName, {user: socket._acl.user}, (error, ...args) =>
|
|
992
999
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
993
1000
|
} catch (error) {
|
|
994
|
-
this.adapter.log.error(
|
|
1001
|
+
this.adapter.log.error(`[renameFile] ERROR: ${error.toString()}`);
|
|
995
1002
|
SocketCommands._fixCallback(callback, error);
|
|
996
1003
|
}
|
|
997
1004
|
}
|
|
@@ -1009,7 +1016,7 @@ class SocketCommands {
|
|
|
1009
1016
|
.then(() => SocketCommands._fixCallback(callback))
|
|
1010
1017
|
.catch(error => SocketCommands._fixCallback(callback, error));
|
|
1011
1018
|
} catch (error) {
|
|
1012
|
-
this.adapter.log.error(
|
|
1019
|
+
this.adapter.log.error(`[rename] ERROR: ${error.toString()}`);
|
|
1013
1020
|
SocketCommands._fixCallback(callback, error);
|
|
1014
1021
|
}
|
|
1015
1022
|
}
|
|
@@ -1025,7 +1032,7 @@ class SocketCommands {
|
|
|
1025
1032
|
this.adapter.mkdir(_adapter, dirName, {user: socket._acl.user}, (error, ...args) =>
|
|
1026
1033
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1027
1034
|
} catch (error) {
|
|
1028
|
-
this.adapter.log.error(
|
|
1035
|
+
this.adapter.log.error(`[mkdir] ERROR: ${error.toString()}`);
|
|
1029
1036
|
SocketCommands._fixCallback(callback, error);
|
|
1030
1037
|
}
|
|
1031
1038
|
}
|
|
@@ -1053,7 +1060,7 @@ class SocketCommands {
|
|
|
1053
1060
|
this.adapter.readDir(_adapter, dirName, {user: socket._acl.user}, (error, ...args) =>
|
|
1054
1061
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1055
1062
|
} catch (error) {
|
|
1056
|
-
this.adapter.log.error(
|
|
1063
|
+
this.adapter.log.error(`[readDir] ERROR: ${error.toString()}`);
|
|
1057
1064
|
SocketCommands._fixCallback(callback, error);
|
|
1058
1065
|
}
|
|
1059
1066
|
}
|
|
@@ -1171,7 +1178,7 @@ class SocketCommands {
|
|
|
1171
1178
|
});
|
|
1172
1179
|
|
|
1173
1180
|
} catch (error) {
|
|
1174
|
-
this.adapter.log.error(
|
|
1181
|
+
this.adapter.log.error(`[getAdapterInstances] ERROR: ${error.toString()}`);
|
|
1175
1182
|
SocketCommands._fixCallback(callback, error);
|
|
1176
1183
|
}
|
|
1177
1184
|
}
|
|
@@ -1194,7 +1201,7 @@ class SocketCommands {
|
|
|
1194
1201
|
this.adapter.getForeignStates(pattern || '*', {user: socket._acl.user}, (error, ...args) =>
|
|
1195
1202
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1196
1203
|
} catch (error) {
|
|
1197
|
-
this.adapter.log.error(
|
|
1204
|
+
this.adapter.log.error(`[getStates] ERROR: ${error.toString()}`);
|
|
1198
1205
|
SocketCommands._fixCallback(callback, error);
|
|
1199
1206
|
}
|
|
1200
1207
|
} else {
|
|
@@ -1235,7 +1242,7 @@ class SocketCommands {
|
|
|
1235
1242
|
this.adapter.getForeignState(id, {user: socket._acl.user}, (error, ...args) =>
|
|
1236
1243
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1237
1244
|
} catch (error) {
|
|
1238
|
-
this.adapter.log.error(
|
|
1245
|
+
this.adapter.log.error(`[getState] ERROR: ${error.toString()}`);
|
|
1239
1246
|
SocketCommands._fixCallback(callback, error);
|
|
1240
1247
|
}
|
|
1241
1248
|
}
|
|
@@ -1264,7 +1271,7 @@ class SocketCommands {
|
|
|
1264
1271
|
this.adapter.setForeignState(id, state, {user: socket._acl.user}, (error, ...args) =>
|
|
1265
1272
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1266
1273
|
} catch (error) {
|
|
1267
|
-
this.adapter.log.error(
|
|
1274
|
+
this.adapter.log.error(`[setState] ERROR: ${error.toString()}`);
|
|
1268
1275
|
SocketCommands._fixCallback(callback, error);
|
|
1269
1276
|
}
|
|
1270
1277
|
}
|
|
@@ -1283,7 +1290,7 @@ class SocketCommands {
|
|
|
1283
1290
|
try {
|
|
1284
1291
|
data = Buffer.from(data).toString('base64');
|
|
1285
1292
|
} catch (error) {
|
|
1286
|
-
this.adapter.log.error(
|
|
1293
|
+
this.adapter.log.error(`[getBinaryState] Cannot convert data: ${error.toString()}`);
|
|
1287
1294
|
}
|
|
1288
1295
|
}
|
|
1289
1296
|
SocketCommands._fixCallback(callback, error, data);
|
|
@@ -1294,7 +1301,7 @@ class SocketCommands {
|
|
|
1294
1301
|
try {
|
|
1295
1302
|
data = Buffer.from(data).toString('base64');
|
|
1296
1303
|
} catch (error) {
|
|
1297
|
-
this.adapter.log.error(
|
|
1304
|
+
this.adapter.log.error(`[getBinaryState] Cannot convert data: ${error.toString()}`);
|
|
1298
1305
|
}
|
|
1299
1306
|
}
|
|
1300
1307
|
SocketCommands._fixCallback(callback, error, data);
|
|
@@ -1321,7 +1328,7 @@ class SocketCommands {
|
|
|
1321
1328
|
try {
|
|
1322
1329
|
data = Buffer.from(base64, 'base64')
|
|
1323
1330
|
} catch (error) {
|
|
1324
|
-
this.adapter.log.warn(
|
|
1331
|
+
this.adapter.log.warn(`[setBinaryState] Cannot convert base64 data: ${error.toString()}`);
|
|
1325
1332
|
}
|
|
1326
1333
|
|
|
1327
1334
|
try {
|
|
@@ -1333,7 +1340,7 @@ class SocketCommands {
|
|
|
1333
1340
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1334
1341
|
}
|
|
1335
1342
|
} catch (error) {
|
|
1336
|
-
this.adapter.log.error(
|
|
1343
|
+
this.adapter.log.error(`[setBinaryState] ERROR: ${error.toString()}`);
|
|
1337
1344
|
SocketCommands._fixCallback(callback, error);
|
|
1338
1345
|
}
|
|
1339
1346
|
} else {
|
|
@@ -1386,7 +1393,7 @@ class SocketCommands {
|
|
|
1386
1393
|
SocketCommands._fixCallback(callback, error, obj);
|
|
1387
1394
|
});
|
|
1388
1395
|
} catch (error) {
|
|
1389
|
-
this.adapter.log.error(
|
|
1396
|
+
this.adapter.log.error(`[getObject] ERROR: ${error.toString()}`);
|
|
1390
1397
|
SocketCommands._fixCallback(callback, error);
|
|
1391
1398
|
}
|
|
1392
1399
|
}
|
|
@@ -1410,7 +1417,7 @@ class SocketCommands {
|
|
|
1410
1417
|
Object.assign(objs, channels, devices, enums);
|
|
1411
1418
|
objs['system.config'] = config;
|
|
1412
1419
|
} catch (e) {
|
|
1413
|
-
this.adapter.log.error(
|
|
1420
|
+
this.adapter.log.error(`[getObjects] ERROR: ${e.toString()}`);
|
|
1414
1421
|
}
|
|
1415
1422
|
// overload language
|
|
1416
1423
|
if (this.adapter._language && objs['system.config'] && objs['system.config'].common) {
|
|
@@ -1423,7 +1430,7 @@ class SocketCommands {
|
|
|
1423
1430
|
this.adapter.log.warn('[getObjects] Invalid callback');
|
|
1424
1431
|
}
|
|
1425
1432
|
} catch (error) {
|
|
1426
|
-
this.adapter.log.error(
|
|
1433
|
+
this.adapter.log.error(`[getObjects] ERROR: ${error.toString()}`);
|
|
1427
1434
|
SocketCommands._fixCallback(callback, error);
|
|
1428
1435
|
}
|
|
1429
1436
|
}
|
|
@@ -1507,7 +1514,7 @@ class SocketCommands {
|
|
|
1507
1514
|
this.adapter.setForeignObject(id, obj, {user: socket._acl.user}, (error, ...args) =>
|
|
1508
1515
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1509
1516
|
} catch (error) {
|
|
1510
|
-
this.adapter.log.error(
|
|
1517
|
+
this.adapter.log.error(`[setObject] ERROR: ${error.toString()}`);
|
|
1511
1518
|
SocketCommands._fixCallback(callback, error);
|
|
1512
1519
|
}
|
|
1513
1520
|
}
|
|
@@ -1519,13 +1526,13 @@ class SocketCommands {
|
|
|
1519
1526
|
// @param {string} id - Object ID like, 'flot.0.myChart'
|
|
1520
1527
|
// @param {string} options - ignored
|
|
1521
1528
|
// @param {function} callback - `function (error)`
|
|
1522
|
-
if (id.startsWith('flot.')) {
|
|
1529
|
+
if (id.startsWith('flot.') || id.startsWith('fullcalendar.')) {
|
|
1523
1530
|
if (this._checkPermissions(socket, 'delObject', callback, id)) {
|
|
1524
1531
|
try {
|
|
1525
1532
|
this.adapter.delForeignObject(id, {user: socket._acl.user}, (error, ...args) =>
|
|
1526
1533
|
SocketCommands._fixCallback(callback, error, ...args));
|
|
1527
1534
|
} catch (error) {
|
|
1528
|
-
this.adapter.log.error(
|
|
1535
|
+
this.adapter.log.error(`[delObject] ERROR: ${error.toString()}`);
|
|
1529
1536
|
SocketCommands._fixCallback(callback, error);
|
|
1530
1537
|
}
|
|
1531
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"
|