@iobroker/socket-classes 2.2.21 → 2.3.1

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/README.md CHANGED
@@ -100,7 +100,7 @@ adapter.on('message', obj => {
100
100
  });
101
101
  ```
102
102
 
103
- and after that client will receive messages from instance
103
+ and after that the client will receive messages from instance
104
104
 
105
105
  ```js
106
106
  function sendImage(camera, data) {
@@ -135,6 +135,7 @@ function sendImage(camera, data) {
135
135
  * [`getAdapterName`](#getadaptername_w)
136
136
  * [`clientSubscribe`](#clientsubscribe_w)
137
137
  * [`clientUnsubscribe`](#clientunsubscribe_w)
138
+ * [`getCompactSystemConfig`](#getcompactsystemconfig_w)
138
139
  * [`getAdapterInstances`](#getadapterinstances_w)
139
140
  * [`getObject`](#getobject_w)
140
141
  * [`getObjects`](#getobjects_w)
@@ -187,7 +188,7 @@ Write error into ioBroker log
187
188
  #### <a name="log_w"></a>`log(text, level)`
188
189
  Write log entry into ioBroker log
189
190
  * `text` *string*: log text
190
- * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
191
+ * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. The default is 'debug'.
191
192
 
192
193
  #### <a name="checkfeaturesupported_w"></a>`checkFeatureSupported(feature, callback)`
193
194
  Check if the same feature is supported by the current js-controller
@@ -195,7 +196,7 @@ Check if the same feature is supported by the current js-controller
195
196
  * `callback` *(error: string | Error | null | undefined, isSupported?: boolean) => void) => void*: callback `(error: string | Error | null | undefined, isSupported: boolean) => void`
196
197
 
197
198
  #### <a name="gethistory_w"></a>`getHistory(id, options, callback)`
198
- Get history data from specific instance
199
+ Get the history data from the specific instance
199
200
  * `id` *string*: object ID
200
201
  * `options` *ioBroker.GetHistoryOptions*: History options
201
202
  * `callback` *(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void) => void*: callback `(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void`
@@ -246,8 +247,8 @@ Get adapter name: "iobroker.ws", "iobroker.socketio", "iobroker.web", "iobroker.
246
247
 
247
248
  #### <a name="clientsubscribe_w"></a>`clientSubscribe(targetInstance, messageType, data, callback)`
248
249
  Client subscribes to specific instance's messages.
249
- Client informs specific instance about subscription on its messages.
250
- After subscription, the socket will receive "im" messages from desired instance
250
+ Client informs a specific instance about subscription on its messages.
251
+ After subscription, the socket will receive "im" messages from the desired instance
251
252
  The target instance MUST acknowledge the subscription and return result
252
253
  * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
253
254
  * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
@@ -261,9 +262,13 @@ The target instance MUST NOT acknowledge the un-subscription
261
262
  * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
262
263
  * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
263
264
 
265
+ #### <a name="getcompactsystemconfig_w"></a>`getCompactSystemConfig(callback)`
266
+ Get the system configuration in a compact form to save bandwidth.
267
+ * `callback` *(error: string | null | Error | undefined, systemConfig?: {common: ioBroker.SystemConfigCommon; native?: {secret: string; vendor?: any}}) => void*: - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
268
+
264
269
  #### <a name="getadapterinstances_w"></a>`getAdapterInstances(adapterName, callback)`
265
270
  Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
266
- * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters just place here "".
271
+ * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters, just place here "".
267
272
  * `callback` *(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void) => void*: callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
268
273
 
269
274
  ### Objects
@@ -273,8 +278,8 @@ Get one object.
273
278
  * `callback` *(error: Error | undefined | string | null, obj?: ioBroker.Object) => void) => void*: Callback `(error: string | null, obj?: ioBroker.Object) => void`
274
279
 
275
280
  #### <a name="getobjects_w"></a>`getObjects(list, callback)`
276
- Get all objects that are relevant for web: all states and enums with rooms.
277
- This is non-admin version of "all objects" and will be overloaded in admin
281
+ Get all objects that are relevant for the web: all states and enums with rooms.
282
+ This is a non-admin version of "all objects" and will be overloaded in admin
278
283
  * `list` *string[] | null*: Optional list of IDs
279
284
  * `callback` *(error: Error | undefined | string | null, objs?: Record<string, ioBroker.Object>) => void) => void*: Callback `(error: string | null, objs?: Record<string, ioBroker.Object>) => void`
280
285
 
@@ -394,7 +399,7 @@ This function is overloaded in admin (because admin accepts only base64)
394
399
  * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
395
400
 
396
401
  #### <a name="unlink_w"></a>`unlink(adapter, name, callback)`
397
- Delete file in ioBroker DB
402
+ Delete a file in ioBroker DB
398
403
  * `adapter` *string*: instance name, e.g. `vis.0`
399
404
  * `name` *string*: file name, e.g. `main/vis-views.json`
400
405
  * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
@@ -432,7 +437,7 @@ Create a folder in ioBroker DB
432
437
  * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
433
438
 
434
439
  #### <a name="readdir_w"></a>`readDir(adapter, dirName, options, callback?)`
435
- Read content of folder in ioBroker DB
440
+ Read the content of the folder in ioBroker DB
436
441
  * `adapter` *string*: instance name, e.g. `vis.0`
437
442
  * `dirName` *string*: folder name, e.g. `main`
438
443
  * `options` *object | ((error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void)*: for future use
@@ -449,7 +454,7 @@ Change a file mode in ioBroker DB
449
454
  Change file owner in ioBroker DB
450
455
  * `adapter` *string*: instance name, e.g. `vis.0`
451
456
  * `fileName` *string*: file name, e.g. `main/vis-views.json`
452
- * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from owner.
457
+ * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from an owner.
453
458
  * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
454
459
 
455
460
  #### <a name="fileexists_w"></a>`fileExists(adapter, fileName, callback)`
@@ -492,6 +497,7 @@ Unsubscribe from file changes in ioBroker DB
492
497
  * [`getAdapterName`](#getadaptername_a)
493
498
  * [`clientSubscribe`](#clientsubscribe_a)
494
499
  * [`clientUnsubscribe`](#clientunsubscribe_a)
500
+ * [`getCompactSystemConfig`](#getcompactsystemconfig_a)
495
501
  * [`getAdapterInstances`](#getadapterinstances_a)
496
502
  * [`getHostByIp`](#gethostbyip_a)
497
503
  * [`requireLog`](#requirelog_a)
@@ -509,7 +515,6 @@ Unsubscribe from file changes in ioBroker DB
509
515
  * [`getCompactInstances`](#getcompactinstances_a)
510
516
  * [`getCompactAdapters`](#getcompactadapters_a)
511
517
  * [`getCompactInstalled`](#getcompactinstalled_a)
512
- * [`getCompactSystemConfig`](#getcompactsystemconfig_a)
513
518
  * [`getCompactSystemRepositories`](#getcompactsystemrepositories_a)
514
519
  * [`getCompactRepository`](#getcompactrepository_a)
515
520
  * [`getCompactHosts`](#getcompacthosts_a)
@@ -574,7 +579,7 @@ Write error into ioBroker log
574
579
  #### <a name="log_a"></a>`log(text, level)`
575
580
  Write log entry into ioBroker log
576
581
  * `text` *string*: log text
577
- * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
582
+ * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. The default is 'debug'.
578
583
 
579
584
  #### <a name="checkfeaturesupported_a"></a>`checkFeatureSupported(feature, callback)`
580
585
  Check if the same feature is supported by the current js-controller
@@ -582,7 +587,7 @@ Check if the same feature is supported by the current js-controller
582
587
  * `callback` *(error: string | Error | null | undefined, isSupported?: boolean) => void) => void*: callback `(error: string | Error | null | undefined, isSupported: boolean) => void`
583
588
 
584
589
  #### <a name="gethistory_a"></a>`getHistory(id, options, callback)`
585
- Get history data from specific instance
590
+ Get the history data from the specific instance
586
591
  * `id` *string*: object ID
587
592
  * `options` *ioBroker.GetHistoryOptions*: History options
588
593
  * `callback` *(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void) => void*: callback `(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void`
@@ -633,8 +638,8 @@ Get adapter name: "iobroker.ws", "iobroker.socketio", "iobroker.web", "iobroker.
633
638
 
634
639
  #### <a name="clientsubscribe_a"></a>`clientSubscribe(targetInstance, messageType, data, callback)`
635
640
  Client subscribes to specific instance's messages.
636
- Client informs specific instance about subscription on its messages.
637
- After subscription, the socket will receive "im" messages from desired instance
641
+ Client informs a specific instance about subscription on its messages.
642
+ After subscription, the socket will receive "im" messages from the desired instance
638
643
  The target instance MUST acknowledge the subscription and return result
639
644
  * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
640
645
  * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
@@ -648,9 +653,13 @@ The target instance MUST NOT acknowledge the un-subscription
648
653
  * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
649
654
  * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
650
655
 
656
+ #### <a name="getcompactsystemconfig_a"></a>`getCompactSystemConfig(callback)`
657
+ Get the system configuration in a compact form to save bandwidth.
658
+ * `callback` *(error: string | null | Error | undefined, systemConfig?: {common: ioBroker.SystemConfigCommon; native?: {secret: string; vendor?: any}}) => void*: - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
659
+
651
660
  #### <a name="getadapterinstances_a"></a>`getAdapterInstances(adapterName, callback)`
652
661
  Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
653
- * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters just place here "".
662
+ * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters, just place here "".
654
663
  * `callback` *(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void) => void*: callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
655
664
 
656
665
  ### Admin
@@ -660,7 +669,7 @@ Read the host object by IP address.
660
669
  * `callback?` *(error: string | null | Error | undefined, hostObject?: ioBroker.HostObject | null) => void*: - Callback function `(ip: string, obj: ioBroker.HostObject | null) => void`
661
670
 
662
671
  #### <a name="requirelog_a"></a>`requireLog(isEnabled, callback?)`
663
- Activate or deactivate logging events. Events will be sent to the socket as `log` event. Adapter must have `common.logTransporter = true`.
672
+ Activate or deactivate logging events. Events will be sent to the socket as `log` events. Adapter must have `common.logTransporter = true`.
664
673
  * `isEnabled` *boolean*: - Is logging enabled
665
674
  * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
666
675
 
@@ -671,7 +680,7 @@ Get the log files from the given host.
671
680
 
672
681
  #### <a name="cmdexec_a"></a>`cmdExec(host, id, cmd, callback?)`
673
682
  Execute the shell command on host/controller.
674
- Following response commands are expected: `cmdStdout`, `cmdStderr`, `cmdExit`.
683
+ The following response commands are expected: `cmdStdout`, `cmdStderr`, `cmdExit`.
675
684
  * `host` *string*: - Host name, e.g., `system.host.raspberrypi`
676
685
  * `id` *number*: - Session ID, e.g., `Date.now()`. This session ID will come in events `cmdStdout`, `cmdStderr`, `cmdExit`
677
686
  * `cmd` *string*: - Command to execute
@@ -732,13 +741,9 @@ Get all installed adapters in a compact form to save bandwidth.
732
741
  * `host` *string*: - Host name, e.g., `system.host.raspberrypi`
733
742
  * `callback` *(result?: Record<string, {version: string}>) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { version: string }>) => void`
734
743
 
735
- #### <a name="getcompactsystemconfig_a"></a>`getCompactSystemConfig(callback)`
736
- Get the system configuration in a compact form to save bandwidth.
737
- * `callback` *(error: string | null | Error | undefined, systemConfig?: {common: ioBroker.SystemConfigCommon; native?: {secret: string; vendor?: any}}) => void*: - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
738
-
739
744
  #### <a name="getcompactsystemrepositories_a"></a>`getCompactSystemRepositories(callback)`
740
745
  Get system repositories in a compact form to save bandwidth.
741
- * `callback` *(error: string | null | Error | undefined, systemRepositories?: CompactSystemRepository) => void) => void*: - Callback function `(error: string | null, systemRepositories?: { common: any; native?: { repositories: Record<string, { json: { _repoInfo: any } } } } }) => void`
746
+ * `callback` *(error: string | null | Error | undefined, systemRepositories?: CompactSystemRepository) => void) => void*: - Callback function `(error: string | null, systemRepositories?: { common: any; native?: { repositories: Record<string, { json: { _repoInfo: any } } } }) => void`
742
747
 
743
748
  #### <a name="getcompactrepository_a"></a>`getCompactRepository(host, callback)`
744
749
  Get the repository in a compact form to save bandwidth.
@@ -847,8 +852,8 @@ Get one object.
847
852
  * `callback` *(error: Error | undefined | string | null, obj?: ioBroker.Object) => void) => void*: Callback `(error: string | null, obj?: ioBroker.Object) => void`
848
853
 
849
854
  #### <a name="getobjects_a"></a>`getObjects(list, callback)`
850
- Get all objects that are relevant for web: all states and enums with rooms.
851
- This is non-admin version of "all objects" and will be overloaded in admin
855
+ Get all objects that are relevant for the web: all states and enums with rooms.
856
+ This is a non-admin version of "all objects" and will be overloaded in admin
852
857
  * `list` *string[] | null*: Optional list of IDs
853
858
  * `callback` *(error: Error | undefined | string | null, objs?: Record<string, ioBroker.Object>) => void) => void*: Callback `(error: string | null, objs?: Record<string, ioBroker.Object>) => void`
854
859
 
@@ -936,7 +941,7 @@ This function is overloaded in admin (because admin accepts only base64)
936
941
  * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
937
942
 
938
943
  #### <a name="unlink_a"></a>`unlink(adapter, name, callback)`
939
- Delete file in ioBroker DB
944
+ Delete a file in ioBroker DB
940
945
  * `adapter` *string*: instance name, e.g. `vis.0`
941
946
  * `name` *string*: file name, e.g. `main/vis-views.json`
942
947
  * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
@@ -974,7 +979,7 @@ Create a folder in ioBroker DB
974
979
  * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
975
980
 
976
981
  #### <a name="readdir_a"></a>`readDir(adapter, dirName, options, callback?)`
977
- Read content of folder in ioBroker DB
982
+ Read the content of the folder in ioBroker DB
978
983
  * `adapter` *string*: instance name, e.g. `vis.0`
979
984
  * `dirName` *string*: folder name, e.g. `main`
980
985
  * `options` *object | ((error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void)*: for future use
@@ -991,7 +996,7 @@ Change a file mode in ioBroker DB
991
996
  Change file owner in ioBroker DB
992
997
  * `adapter` *string*: instance name, e.g. `vis.0`
993
998
  * `fileName` *string*: file name, e.g. `main/vis-views.json`
994
- * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from owner.
999
+ * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from an owner.
995
1000
  * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
996
1001
 
997
1002
  #### <a name="fileexists_a"></a>`fileExists(adapter, fileName, callback)`
@@ -1018,9 +1023,13 @@ Unsubscribe from file changes in ioBroker DB
1018
1023
  Placeholder for the next version (at the beginning of the line):
1019
1024
  ### **WORK IN PROGRESS**
1020
1025
  -->
1026
+ ### 2.3.1 (2026-04-12)
1027
+ * (@GermanBluefox) Moved `getCompactSystemConfig` to common commands. Made it available in web and admin.
1028
+ * (@Marc-Berg) Emit tokenInfo event with exp on socket connection
1029
+
1021
1030
  ### 2.2.21 (2026-01-25)
1022
1031
 
1023
- * (@Copilot) Added missing return statement for Bearer token auth
1032
+ * (@Copilot) Added a missing return statement for Bearer token auth
1024
1033
 
1025
1034
  ### 2.2.20 (2025-07-22)
1026
1035
 
@@ -1082,7 +1091,7 @@ Unsubscribe from file changes in ioBroker DB
1082
1091
 
1083
1092
  ### 2.1.12 (2025-02-26)
1084
1093
 
1085
- * (@GermanBluefox) Added login with token in the query or as bearer token
1094
+ * (@GermanBluefox) Added login with a token in the query or as bearer token
1086
1095
 
1087
1096
  ### 2.1.7 (2025-02-23)
1088
1097
  * (@GermanBluefox) Added support for OAuth2 authentication
@@ -1133,7 +1142,7 @@ Unsubscribe from file changes in ioBroker DB
1133
1142
  * (foxriver76) fixed crash on invalid patterns with js-controller version 5
1134
1143
 
1135
1144
  ### 1.3.3 (2023-08-01)
1136
- * (@GermanBluefox) Implemented subscribing of a client on messages from specific instance
1145
+ * (@GermanBluefox) Implemented subscribing of a client on messages from a specific instance
1137
1146
  * (@GermanBluefox) Moved checkFeatureSupported to regular connection and not only admin
1138
1147
 
1139
1148
  ### 1.2.0 (2023-07-07)
@@ -1150,7 +1159,7 @@ Unsubscribe from file changes in ioBroker DB
1150
1159
  * (@GermanBluefox) Allow deletion of fullcalendar objects
1151
1160
 
1152
1161
  ### 1.1.1 (2022-12-22)
1153
- * (@GermanBluefox) Corrected error with subscribe
1162
+ * (@GermanBluefox) Corrected error with subscription
1154
1163
 
1155
1164
  ### 1.1.0 (2022-12-22)
1156
1165
  * (@GermanBluefox) Added user check to many commands
@@ -1187,7 +1196,7 @@ Unsubscribe from file changes in ioBroker DB
1187
1196
  * (@GermanBluefox) Corrected getAdapterInstances
1188
1197
 
1189
1198
  ### 0.4.9 (2022-06-20)
1190
- * (@GermanBluefox) Do not show error with failed authentication
1199
+ * (@GermanBluefox) Do not show an error with failed authentication
1191
1200
 
1192
1201
  ### 0.4.7 (2022-06-20)
1193
1202
  * (@GermanBluefox) Allowed overloading system language
@@ -1199,7 +1208,7 @@ Unsubscribe from file changes in ioBroker DB
1199
1208
  * (@GermanBluefox) allowed running socket.io behind reverse proxy
1200
1209
 
1201
1210
  ### 0.4.4 (2022-06-09)
1202
- * (@GermanBluefox) Do not show requireLog message
1211
+ * (@GermanBluefox) Do not show the requireLog message
1203
1212
 
1204
1213
  ### 0.4.3 (2022-06-03)
1205
1214
  * (@GermanBluefox) Allowed call of getAdapterInstances for non admin
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Class Socket
3
3
  *
4
- * Copyright 2014-2025 bluefox <dogafox@gmail.com>,
4
+ * Copyright 2014-2026 bluefox <dogafox@gmail.com>,
5
5
  * MIT License
6
6
  *
7
7
  */
@@ -7,7 +7,7 @@ exports.SocketAdmin = void 0;
7
7
  /**
8
8
  * Class Socket
9
9
  *
10
- * Copyright 2014-2025 bluefox <dogafox@gmail.com>,
10
+ * Copyright 2014-2026 bluefox <dogafox@gmail.com>,
11
11
  * MIT License
12
12
  *
13
13
  */
@@ -422,7 +422,7 @@ class SocketCommands {
422
422
  .unsubscribeForeignFiles(pattern, patternFile || '*', options)
423
423
  .catch(e => this.adapter.log.error(`Cannot unsubscribe "${pattern}": ${e.message}`));
424
424
  }
425
- delete this.subscribes[type][pattern];
425
+ delete this.subscribes[type][key];
426
426
  }
427
427
  }
428
428
  socket.subscribe[type].splice(i, 1);
@@ -565,9 +565,9 @@ class SocketCommands {
565
565
  .catch(e => this.adapter.log.error(`Cannot unsubscribe "${pattern}": ${e.message}`));
566
566
  }
567
567
  else if (type === 'log') {
568
- if (this.adapter.requireLog && !this.#logEnabled) {
569
- this.#logEnabled = true;
570
- void this.adapter.requireLog(true, options);
568
+ if (this.adapter.requireLog && this.#logEnabled) {
569
+ this.#logEnabled = false;
570
+ void this.adapter.requireLog(false, options);
571
571
  }
572
572
  }
573
573
  else if (type === 'fileChange' && this.adapter.unsubscribeForeignFiles) {
@@ -674,7 +674,7 @@ class SocketCommands {
674
674
  obj.common.adminUI = { config: 'none' };
675
675
  if (obj.common.noConfig) {
676
676
  obj.common.adminUI.config = 'none';
677
- // @ts-expect-error this attribute is deprecated, but still used
677
+ // @ts-expect-error this attribute is deprecated but still used
678
678
  }
679
679
  else if (obj.common.jsonConfig) {
680
680
  obj.common.adminUI.config = 'json';
@@ -685,7 +685,7 @@ class SocketCommands {
685
685
  else {
686
686
  obj.common.adminUI.config = 'html';
687
687
  }
688
- // @ts-expect-error this attribute is deprecated, but still used
688
+ // @ts-expect-error this attribute is deprecated but still used
689
689
  if (obj.common.jsonCustom) {
690
690
  obj.common.adminUI.custom = 'json';
691
691
  }
@@ -772,6 +772,7 @@ class SocketCommands {
772
772
  socket.conn.request.query.token = accessToken;
773
773
  }
774
774
  socket._sessionExpiresAt = token.aExp;
775
+ socket.emit('tokenInfo', { expiresAt: token.aExp });
775
776
  callback(null, true);
776
777
  }
777
778
  });
@@ -796,7 +797,7 @@ class SocketCommands {
796
797
  *
797
798
  * @param _socket Socket instance (not used)
798
799
  * @param text log text
799
- * @param level one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
800
+ * @param level one of `['silly', 'debug', 'info', 'warn', 'error']`. The default is 'debug'.
800
801
  */
801
802
  this.commands.log = (_socket, text, level) => {
802
803
  if (level === 'error') {
@@ -833,7 +834,7 @@ class SocketCommands {
833
834
  };
834
835
  /**
835
836
  * #DOCUMENTATION commands
836
- * Get history data from specific instance
837
+ * Get the history data from the specific instance
837
838
  *
838
839
  * @param socket Socket instance
839
840
  * @param id object ID
@@ -1261,7 +1262,7 @@ class SocketCommands {
1261
1262
  };
1262
1263
  /**
1263
1264
  * #DOCUMENTATION files
1264
- * Delete file in ioBroker DB
1265
+ * Delete a file in ioBroker DB
1265
1266
  *
1266
1267
  * @param socket Socket instance
1267
1268
  * @param adapter instance name, e.g. `vis.0`
@@ -1389,7 +1390,7 @@ class SocketCommands {
1389
1390
  };
1390
1391
  /**
1391
1392
  * #DOCUMENTATION files
1392
- * Read content of folder in ioBroker DB
1393
+ * Read the content of the folder in ioBroker DB
1393
1394
  *
1394
1395
  * @param socket Socket instance
1395
1396
  * @param adapter instance name, e.g. `vis.0`
@@ -1419,7 +1420,7 @@ class SocketCommands {
1419
1420
  * @param adapter instance name, e.g. `vis.0`
1420
1421
  * @param fileName file name, e.g. `main/vis-views.json`
1421
1422
  * @param options options `{mode: 0x644}`
1422
- * @param options.mode File mode in linux format 0x644. The first digit is user, second group, third others. Bit 1 is `execute`, bit 2 is `write`, bit 3 is `read`
1423
+ * @param options.mode File mode in linux format 0x644. The first digit is a user, the second is a group, third others. Bit 1 is `execute`, bit 2 is `write`, bit 3 is `read`
1423
1424
  * @param callback Callback `(error: string | Error | null | undefined) => void`
1424
1425
  */
1425
1426
  this.commands.chmodFile = (socket, adapter, fileName, options, callback) => {
@@ -1449,9 +1450,9 @@ class SocketCommands {
1449
1450
  * @param socket Socket instance
1450
1451
  * @param adapter instance name, e.g. `vis.0`
1451
1452
  * @param fileName file name, e.g. `main/vis-views.json`
1452
- * @param options options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from owner.
1453
+ * @param options options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from an owner.
1453
1454
  * @param options.owner New owner, like 'system.user.user'
1454
- * @param options.ownerGroup New owner group, like 'system.group.administrator' If ownerGroup is not defined, it will be taken from owner.
1455
+ * @param options.ownerGroup New owner group, like 'system.group.administrator' If ownerGroup is not defined, it will be taken from an owner.
1455
1456
  * @param callback Callback `(error: null | undefined | Error | string) => void`
1456
1457
  */
1457
1458
  this.commands.chownFile = (socket, adapter, fileName, options, callback) => {
@@ -1523,7 +1524,7 @@ class SocketCommands {
1523
1524
  * Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
1524
1525
  *
1525
1526
  * @param socket Socket instance
1526
- * @param adapterName adapter name, e.g. `history`. To get all instances of all adapters just place here "".
1527
+ * @param adapterName adapter name, e.g. `history`. To get all instances of all adapters, just place here "".
1527
1528
  * @param callback callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
1528
1529
  */
1529
1530
  this.commands.getAdapterInstances = (socket, adapterName, callback) => {
@@ -1775,8 +1776,8 @@ class SocketCommands {
1775
1776
  };
1776
1777
  /**
1777
1778
  * #DOCUMENTATION objects
1778
- * Get all objects that are relevant for web: all states and enums with rooms.
1779
- * This is non-admin version of "all objects" and will be overloaded in admin
1779
+ * Get all objects that are relevant for the web: all states and enums with rooms.
1780
+ * This is a non-admin version of "all objects" and will be overloaded in admin
1780
1781
  *
1781
1782
  * @param socket Socket instance
1782
1783
  * @param list Optional list of IDs
@@ -2046,8 +2047,8 @@ class SocketCommands {
2046
2047
  /**
2047
2048
  * #DOCUMENTATION commands
2048
2049
  * Client subscribes to specific instance's messages.
2049
- * Client informs specific instance about subscription on its messages.
2050
- * After subscription, the socket will receive "im" messages from desired instance
2050
+ * Client informs a specific instance about subscription on its messages.
2051
+ * After subscription, the socket will receive "im" messages from the desired instance
2051
2052
  * The target instance MUST acknowledge the subscription and return result
2052
2053
  *
2053
2054
  * @param socket Socket instance
@@ -2106,6 +2107,32 @@ class SocketCommands {
2106
2107
  }
2107
2108
  SocketCommands._fixCallback(callback, null, false);
2108
2109
  };
2110
+ /**
2111
+ * #DOCUMENTATION commands
2112
+ * Get the system configuration in a compact form to save bandwidth.
2113
+ *
2114
+ * @param socket - WebSocket client instance
2115
+ * @param callback - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
2116
+ */
2117
+ this.commands.getCompactSystemConfig = (socket, callback) => {
2118
+ if (this._checkPermissions(socket, 'getObject', callback)) {
2119
+ void this.adapter.getForeignObject('system.config', { user: socket._acl?.user }, (error, obj) => {
2120
+ obj ||= {};
2121
+ const secret = obj?.native?.secret;
2122
+ const vendor = obj?.native?.vendor;
2123
+ // @ts-expect-error to save the memory
2124
+ delete obj.native;
2125
+ if (secret) {
2126
+ obj.native = { secret };
2127
+ }
2128
+ if (vendor) {
2129
+ obj.native ||= {};
2130
+ obj.native.vendor = vendor;
2131
+ }
2132
+ SocketCommands._fixCallback(callback, error, obj);
2133
+ });
2134
+ }
2135
+ };
2109
2136
  }
2110
2137
  /** Init all commands: common, objects, states, files */
2111
2138
  #initCommands() {
@@ -2115,7 +2142,7 @@ class SocketCommands {
2115
2142
  this._initCommandsFiles();
2116
2143
  }
2117
2144
  #informAboutDisconnect(socketId) {
2118
- // say to all instances, that this socket was disconnected
2145
+ // say to all instances that this socket was disconnected
2119
2146
  if (this.#clientSubscribes[socketId]) {
2120
2147
  Object.keys(this.#clientSubscribes[socketId]).forEach(targetInstance => {
2121
2148
  this.adapter.sendTo(targetInstance, 'clientUnsubscribe', {