@iobroker/socket-classes 2.2.20 → 2.3.0
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 +47 -35
- package/{dist → build}/lib/passportSocket.js +2 -1
- package/build/lib/passportSocket.js.map +1 -0
- package/{dist → build}/lib/socketAdmin.d.ts +1 -1
- package/{dist → build}/lib/socketAdmin.js +1 -1
- package/{dist → build}/lib/socketCommands.js +45 -19
- package/build/lib/socketCommands.js.map +1 -0
- package/{dist → build}/lib/socketCommandsAdmin.js +15 -43
- package/build/lib/socketCommandsAdmin.js.map +1 -0
- package/{dist → build}/lib/socketCommon.d.ts +1 -1
- package/{dist → build}/lib/socketCommon.js +1 -1
- package/{dist → build}/lib/socketCommon.js.map +1 -1
- package/package.json +23 -20
- package/dist/lib/passportSocket.js.map +0 -1
- package/dist/lib/socketCommands.js.map +0 -1
- package/dist/lib/socketCommandsAdmin.js.map +0 -1
- /package/{dist → build}/index.d.ts +0 -0
- /package/{dist → build}/index.js +0 -0
- /package/{dist → build}/index.js.map +0 -0
- /package/{dist → build}/lib/passportSocket.d.ts +0 -0
- /package/{dist → build}/lib/socketAdmin.js.map +0 -0
- /package/{dist → build}/lib/socketCommands.d.ts +0 -0
- /package/{dist → build}/lib/socketCommandsAdmin.d.ts +0 -0
- /package/{dist → build}/types.d.ts +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020-
|
|
3
|
+
Copyright (c) 2020-2026 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
|
@@ -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']`.
|
|
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']`.
|
|
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`
|
|
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
|
-
|
|
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 } } } }
|
|
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,6 +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.0 (2026-04-12)
|
|
1027
|
+
* (@GermanBluefox) Moved `getCompactSystemConfig` to common commands. Made it available in web and admin.
|
|
1028
|
+
|
|
1029
|
+
### 2.2.21 (2026-01-25)
|
|
1030
|
+
|
|
1031
|
+
* (@Copilot) Added a missing return statement for Bearer token auth
|
|
1032
|
+
|
|
1021
1033
|
### 2.2.20 (2025-07-22)
|
|
1022
1034
|
|
|
1023
1035
|
* (@GermanBluefox) Fixed change of the language in the admin
|
|
@@ -1078,7 +1090,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1078
1090
|
|
|
1079
1091
|
### 2.1.12 (2025-02-26)
|
|
1080
1092
|
|
|
1081
|
-
* (@GermanBluefox) Added login with token in the query or as bearer token
|
|
1093
|
+
* (@GermanBluefox) Added login with a token in the query or as bearer token
|
|
1082
1094
|
|
|
1083
1095
|
### 2.1.7 (2025-02-23)
|
|
1084
1096
|
* (@GermanBluefox) Added support for OAuth2 authentication
|
|
@@ -1129,7 +1141,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1129
1141
|
* (foxriver76) fixed crash on invalid patterns with js-controller version 5
|
|
1130
1142
|
|
|
1131
1143
|
### 1.3.3 (2023-08-01)
|
|
1132
|
-
* (@GermanBluefox) Implemented subscribing of a client on messages from specific instance
|
|
1144
|
+
* (@GermanBluefox) Implemented subscribing of a client on messages from a specific instance
|
|
1133
1145
|
* (@GermanBluefox) Moved checkFeatureSupported to regular connection and not only admin
|
|
1134
1146
|
|
|
1135
1147
|
### 1.2.0 (2023-07-07)
|
|
@@ -1146,7 +1158,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1146
1158
|
* (@GermanBluefox) Allow deletion of fullcalendar objects
|
|
1147
1159
|
|
|
1148
1160
|
### 1.1.1 (2022-12-22)
|
|
1149
|
-
* (@GermanBluefox) Corrected error with
|
|
1161
|
+
* (@GermanBluefox) Corrected error with subscription
|
|
1150
1162
|
|
|
1151
1163
|
### 1.1.0 (2022-12-22)
|
|
1152
1164
|
* (@GermanBluefox) Added user check to many commands
|
|
@@ -1183,7 +1195,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1183
1195
|
* (@GermanBluefox) Corrected getAdapterInstances
|
|
1184
1196
|
|
|
1185
1197
|
### 0.4.9 (2022-06-20)
|
|
1186
|
-
* (@GermanBluefox) Do not show error with failed authentication
|
|
1198
|
+
* (@GermanBluefox) Do not show an error with failed authentication
|
|
1187
1199
|
|
|
1188
1200
|
### 0.4.7 (2022-06-20)
|
|
1189
1201
|
* (@GermanBluefox) Allowed overloading system language
|
|
@@ -1195,7 +1207,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1195
1207
|
* (@GermanBluefox) allowed running socket.io behind reverse proxy
|
|
1196
1208
|
|
|
1197
1209
|
### 0.4.4 (2022-06-09)
|
|
1198
|
-
* (@GermanBluefox) Do not show requireLog message
|
|
1210
|
+
* (@GermanBluefox) Do not show the requireLog message
|
|
1199
1211
|
|
|
1200
1212
|
### 0.4.3 (2022-06-03)
|
|
1201
1213
|
* (@GermanBluefox) Allowed call of getAdapterInstances for non admin
|
|
@@ -1248,7 +1260,7 @@ Unsubscribe from file changes in ioBroker DB
|
|
|
1248
1260
|
## License
|
|
1249
1261
|
The MIT License (MIT)
|
|
1250
1262
|
|
|
1251
|
-
Copyright (c) 2020-
|
|
1263
|
+
Copyright (c) 2020-2026 @GermanBluefox <dogafox@gmail.com>
|
|
1252
1264
|
|
|
1253
1265
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1254
1266
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -56,7 +56,7 @@ function authorize(auth) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
extendedReq.cookie = parseCookie(auth, extendedReq.headers.cookie || '');
|
|
59
|
-
if (extendedReq.cookie) {
|
|
59
|
+
if (extendedReq.cookie && extendedReq.headers.cookie) {
|
|
60
60
|
extendedReq.sessionID = extendedReq.cookie['connect.sid'] || '';
|
|
61
61
|
const accessToken = extendedReq.headers.cookie.split(';').find(c => c.trim().startsWith('access_token='));
|
|
62
62
|
// Authentication with access token in cookies
|
|
@@ -106,6 +106,7 @@ function authorize(auth) {
|
|
|
106
106
|
extendedReq.user = { logged_in: true, user: tokenData.user };
|
|
107
107
|
auth.success(extendedReq, accept);
|
|
108
108
|
});
|
|
109
|
+
return;
|
|
109
110
|
}
|
|
110
111
|
// Basic authentication
|
|
111
112
|
if (auth.checkUser && !auth.noBasicAuth && extendedReq.headers.authentication?.startsWith('Basic ')) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passportSocket.js","sourceRoot":"","sources":["../../src/lib/passportSocket.ts"],"names":[],"mappings":";AAAA,yGAAyG;AACzG,0EAA0E;;AAgH1E,8BA+MC;AAxPD,SAAS,WAAW,CAChB,IAMC,EACD,YAAoB;IAEpB,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,kBAAkB;IAClB,MAAM,GAAG,GAAgB;QACrB,OAAO,EAAE;YACL,MAAM,EAAE,YAAY;SACvB;KACJ,CAAC;IAEF,IAAI,MAA0C,CAAC;IAE/C,KAAK,YAAY,CAAC,GAAsB,EAAE,EAAsB,EAAE,CAAC,GAAW,EAAQ,EAAE;QACpF,IAAI,GAAG,EAAE,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,MAAM,GAAG,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,OAAO,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,GAAuB;IACrC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,MAAM,GA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AAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,8BAA8B,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAChF,CAAC;YAED,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAEtC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,OAAO,IAAI,CAAC,IAAI,CACZ,WAAW,EACX,iEAAiE,EACjE,KAAK,EACL,MAAM,CACT,CAAC;YACN,CAAC;YAED,mBAAmB;YACnB,WAAW,CAAC,IAAI,GAAG,OAAO,CAAC,QAAiD,CAAC;YAC7E,WAAW,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAClC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -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][
|
|
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 &&
|
|
569
|
-
this.#logEnabled =
|
|
570
|
-
void this.adapter.requireLog(
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -796,7 +796,7 @@ class SocketCommands {
|
|
|
796
796
|
*
|
|
797
797
|
* @param _socket Socket instance (not used)
|
|
798
798
|
* @param text log text
|
|
799
|
-
* @param level one of `['silly', 'debug', 'info', 'warn', 'error']`.
|
|
799
|
+
* @param level one of `['silly', 'debug', 'info', 'warn', 'error']`. The default is 'debug'.
|
|
800
800
|
*/
|
|
801
801
|
this.commands.log = (_socket, text, level) => {
|
|
802
802
|
if (level === 'error') {
|
|
@@ -833,7 +833,7 @@ class SocketCommands {
|
|
|
833
833
|
};
|
|
834
834
|
/**
|
|
835
835
|
* #DOCUMENTATION commands
|
|
836
|
-
* Get history data from specific instance
|
|
836
|
+
* Get the history data from the specific instance
|
|
837
837
|
*
|
|
838
838
|
* @param socket Socket instance
|
|
839
839
|
* @param id object ID
|
|
@@ -1261,7 +1261,7 @@ class SocketCommands {
|
|
|
1261
1261
|
};
|
|
1262
1262
|
/**
|
|
1263
1263
|
* #DOCUMENTATION files
|
|
1264
|
-
* Delete file in ioBroker DB
|
|
1264
|
+
* Delete a file in ioBroker DB
|
|
1265
1265
|
*
|
|
1266
1266
|
* @param socket Socket instance
|
|
1267
1267
|
* @param adapter instance name, e.g. `vis.0`
|
|
@@ -1389,7 +1389,7 @@ class SocketCommands {
|
|
|
1389
1389
|
};
|
|
1390
1390
|
/**
|
|
1391
1391
|
* #DOCUMENTATION files
|
|
1392
|
-
* Read content of folder in ioBroker DB
|
|
1392
|
+
* Read the content of the folder in ioBroker DB
|
|
1393
1393
|
*
|
|
1394
1394
|
* @param socket Socket instance
|
|
1395
1395
|
* @param adapter instance name, e.g. `vis.0`
|
|
@@ -1419,7 +1419,7 @@ class SocketCommands {
|
|
|
1419
1419
|
* @param adapter instance name, e.g. `vis.0`
|
|
1420
1420
|
* @param fileName file name, e.g. `main/vis-views.json`
|
|
1421
1421
|
* @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`
|
|
1422
|
+
* @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
1423
|
* @param callback Callback `(error: string | Error | null | undefined) => void`
|
|
1424
1424
|
*/
|
|
1425
1425
|
this.commands.chmodFile = (socket, adapter, fileName, options, callback) => {
|
|
@@ -1449,9 +1449,9 @@ class SocketCommands {
|
|
|
1449
1449
|
* @param socket Socket instance
|
|
1450
1450
|
* @param adapter instance name, e.g. `vis.0`
|
|
1451
1451
|
* @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.
|
|
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 an owner.
|
|
1453
1453
|
* @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.
|
|
1454
|
+
* @param options.ownerGroup New owner group, like 'system.group.administrator' If ownerGroup is not defined, it will be taken from an owner.
|
|
1455
1455
|
* @param callback Callback `(error: null | undefined | Error | string) => void`
|
|
1456
1456
|
*/
|
|
1457
1457
|
this.commands.chownFile = (socket, adapter, fileName, options, callback) => {
|
|
@@ -1523,7 +1523,7 @@ class SocketCommands {
|
|
|
1523
1523
|
* Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
|
|
1524
1524
|
*
|
|
1525
1525
|
* @param socket Socket instance
|
|
1526
|
-
* @param adapterName adapter name, e.g. `history`. To get all instances of all adapters just place here "".
|
|
1526
|
+
* @param adapterName adapter name, e.g. `history`. To get all instances of all adapters, just place here "".
|
|
1527
1527
|
* @param callback callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
|
|
1528
1528
|
*/
|
|
1529
1529
|
this.commands.getAdapterInstances = (socket, adapterName, callback) => {
|
|
@@ -1775,8 +1775,8 @@ class SocketCommands {
|
|
|
1775
1775
|
};
|
|
1776
1776
|
/**
|
|
1777
1777
|
* #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
|
|
1778
|
+
* Get all objects that are relevant for the web: all states and enums with rooms.
|
|
1779
|
+
* This is a non-admin version of "all objects" and will be overloaded in admin
|
|
1780
1780
|
*
|
|
1781
1781
|
* @param socket Socket instance
|
|
1782
1782
|
* @param list Optional list of IDs
|
|
@@ -2046,8 +2046,8 @@ class SocketCommands {
|
|
|
2046
2046
|
/**
|
|
2047
2047
|
* #DOCUMENTATION commands
|
|
2048
2048
|
* 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
|
|
2049
|
+
* Client informs a specific instance about subscription on its messages.
|
|
2050
|
+
* After subscription, the socket will receive "im" messages from the desired instance
|
|
2051
2051
|
* The target instance MUST acknowledge the subscription and return result
|
|
2052
2052
|
*
|
|
2053
2053
|
* @param socket Socket instance
|
|
@@ -2106,6 +2106,32 @@ class SocketCommands {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
SocketCommands._fixCallback(callback, null, false);
|
|
2108
2108
|
};
|
|
2109
|
+
/**
|
|
2110
|
+
* #DOCUMENTATION commands
|
|
2111
|
+
* Get the system configuration in a compact form to save bandwidth.
|
|
2112
|
+
*
|
|
2113
|
+
* @param socket - WebSocket client instance
|
|
2114
|
+
* @param callback - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
|
|
2115
|
+
*/
|
|
2116
|
+
this.commands.getCompactSystemConfig = (socket, callback) => {
|
|
2117
|
+
if (this._checkPermissions(socket, 'getObject', callback)) {
|
|
2118
|
+
void this.adapter.getForeignObject('system.config', { user: socket._acl?.user }, (error, obj) => {
|
|
2119
|
+
obj ||= {};
|
|
2120
|
+
const secret = obj?.native?.secret;
|
|
2121
|
+
const vendor = obj?.native?.vendor;
|
|
2122
|
+
// @ts-expect-error to save the memory
|
|
2123
|
+
delete obj.native;
|
|
2124
|
+
if (secret) {
|
|
2125
|
+
obj.native = { secret };
|
|
2126
|
+
}
|
|
2127
|
+
if (vendor) {
|
|
2128
|
+
obj.native ||= {};
|
|
2129
|
+
obj.native.vendor = vendor;
|
|
2130
|
+
}
|
|
2131
|
+
SocketCommands._fixCallback(callback, error, obj);
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2109
2135
|
}
|
|
2110
2136
|
/** Init all commands: common, objects, states, files */
|
|
2111
2137
|
#initCommands() {
|
|
@@ -2115,7 +2141,7 @@ class SocketCommands {
|
|
|
2115
2141
|
this._initCommandsFiles();
|
|
2116
2142
|
}
|
|
2117
2143
|
#informAboutDisconnect(socketId) {
|
|
2118
|
-
// say to all instances
|
|
2144
|
+
// say to all instances that this socket was disconnected
|
|
2119
2145
|
if (this.#clientSubscribes[socketId]) {
|
|
2120
2146
|
Object.keys(this.#clientSubscribes[socketId]).forEach(targetInstance => {
|
|
2121
2147
|
this.adapter.sendTo(targetInstance, 'clientUnsubscribe', {
|