fcr-core 3.10.5 → 3.10.6
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/lib/engine/index.js +108 -102
- package/lib/imports.js +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/media-control/desktop.js +13 -22
- package/lib/media-control/mobile.js +13 -22
- package/lib/monitor-control/index.js +7 -17
- package/lib/peer-session/index.js +121 -120
- package/lib/plugins/chat/chatroom.js +96 -119
- package/lib/plugins/chat/connector.js +48 -69
- package/lib/remote-control/index.js +216 -194
- package/lib/room-control/ability-control/index.js +10 -20
- package/lib/room-control/application-control/index.js +75 -82
- package/lib/room-control/group-control/index.js +30 -31
- package/lib/room-control/helpers/board-init-info-helper.js +10 -16
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +51 -70
- package/lib/room-control/infinity-room-control/index.js +19 -27
- package/lib/room-control/interpreter-control/index.js +65 -77
- package/lib/room-control/interpreter-control/room.js +4 -6
- package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
- package/lib/room-control/mainroom-control/index.js +25 -37
- package/lib/room-control/privilege-control/helper.js +13 -28
- package/lib/room-control/privilege-control/index.js +28 -36
- package/lib/room-control/room-connector-control/index.js +47 -52
- package/lib/room-control/room-control-factory.js +12 -10
- package/lib/room-control/room-session/index.js +74 -77
- package/lib/room-control/shared-cache.js +56 -63
- package/lib/room-control/sharing-control/index.js +57 -65
- package/lib/room-control/stream-control/index.js +238 -203
- package/lib/room-control/stream-control/type.d.ts +11 -1
- package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib/room-control/stt-control/index.js +86 -93
- package/lib/room-control/user-control/index.js +155 -162
- package/lib/room-control/waitingroom-control/index.js +9 -18
- package/lib/room-control/whiteboard-control/utils.js +2 -4
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib/room-control/whiteboard-control-v1/board-window.js +103 -120
- package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
- package/lib/room-control/whiteboard-control-v1/index.js +67 -80
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
- package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +10 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -17
- package/lib/room-control/whiteboard-control-v2/base/index.js +53 -61
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +30 -39
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -27
- package/lib/room-control/widget-control/index.js +33 -43
- package/lib/room-router/index.js +58 -66
- package/lib/service/api.js +548 -446
- package/lib/struct.js +2 -5
- package/lib/type.d.ts +1 -1
- package/lib/utilities/abortable-retry.js +0 -3
- package/lib/utilities/collection.js +11 -15
- package/lib/utilities/error-helpers.js +27 -34
- package/lib/utilities/error.js +3 -4
- package/lib/utilities/join-helper.js +31 -37
- package/lib/utilities/logger.js +5 -8
- package/lib/utilities/parameters.js +10 -21
- package/lib/utilities/retry-helpers.js +0 -1
- package/lib/utilities/stream.js +11 -16
- package/lib/utilities/user.js +3 -4
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.js +5 -10
- package/lib-es/engine/index.js +108 -102
- package/lib-es/media-control/desktop.js +13 -22
- package/lib-es/media-control/mobile.js +13 -22
- package/lib-es/monitor-control/index.js +7 -16
- package/lib-es/peer-session/index.js +121 -120
- package/lib-es/plugins/chat/chatroom.js +95 -118
- package/lib-es/plugins/chat/connector.js +47 -67
- package/lib-es/remote-control/index.js +216 -194
- package/lib-es/room-control/ability-control/index.js +10 -19
- package/lib-es/room-control/application-control/index.js +75 -81
- package/lib-es/room-control/group-control/index.js +30 -31
- package/lib-es/room-control/helpers/board-init-info-helper.js +10 -15
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +51 -69
- package/lib-es/room-control/infinity-room-control/index.js +19 -26
- package/lib-es/room-control/interpreter-control/index.js +65 -77
- package/lib-es/room-control/interpreter-control/room.js +4 -5
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -5
- package/lib-es/room-control/mainroom-control/index.js +25 -37
- package/lib-es/room-control/privilege-control/helper.js +13 -27
- package/lib-es/room-control/privilege-control/index.js +28 -36
- package/lib-es/room-control/room-connector-control/index.js +47 -52
- package/lib-es/room-control/room-control-factory.js +12 -10
- package/lib-es/room-control/room-session/index.js +74 -77
- package/lib-es/room-control/shared-cache.js +56 -62
- package/lib-es/room-control/sharing-control/index.js +57 -64
- package/lib-es/room-control/stream-control/index.js +240 -205
- package/lib-es/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib-es/room-control/stt-control/index.js +86 -93
- package/lib-es/room-control/user-control/index.js +155 -162
- package/lib-es/room-control/waitingroom-control/index.js +9 -18
- package/lib-es/room-control/whiteboard-control/utils.js +2 -4
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +103 -120
- package/lib-es/room-control/whiteboard-control-v1/factory.js +4 -6
- package/lib-es/room-control/whiteboard-control-v1/index.js +67 -80
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +2 -3
- package/lib-es/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +10 -13
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +8 -16
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +53 -60
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +30 -39
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +33 -45
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +11 -26
- package/lib-es/room-control/widget-control/index.js +33 -42
- package/lib-es/room-router/index.js +58 -66
- package/lib-es/service/api.js +548 -445
- package/lib-es/struct.js +2 -4
- package/lib-es/utilities/abortable-retry.js +0 -3
- package/lib-es/utilities/collection.js +11 -14
- package/lib-es/utilities/error-helpers.js +26 -33
- package/lib-es/utilities/error.js +3 -4
- package/lib-es/utilities/join-helper.js +29 -36
- package/lib-es/utilities/logger.js +5 -7
- package/lib-es/utilities/parameters.js +10 -21
- package/lib-es/utilities/retry-helpers.js +0 -1
- package/lib-es/utilities/stream.js +11 -15
- package/lib-es/utilities/user.js +3 -4
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +5 -10
- package/package.json +4 -4
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
|
5
3
|
require("core-js/modules/es.array.push.js");
|
|
6
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -19,7 +17,6 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
19
17
|
require("core-js/modules/esnext.map.some.js");
|
|
20
18
|
require("core-js/modules/esnext.map.update.js");
|
|
21
19
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
20
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
24
21
|
Object.defineProperty(exports, "__esModule", {
|
|
25
22
|
value: true
|
|
@@ -28,8 +25,6 @@ exports.FcrInterpreterControlImpl = void 0;
|
|
|
28
25
|
require("core-js/modules/es.array.includes.js");
|
|
29
26
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
30
27
|
require("core-js/modules/esnext.iterator.map.js");
|
|
31
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
32
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
33
28
|
var _imports = require("../../imports");
|
|
34
29
|
var _room = require("./room");
|
|
35
30
|
var _types = require("./types");
|
|
@@ -39,8 +34,7 @@ var _logger = require("../../utilities/logger");
|
|
|
39
34
|
var _error = require("../../utilities/error");
|
|
40
35
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
41
36
|
var _schema = require("../../schema");
|
|
42
|
-
|
|
43
|
-
let _initProto, _createRoomControlDecs, _setInterpreterUsersDecs, _ref;
|
|
37
|
+
let _initProto, _createRoomControlDecs, _setInterpreterUsersDecs;
|
|
44
38
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
45
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
46
40
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -49,44 +43,45 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
49
43
|
/**
|
|
50
44
|
* @internal
|
|
51
45
|
*/
|
|
52
|
-
_ref = (_createRoomControlDecs = [(0, _imports.trace)(['roomId']), (0, _validateParams.default)(_schema.stringSchema)], _setInterpreterUsersDecs = [(0, _imports.trace)(['params']), (0, _validateParams.default)(_schema.fcrInterpreterUsersParamsArraySchema)], "logger");
|
|
53
46
|
class FcrInterpreterControlImpl {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
47
|
+
static {
|
|
48
|
+
[_initProto] = _applyDecs(this, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getState"], [_imports.trace, 2, "getInterpreterRoomList"], [_imports.trace, 2, "getInterpreterLanguageList"], [_imports.trace, 2, "release"]], []).e;
|
|
49
|
+
}
|
|
50
|
+
//@internal
|
|
51
|
+
[(_createRoomControlDecs = [(0, _imports.trace)(['roomId']), (0, _validateParams.default)(_schema.stringSchema)], _setInterpreterUsersDecs = [(0, _imports.trace)(['params']), (0, _validateParams.default)(_schema.fcrInterpreterUsersParamsArraySchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
52
|
+
prefix: 'FcrInterpreterControlImpl'
|
|
53
|
+
}));
|
|
54
|
+
_observable = new _imports.AgoraObservable();
|
|
55
|
+
_interpreterUserList = null;
|
|
56
|
+
_sceneObserver = {
|
|
57
|
+
onScenePropertiesUpdated: (_, event) => {
|
|
58
|
+
if (event.cause?.cmd === 800) {
|
|
59
|
+
const actionType = (0, _imports.get)(event.cause.data, 'actionType');
|
|
60
|
+
let operatorUser;
|
|
61
|
+
if (event.operatorUser) {
|
|
62
|
+
operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
63
|
+
}
|
|
64
|
+
const isStateUpdated = [_types.FcrInterpreterActionType.OPEN, _types.FcrInterpreterActionType.CLOSE].includes(actionType);
|
|
65
|
+
const isUpdated = [
|
|
66
|
+
// FcrInterpreterActionType.OPEN,
|
|
67
|
+
_types.FcrInterpreterActionType.UPDATE].includes(actionType);
|
|
68
|
+
if (isStateUpdated || isUpdated) {
|
|
69
|
+
this._setInterpreterUserList();
|
|
70
|
+
}
|
|
71
|
+
if (isStateUpdated) {
|
|
72
|
+
this._observable.notifyObservers('onInterpreterStateUpdated', this._roomId, this.getState(), operatorUser);
|
|
73
|
+
}
|
|
74
|
+
if (isUpdated) {
|
|
75
|
+
this._observable.notifyObservers('onInterpreterUsersUpdated', this._roomId, this.getInterpreterUserList(), operatorUser);
|
|
76
|
+
this._observable.notifyObservers('onInterpreterRoomListUpdated', this._roomId, this.getInterpreterRoomList(), operatorUser);
|
|
84
77
|
}
|
|
85
|
-
},
|
|
86
|
-
onJoinSceneSuccess: () => {
|
|
87
|
-
this._setInterpreterUserList();
|
|
88
78
|
}
|
|
89
|
-
}
|
|
79
|
+
},
|
|
80
|
+
onJoinSceneSuccess: () => {
|
|
81
|
+
this._setInterpreterUserList();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
constructor(_api, _scene, _config, _engine, _chatConnection, _sharedCache) {
|
|
90
85
|
this._api = _api;
|
|
91
86
|
this._scene = _scene;
|
|
92
87
|
this._config = _config;
|
|
@@ -107,10 +102,11 @@ class FcrInterpreterControlImpl {
|
|
|
107
102
|
await (0, _error.handleRequestError)(() => this._api.openInterpreter({
|
|
108
103
|
roomId: this._roomId,
|
|
109
104
|
data: {
|
|
110
|
-
interpreters: params.map(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
interpreters: params.map(({
|
|
106
|
+
userId: userUuid,
|
|
107
|
+
sourceLanguage,
|
|
108
|
+
targetLanguage
|
|
109
|
+
}) => {
|
|
114
110
|
return {
|
|
115
111
|
userUuid,
|
|
116
112
|
languagePair: [sourceLanguage, targetLanguage]
|
|
@@ -134,34 +130,31 @@ class FcrInterpreterControlImpl {
|
|
|
134
130
|
}
|
|
135
131
|
getInterpreterRoomList() {
|
|
136
132
|
const rooms = this._scene.getScenePropertiesByKeyPath('interpreter.rooms') || [];
|
|
137
|
-
return rooms.length > 0 ? rooms.map(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}) : null;
|
|
133
|
+
return rooms.length > 0 ? rooms.map(({
|
|
134
|
+
roomUuid,
|
|
135
|
+
language
|
|
136
|
+
}) => ({
|
|
137
|
+
roomId: roomUuid,
|
|
138
|
+
language
|
|
139
|
+
})) : null;
|
|
145
140
|
}
|
|
146
141
|
_setInterpreterUserList() {
|
|
147
142
|
const interpreter = this._scene.getScenePropertiesByKeyPath('interpreter');
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
translates
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
};
|
|
164
|
-
});
|
|
143
|
+
const {
|
|
144
|
+
translates
|
|
145
|
+
} = interpreter || {
|
|
146
|
+
translates: []
|
|
147
|
+
};
|
|
148
|
+
const results = translates.map(({
|
|
149
|
+
userUuid: userId,
|
|
150
|
+
userName,
|
|
151
|
+
languagePair: [sourceLanguage, targetLanguage]
|
|
152
|
+
}) => ({
|
|
153
|
+
userId,
|
|
154
|
+
userName,
|
|
155
|
+
sourceLanguage,
|
|
156
|
+
targetLanguage
|
|
157
|
+
}));
|
|
165
158
|
this._interpreterUserList = results.length > 0 ? results : null;
|
|
166
159
|
}
|
|
167
160
|
getInterpreterUserList() {
|
|
@@ -188,9 +181,4 @@ class FcrInterpreterControlImpl {
|
|
|
188
181
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onInterpreterStateUpdated', ['roomId', 'state', 'operatorUser']], ['onInterpreterUsersUpdated', ['roomId', 'users', 'operatorUser']], ['onInterpreterRoomListUpdated', ['roomId', 'rooms', 'operatorUser']]]));
|
|
189
182
|
}
|
|
190
183
|
}
|
|
191
|
-
exports.FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
192
|
-
_FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
193
|
-
var _applyDecs$e = _applyDecs(_FcrInterpreterControlImpl, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getState"], [_imports.trace, 2, "getInterpreterRoomList"], [_imports.trace, 2, "getInterpreterLanguageList"], [_imports.trace, 2, "release"]], []).e;
|
|
194
|
-
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
195
|
-
_initProto = _applyDecs$e2[0];
|
|
196
|
-
_applyDecs$e;
|
|
184
|
+
exports.FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.FcrInterpreterRoomControlImpl = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _ = require("..");
|
|
10
8
|
var _logger = require("../../utilities/logger");
|
|
11
9
|
var _type = require("../type");
|
|
@@ -13,12 +11,12 @@ var _type = require("../type");
|
|
|
13
11
|
* @internal
|
|
14
12
|
*/
|
|
15
13
|
class FcrInterpreterRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
14
|
+
//@internal
|
|
15
|
+
logger = (0, _logger.createLogger)({
|
|
16
|
+
prefix: 'FcrInterpreterRoomControlImpl'
|
|
17
|
+
});
|
|
16
18
|
constructor(_engine, _scene, _api, _config, _sharedCache, _chatConnection, chatRoomControl) {
|
|
17
19
|
super(_engine, _scene, _api, _config, _type.FcrRoomType.Interpreterroom, _chatConnection, _sharedCache, chatRoomControl);
|
|
18
|
-
//@internal
|
|
19
|
-
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
20
|
-
prefix: 'FcrInterpreterRoomControlImpl'
|
|
21
|
-
}));
|
|
22
20
|
this._engine = _engine;
|
|
23
21
|
this._scene = _scene;
|
|
24
22
|
this._api = _api;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.FcrJoinBeforeHostWaitingRoomControlImpl = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _ = require("..");
|
|
10
8
|
var _logger = require("../../utilities/logger");
|
|
11
9
|
var _type = require("../type");
|
|
@@ -13,12 +11,12 @@ var _type = require("../type");
|
|
|
13
11
|
* @internal
|
|
14
12
|
*/
|
|
15
13
|
class FcrJoinBeforeHostWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
14
|
+
//@internal
|
|
15
|
+
logger = (0, _logger.createLogger)({
|
|
16
|
+
prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
|
|
17
|
+
});
|
|
16
18
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
|
|
17
19
|
super(engine, scene, api, config, _type.FcrRoomType.JoinBeforeHostWaitingRoom, chatConnection, sharedCache, chatRoomControl);
|
|
18
|
-
//@internal
|
|
19
|
-
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
20
|
-
prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
|
|
21
|
-
}));
|
|
22
20
|
this._addLogObserver();
|
|
23
21
|
}
|
|
24
22
|
addObserver(observer) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
|
5
3
|
require("core-js/modules/es.array.push.js");
|
|
6
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -19,7 +17,6 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
19
17
|
require("core-js/modules/esnext.map.some.js");
|
|
20
18
|
require("core-js/modules/esnext.map.update.js");
|
|
21
19
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
20
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
24
21
|
Object.defineProperty(exports, "__esModule", {
|
|
25
22
|
value: true
|
|
@@ -29,8 +26,6 @@ require("core-js/modules/es.array.includes.js");
|
|
|
29
26
|
require("core-js/modules/es.json.stringify.js");
|
|
30
27
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
31
28
|
require("core-js/modules/esnext.iterator.find.js");
|
|
32
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
33
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
29
|
var _ = require("..");
|
|
35
30
|
var _imports = require("../../imports");
|
|
36
31
|
var _schema = require("../../schema");
|
|
@@ -45,35 +40,38 @@ var _type2 = require("../type");
|
|
|
45
40
|
var _utils = require("../whiteboard-control-v2/utils");
|
|
46
41
|
var _utils2 = require("../whiteboard-control/utils");
|
|
47
42
|
var _boardInitInfoHelper = require("../helpers/board-init-info-helper");
|
|
48
|
-
|
|
49
|
-
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
|
|
43
|
+
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs;
|
|
50
44
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
51
45
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
52
46
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
53
47
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
54
48
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
55
|
-
const
|
|
56
|
-
|
|
49
|
+
const {
|
|
50
|
+
shared: sharedScheduler,
|
|
51
|
+
Duration
|
|
52
|
+
} = _imports.AgoraScheduler;
|
|
57
53
|
/**
|
|
58
54
|
* @internal
|
|
59
55
|
*/
|
|
60
|
-
_ref = (_enableWaitingRoomDecs = [(0, _imports.trace)(['enable']), (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], "logger");
|
|
61
56
|
class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
57
|
+
static {
|
|
58
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
59
|
+
}
|
|
60
|
+
//@internal
|
|
61
|
+
[(_enableWaitingRoomDecs = [(0, _imports.trace)(['enable']), (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
62
|
+
prefix: 'FcrMainRoomControlImpl'
|
|
63
|
+
}));
|
|
64
|
+
_privilegeObserver = {
|
|
65
|
+
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
66
|
+
};
|
|
62
67
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl, monitorControl) {
|
|
63
68
|
super(engine, scene, api, config, _type2.FcrRoomType.Mainroom, chatConnection, sharedCache, chatRoomControl);
|
|
64
|
-
//@internal
|
|
65
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
66
|
-
prefix: 'FcrMainRoomControlImpl'
|
|
67
|
-
})));
|
|
68
|
-
(0, _defineProperty2.default)(this, "_privilegeObserver", {
|
|
69
|
-
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
70
|
-
});
|
|
71
69
|
this._monitorControl = monitorControl;
|
|
72
70
|
this._groupControl = new _groupControl.FcrGroupControl(engine, scene, api, sharedCache);
|
|
73
71
|
this._interpreterControl = new _interpreterControl.FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
|
|
74
72
|
this._addLogObserver();
|
|
75
73
|
(0, _boardInitInfoHelper.addBoardInitInfoObserver)(this._scene, this._api, this.logger);
|
|
76
|
-
this.logger.info(
|
|
74
|
+
this.logger.info(`initialized, room id: ${this._scene.sceneId}`);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
// @trace
|
|
@@ -107,8 +105,7 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
107
105
|
privilegeControl.removeObserver(this._privilegeObserver);
|
|
108
106
|
return await super.leave();
|
|
109
107
|
} finally {
|
|
110
|
-
|
|
111
|
-
(_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
|
|
108
|
+
this._logUploadTask?.stop();
|
|
112
109
|
this._uploadLog();
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -125,14 +122,11 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
125
122
|
}), _imports.ErrorModuleCode.FCR_ROOM, 'enable waiting room failed');
|
|
126
123
|
}
|
|
127
124
|
async moveToWaitingRoomByUserIds(userIds) {
|
|
128
|
-
const
|
|
129
|
-
_await$to2 = (0, _slicedToArray2.default)(_await$to, 1),
|
|
130
|
-
error = _await$to2[0];
|
|
125
|
+
const [error] = await (0, _imports.to)(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId));
|
|
131
126
|
if (error) {
|
|
132
|
-
this.logger.error(
|
|
127
|
+
this.logger.error(`[RoomControl] move to waiting room failed, ${error.message}-${JSON.stringify(error)}`);
|
|
133
128
|
if (error instanceof _imports.AgoraRestfulClientError) {
|
|
134
|
-
|
|
135
|
-
throw (0, _error.generateFcrCoreServerError)((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message);
|
|
129
|
+
throw (0, _error.generateFcrCoreServerError)(error.serviceCode ?? -1, error.message);
|
|
136
130
|
}
|
|
137
131
|
throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error.message);
|
|
138
132
|
}
|
|
@@ -143,12 +137,12 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
143
137
|
}
|
|
144
138
|
_onLocalUserPermissionInfoDeleted(roomId, event) {
|
|
145
139
|
if ((0, _utils2.hasBoardWritePermission)(event.permissionInfo)) {
|
|
146
|
-
this.logger.info(
|
|
140
|
+
this.logger.info(`remove board write permission`);
|
|
147
141
|
|
|
148
142
|
// this.getSharingControl().getBoardControl().getMainWindow()?.setWritable(false);
|
|
149
143
|
}
|
|
150
144
|
if ((0, _utils2.hasAnnotationWritePermission)(event.permissionInfo)) {
|
|
151
|
-
this.logger.info(
|
|
145
|
+
this.logger.info(`remove annotation write permission`);
|
|
152
146
|
|
|
153
147
|
// this.getSharingControl().getAnnotationControl().getMainWindow()?.setWritable(false);
|
|
154
148
|
}
|
|
@@ -162,13 +156,12 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
162
156
|
const stream = streamControl.getStreamList().find(stream => stream.videoSourceType === _type.FcrVideoSourceType.SCREEN);
|
|
163
157
|
const localUserId = userControl.getLocalUser().userId;
|
|
164
158
|
if (stream) {
|
|
165
|
-
var _userControl$getUser;
|
|
166
159
|
const ownerId = stream.owner.userId;
|
|
167
160
|
const isNotMeSharing = ownerId !== localUserId;
|
|
168
|
-
const platform =
|
|
161
|
+
const platform = userControl.getUser(ownerId)?.platform;
|
|
169
162
|
const isPcPlatform = platform && [_type.FcrPlatform.WEB_DESKTOP, _type.FcrPlatform.WINDOWS, _type.FcrPlatform.MACOS].includes(platform);
|
|
170
163
|
const isAndroidPlatform = platform && platform === _type.FcrPlatform.ANDROID;
|
|
171
|
-
this.logger.info(
|
|
164
|
+
this.logger.info(`check if set auto cancel draw, isPcPlatform: ${isPcPlatform}, isAndroidPlatform: ${isAndroidPlatform}, isNotMeSharing: ${isNotMeSharing}, ownerId: ${ownerId}, localUserId: ${localUserId}, platform: ${platform}`);
|
|
172
165
|
if (isPcPlatform) {
|
|
173
166
|
mainWindow.setAutoCancelDraw(false);
|
|
174
167
|
}
|
|
@@ -203,9 +196,4 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
203
196
|
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
204
197
|
}
|
|
205
198
|
}
|
|
206
|
-
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
207
|
-
_FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
208
|
-
var _applyDecs$e = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
209
|
-
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
210
|
-
_initProto = _applyDecs$e2[0];
|
|
211
|
-
_applyDecs$e;
|
|
199
|
+
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,8 +7,6 @@ exports.getLocalUserPermissionInfo = exports.addLocalUserPermissionObserver = ex
|
|
|
8
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
8
|
require("core-js/modules/esnext.iterator.find.js");
|
|
10
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
11
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
10
|
var _type = require("./type");
|
|
14
11
|
var _user = require("../../utilities/user");
|
|
15
12
|
// 初始化权限策略表达式:{module}:{action}-{k1=v1|v2;k2=v3}>{role1|role2}
|
|
@@ -34,25 +31,13 @@ class FcrPermission {
|
|
|
34
31
|
this.targetRoles = targetRoles;
|
|
35
32
|
}
|
|
36
33
|
static fromString(permission) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
roles = _permission$split2[1];
|
|
41
|
-
const _moduleActionParams$s = moduleActionParams.split('-'),
|
|
42
|
-
_moduleActionParams$s2 = (0, _slicedToArray2.default)(_moduleActionParams$s, 2),
|
|
43
|
-
moduleAction = _moduleActionParams$s2[0],
|
|
44
|
-
params = _moduleActionParams$s2[1];
|
|
45
|
-
const _moduleAction$split = moduleAction.split(':'),
|
|
46
|
-
_moduleAction$split2 = (0, _slicedToArray2.default)(_moduleAction$split, 2),
|
|
47
|
-
module = _moduleAction$split2[0],
|
|
48
|
-
action = _moduleAction$split2[1];
|
|
34
|
+
const [moduleActionParams, roles] = permission.split('>');
|
|
35
|
+
const [moduleAction, params] = moduleActionParams.split('-');
|
|
36
|
+
const [module, action] = moduleAction.split(':');
|
|
49
37
|
const paramsObj = {};
|
|
50
38
|
if (params) {
|
|
51
39
|
for (const param of params.split(';')) {
|
|
52
|
-
const
|
|
53
|
-
_param$split2 = (0, _slicedToArray2.default)(_param$split, 2),
|
|
54
|
-
key = _param$split2[0],
|
|
55
|
-
values = _param$split2[1];
|
|
40
|
+
const [key, values] = param.split('=');
|
|
56
41
|
paramsObj[key] = values.split('|');
|
|
57
42
|
}
|
|
58
43
|
}
|
|
@@ -61,7 +46,7 @@ class FcrPermission {
|
|
|
61
46
|
}
|
|
62
47
|
exports.FcrPermission = FcrPermission;
|
|
63
48
|
const getLocalUserPermissionInfo = (scene, action) => {
|
|
64
|
-
const permissionStringArray = scene.getUserPropertiesByKeyPath(
|
|
49
|
+
const permissionStringArray = scene.getUserPropertiesByKeyPath(`permission.list`, scene.localUser.getLocalUserId());
|
|
65
50
|
const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
|
|
66
51
|
if (!permissionString) {
|
|
67
52
|
return {
|
|
@@ -77,13 +62,15 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
77
62
|
enable: false
|
|
78
63
|
};
|
|
79
64
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
65
|
+
const {
|
|
66
|
+
module,
|
|
67
|
+
action
|
|
68
|
+
} = permission;
|
|
82
69
|
const permissionInfo = {
|
|
83
70
|
enable: operateType === _type.FcrOperatePermissionType.ADD || operateType === _type.FcrOperatePermissionType.GET ? true : false,
|
|
84
71
|
info: {
|
|
85
72
|
targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
|
|
86
|
-
action:
|
|
73
|
+
action: `${module}:${action}`,
|
|
87
74
|
params: permission.conditions
|
|
88
75
|
}
|
|
89
76
|
};
|
|
@@ -92,13 +79,11 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
92
79
|
const addLocalUserPermissionObserver = (scene, observer, cache) => {
|
|
93
80
|
scene.addObserver({
|
|
94
81
|
onUserPropertiesUpdated: (sceneId, event) => {
|
|
95
|
-
|
|
96
|
-
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
|
|
82
|
+
if (event.cause?.cmd === 3200) {
|
|
97
83
|
if (event.modifiedUser.userId === scene.localUser.getLocalUserId()) {
|
|
98
|
-
var _data$addPermissions, _data$removePermissio;
|
|
99
84
|
const data = event.cause.data;
|
|
100
|
-
const addedPermissions =
|
|
101
|
-
const removedPermissions =
|
|
85
|
+
const addedPermissions = data.addPermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.ADD));
|
|
86
|
+
const removedPermissions = data.removePermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.DELETE));
|
|
102
87
|
if (removedPermissions && removedPermissions.length > 0) {
|
|
103
88
|
observer.onLocalUserPermissionInfoDeleted && observer.onLocalUserPermissionInfoDeleted(sceneId, {
|
|
104
89
|
permissionInfo: removedPermissions,
|