@iobroker/socket-classes 1.6.1 → 2.0.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 +840 -821
- package/dist/index.d.ts +7 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/passportSocket.d.ts +37 -0
- package/{lib → dist/lib}/passportSocket.js +25 -42
- package/dist/lib/passportSocket.js.map +1 -0
- package/dist/lib/socketCommands.d.ts +83 -0
- package/dist/lib/socketCommands.js +2024 -0
- package/dist/lib/socketCommands.js.map +1 -0
- package/dist/lib/socketCommandsAdmin.d.ts +139 -0
- package/dist/lib/socketCommandsAdmin.js +1584 -0
- package/dist/lib/socketCommandsAdmin.js.map +1 -0
- package/dist/lib/socketCommon.d.ts +141 -0
- package/dist/lib/socketCommon.js +496 -0
- package/dist/lib/socketCommon.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/package.json +24 -18
- package/index.js +0 -19
- package/lib/socketAdmin.js +0 -201
- package/lib/socketCommands.js +0 -1884
- package/lib/socketCommandsAdmin.js +0 -1492
- package/lib/socketCommon.js +0 -480
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import passport from 'passport';
|
|
2
|
+
import cookieParser from 'cookie-parser';
|
|
3
|
+
export { SocketCommandsAdmin } from './lib/socketCommandsAdmin';
|
|
4
|
+
export { SocketCommands, type SupportedFeature } from './lib/socketCommands';
|
|
5
|
+
export { SocketCommon } from './lib/socketCommon';
|
|
6
|
+
import { authorize as passportSocket } from './lib/passportSocket';
|
|
7
|
+
export { passport, cookieParser, passportSocket };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.passportSocket = exports.cookieParser = exports.passport = exports.SocketCommon = exports.SocketCommands = exports.SocketCommandsAdmin = void 0;
|
|
7
|
+
const passport_1 = __importDefault(require("passport"));
|
|
8
|
+
exports.passport = passport_1.default;
|
|
9
|
+
const cookie_parser_1 = __importDefault(require("cookie-parser"));
|
|
10
|
+
exports.cookieParser = cookie_parser_1.default;
|
|
11
|
+
var socketCommandsAdmin_1 = require("./lib/socketCommandsAdmin");
|
|
12
|
+
Object.defineProperty(exports, "SocketCommandsAdmin", { enumerable: true, get: function () { return socketCommandsAdmin_1.SocketCommandsAdmin; } });
|
|
13
|
+
var socketCommands_1 = require("./lib/socketCommands");
|
|
14
|
+
Object.defineProperty(exports, "SocketCommands", { enumerable: true, get: function () { return socketCommands_1.SocketCommands; } });
|
|
15
|
+
var socketCommon_1 = require("./lib/socketCommon");
|
|
16
|
+
Object.defineProperty(exports, "SocketCommon", { enumerable: true, get: function () { return socketCommon_1.SocketCommon; } });
|
|
17
|
+
const passportSocket_1 = require("./lib/passportSocket");
|
|
18
|
+
Object.defineProperty(exports, "passportSocket", { enumerable: true, get: function () { return passportSocket_1.authorize; } });
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAMvB,mBANF,kBAAQ,CAME;AALjB,kEAAyC;AAKtB,uBALZ,uBAAY,CAKY;AAJ/B,iEAAgE;AAAvD,0HAAA,mBAAmB,OAAA;AAC5B,uDAA6E;AAApE,gHAAA,cAAc,OAAA;AACvB,mDAAkD;AAAzC,4GAAA,YAAY,OAAA;AACrB,yDAAmE;AAClC,+FADX,0BAAc,OACW"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface AuthRequest {
|
|
2
|
+
signedCookies?: Record<string, string>;
|
|
3
|
+
cookies?: Record<string, string>;
|
|
4
|
+
headers: {
|
|
5
|
+
cookie: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface Store {
|
|
9
|
+
get: (key: string, cb: (err: Error, session: Record<string, {
|
|
10
|
+
user: {
|
|
11
|
+
logged_in: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>) => void) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function authorize(options: {
|
|
16
|
+
passport: {
|
|
17
|
+
_key: string;
|
|
18
|
+
};
|
|
19
|
+
cookieParser: (secret: string | null) => (req: AuthRequest, options: Record<string, any>, cb: (err: string) => void) => void;
|
|
20
|
+
checkUser?: (user: string, pass: string, cb: (error: Error | null, result?: {
|
|
21
|
+
logged_in: boolean;
|
|
22
|
+
}) => void) => void;
|
|
23
|
+
fail: (data: any, message: string, critical: boolean, accept: (err: Error | null) => void) => void;
|
|
24
|
+
success: (data: any, accept: (err: Error | null) => void) => void;
|
|
25
|
+
}): (data: {
|
|
26
|
+
headers: {
|
|
27
|
+
cookie: string;
|
|
28
|
+
};
|
|
29
|
+
url: string;
|
|
30
|
+
query: Record<string, string>;
|
|
31
|
+
cookie: Record<string, string> | undefined;
|
|
32
|
+
sessionID: string;
|
|
33
|
+
user: {
|
|
34
|
+
logged_in: boolean;
|
|
35
|
+
};
|
|
36
|
+
}, accept: (err: Error | null) => void) => void;
|
|
37
|
+
export {};
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Originally taken from here: https://github.com/jfromaniello/passport.socketio/blob/master/lib/index.js
|
|
2
3
|
// Copyright Licensed under the MIT-License. 2012-2013 José F. Romaniello.
|
|
3
|
-
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.authorize = authorize;
|
|
4
6
|
function parseCookie(auth, cookieHeader) {
|
|
5
7
|
const cookieParser = auth.cookieParser(auth.secret);
|
|
6
8
|
const req = {
|
|
7
9
|
headers: {
|
|
8
|
-
cookie: cookieHeader
|
|
9
|
-
}
|
|
10
|
+
cookie: cookieHeader,
|
|
11
|
+
},
|
|
10
12
|
};
|
|
11
|
-
|
|
12
13
|
let result;
|
|
13
|
-
|
|
14
14
|
cookieParser(req, {}, err => {
|
|
15
15
|
if (err) {
|
|
16
|
-
throw err;
|
|
16
|
+
throw new Error(err);
|
|
17
17
|
}
|
|
18
18
|
result = req.signedCookies || req.cookies;
|
|
19
19
|
});
|
|
20
|
-
|
|
21
20
|
return result;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function getQuery(url) {
|
|
25
23
|
const query = url.split('?')[1] || '';
|
|
26
24
|
const parts = query.split('&');
|
|
@@ -31,75 +29,60 @@ function getQuery(url) {
|
|
|
31
29
|
}
|
|
32
30
|
return result;
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
function authorize(options) {
|
|
36
33
|
const defaults = {
|
|
37
34
|
key: 'connect.sid',
|
|
38
35
|
secret: null,
|
|
39
36
|
store: null,
|
|
40
|
-
userProperty: 'user'
|
|
37
|
+
userProperty: 'user',
|
|
41
38
|
};
|
|
42
|
-
|
|
43
39
|
const auth = Object.assign({}, defaults, options);
|
|
44
|
-
|
|
45
40
|
if (!auth.passport) {
|
|
46
41
|
throw new Error("passport is required to use require('passport'), please install passport");
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
if (!auth.cookieParser) {
|
|
50
|
-
throw new Error(
|
|
51
|
-
"cookieParser is required use require('cookie-parser'), connect.cookieParser or express.cookieParser"
|
|
52
|
-
);
|
|
44
|
+
throw new Error("cookieParser is required use require('cookie-parser'), connect.cookieParser or express.cookieParser");
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
return function (data, accept) {
|
|
56
47
|
data.query = getQuery(data.url);
|
|
57
|
-
|
|
58
48
|
if (options.checkUser && data.query.user && data.query.pass) {
|
|
59
49
|
return options.checkUser(data.query.user, data.query.pass, (error, result) => {
|
|
60
50
|
if (error) {
|
|
61
51
|
return auth.fail(data, 'Cannot check user', false, accept);
|
|
62
|
-
}
|
|
52
|
+
}
|
|
53
|
+
if (!result) {
|
|
63
54
|
return auth.fail(data, 'User not found', false, accept);
|
|
64
|
-
} else {
|
|
65
|
-
data[auth.userProperty] = result;
|
|
66
|
-
data[auth.userProperty].logged_in = true;
|
|
67
|
-
auth.success(data, accept);
|
|
68
55
|
}
|
|
56
|
+
data[auth.userProperty] = result;
|
|
57
|
+
data[auth.userProperty].logged_in = true;
|
|
58
|
+
auth.success(data, accept);
|
|
69
59
|
});
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
data.cookie = parseCookie(auth, data.headers.cookie || '');
|
|
73
|
-
|
|
62
|
+
if (data.cookie) {
|
|
63
|
+
data.sessionID = data.cookie[auth.key] || '';
|
|
64
|
+
}
|
|
74
65
|
data[auth.userProperty] = {
|
|
75
|
-
logged_in: false
|
|
66
|
+
logged_in: false,
|
|
76
67
|
};
|
|
77
|
-
|
|
78
|
-
auth.store.get(data.sessionID, (err, session) => {
|
|
68
|
+
auth.store?.get(data.sessionID, (err, session) => {
|
|
79
69
|
if (err) {
|
|
80
|
-
return auth.fail(data,
|
|
81
|
-
}
|
|
70
|
+
return auth.fail(data, `Error in session store:\n${err.message}`, true, accept);
|
|
71
|
+
}
|
|
72
|
+
if (!session) {
|
|
82
73
|
return auth.fail(data, 'No session found', false, accept);
|
|
83
|
-
}
|
|
74
|
+
}
|
|
75
|
+
if (!session[auth.passport._key]) {
|
|
84
76
|
return auth.fail(data, 'Passport was not initialized', true, accept);
|
|
85
77
|
}
|
|
86
|
-
|
|
87
78
|
const userKey = session[auth.passport._key].user;
|
|
88
|
-
|
|
89
79
|
if (typeof userKey === 'undefined') {
|
|
90
|
-
return auth.fail(
|
|
91
|
-
data,
|
|
92
|
-
'User not authorized through passport. (User Property not found)',
|
|
93
|
-
false,
|
|
94
|
-
accept
|
|
95
|
-
);
|
|
80
|
+
return auth.fail(data, 'User not authorized through passport. (User Property not found)', false, accept);
|
|
96
81
|
}
|
|
97
|
-
|
|
98
82
|
data[auth.userProperty] = userKey;
|
|
99
83
|
data[auth.userProperty].logged_in = true;
|
|
100
84
|
auth.success(data, accept);
|
|
101
85
|
});
|
|
102
86
|
};
|
|
103
87
|
}
|
|
104
|
-
|
|
105
|
-
exports.authorize = authorize;
|
|
88
|
+
//# sourceMappingURL=passportSocket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passportSocket.js","sourceRoot":"","sources":["../../src/lib/passportSocket.ts"],"names":[],"mappings":";AAAA,yGAAyG;AACzG,0EAA0E;;AAqD1E,8BAiHC;AAxJD,SAAS,WAAW,CAChB,IAKC,EACD,YAAoB;IAEpB,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,GAAG,GAAgB;QACrB,OAAO,EAAE;YACL,MAAM,EAAE,YAAY;SACvB;KACJ,CAAC;IAEF,IAAI,MAA0C,CAAC;IAE/C,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE;QACxB,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,GAAW;IACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,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,GAAG,KAAK,CAAC,CAAC,C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AM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;YAEjD,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC,IAAI,CACZ,IAAI,EACJ,iEAAiE,EACjE,KAAK,EACL,MAAM,CACT,CAAC;YACN,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Socket as WebSocketClient } from '@iobroker/ws-server';
|
|
2
|
+
import { type PermissionCommands, type SocketSubscribeTypes, type SocketOperation, type SocketCallback } from '../types';
|
|
3
|
+
export declare const COMMANDS_PERMISSIONS: Record<PermissionCommands, {
|
|
4
|
+
type: 'object' | 'state' | 'users' | 'other' | 'file' | '';
|
|
5
|
+
operation: SocketOperation;
|
|
6
|
+
}>;
|
|
7
|
+
export type AdapterRating = {
|
|
8
|
+
rating: {
|
|
9
|
+
r: number;
|
|
10
|
+
c: number;
|
|
11
|
+
};
|
|
12
|
+
[version: string]: {
|
|
13
|
+
r: number;
|
|
14
|
+
c: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type Ratings = {
|
|
18
|
+
[adapterName: string]: AdapterRating;
|
|
19
|
+
} & {
|
|
20
|
+
uuid: string;
|
|
21
|
+
};
|
|
22
|
+
export type SupportedFeature = 'ALIAS' | 'ALIAS_SEPARATE_READ_WRITE_ID' | 'ADAPTER_GETPORT_BIND' | 'ADAPTER_DEL_OBJECT_RECURSIVE' | 'ADAPTER_SET_OBJECT_SETS_DEFAULT_VALUE' | 'ADAPTER_AUTO_DECRYPT_NATIVE' | 'PLUGINS' | 'CONTROLLER_NPM_AUTO_REBUILD' | 'CONTROLLER_READWRITE_BASE_SETTINGS' | 'CONTROLLER_MULTI_REPO' | 'CONTROLLER_LICENSE_MANAGER' | 'CONTROLLER_OS_PACKAGE_UPGRADE' | 'DEL_INSTANCE_CUSTOM' | 'CUSTOM_FULL_VIEW' | 'ADAPTER_GET_OBJECTS_BY_ARRAY' | 'CONTROLLER_UI_UPGRADE' | 'ADAPTER_WEBSERVER_UPGRADE' | 'INSTANCE_MESSAGES' | 'PARTIAL_OBJECT_TREE';
|
|
23
|
+
export interface SocketDataContext {
|
|
24
|
+
language: ioBroker.Languages;
|
|
25
|
+
ratings: Ratings | null;
|
|
26
|
+
ratingTimeout: NodeJS.Timeout | null;
|
|
27
|
+
}
|
|
28
|
+
export declare class SocketCommands {
|
|
29
|
+
#private;
|
|
30
|
+
static ERROR_PERMISSION: string;
|
|
31
|
+
static COMMANDS_PERMISSIONS: Record<string, {
|
|
32
|
+
type: 'object' | 'state' | 'users' | 'other' | 'file' | '';
|
|
33
|
+
operation: SocketOperation;
|
|
34
|
+
}>;
|
|
35
|
+
protected adapter: ioBroker.Adapter;
|
|
36
|
+
protected context: SocketDataContext;
|
|
37
|
+
protected commands: Record<string, (socket: WebSocketClient, ...args: any[]) => void>;
|
|
38
|
+
protected subscribes: Record<string, Record<string, number>>;
|
|
39
|
+
adapterName: string | undefined;
|
|
40
|
+
protected _sendToHost: ((id: string, command: string, data: any, callback: (result: {
|
|
41
|
+
error?: string;
|
|
42
|
+
result?: any;
|
|
43
|
+
}) => void) => void) | null;
|
|
44
|
+
states: Record<string, ioBroker.State> | null;
|
|
45
|
+
constructor(adapter: ioBroker.Adapter, updateSession: (socket: WebSocketClient) => boolean, context: SocketDataContext);
|
|
46
|
+
/**
|
|
47
|
+
* Convert errors into strings and then call cb
|
|
48
|
+
*
|
|
49
|
+
* @param callback Callback function
|
|
50
|
+
* @param error Error
|
|
51
|
+
* @param args Arguments passed to callback
|
|
52
|
+
*/
|
|
53
|
+
static _fixCallback(callback: SocketCallback | null | undefined, error: string | Error | null | undefined, ...args: any[]): void;
|
|
54
|
+
_checkPermissions(socket: WebSocketClient, command: PermissionCommands, callback: ((error: string | null, ...args: any[]) => void) | undefined, ...args: any[]): boolean;
|
|
55
|
+
publish(socket: WebSocketClient, type: SocketSubscribeTypes, id: string, obj: ioBroker.Object | ioBroker.State): boolean;
|
|
56
|
+
publishFile(socket: WebSocketClient, id: string, fileName: string, size: number): boolean;
|
|
57
|
+
publishInstanceMessage(socket: WebSocketClient, sourceInstance: string, messageType: string, data: any): boolean;
|
|
58
|
+
_showSubscribes(socket: WebSocketClient, type: SocketSubscribeTypes): void;
|
|
59
|
+
isLogEnabled(): boolean;
|
|
60
|
+
subscribe(socket: WebSocketClient, type: SocketSubscribeTypes, pattern: string, patternFile?: string): void;
|
|
61
|
+
unsubscribe(socket: WebSocketClient, type: SocketSubscribeTypes, pattern: string, patternFile?: string): void;
|
|
62
|
+
subscribeSocket(socket: WebSocketClient, type?: SocketSubscribeTypes): void;
|
|
63
|
+
unsubscribeSocket(socket: WebSocketClient, type?: SocketSubscribeTypes): void;
|
|
64
|
+
_unsubscribeFiles(socket: WebSocketClient, id: string, pattern: string | string[], callback?: (error: string | null) => void): void;
|
|
65
|
+
addCommandHandler(command: string, handler: (socket: WebSocketClient, ...args: any[]) => void): void;
|
|
66
|
+
getCommandHandler(command: string): (socket: WebSocketClient, ...args: any[]) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Converts old structures of config definitions into new one - `adminUI`
|
|
69
|
+
*
|
|
70
|
+
* @param obj Instance or adapter object to be converted
|
|
71
|
+
*/
|
|
72
|
+
protected fixAdminUI(obj: ioBroker.AdapterObject | ioBroker.InstanceObject): void;
|
|
73
|
+
protected _initCommandsCommon(): void;
|
|
74
|
+
/** Init commands for files */
|
|
75
|
+
protected _initCommandsFiles(): void;
|
|
76
|
+
/** Init commands for states */
|
|
77
|
+
protected _initCommandsStates(): void;
|
|
78
|
+
/** Init commands for objects */
|
|
79
|
+
protected _initCommandsObjects(): void;
|
|
80
|
+
applyCommands(socket: WebSocketClient): void;
|
|
81
|
+
disableEventThreshold(): void;
|
|
82
|
+
destroy(): void;
|
|
83
|
+
}
|