Skip to content

Commit cc4d23a

Browse files
committed
Fix dynamic package size
1 parent 65ff48f commit cc4d23a

5 files changed

Lines changed: 16 additions & 4 deletions

File tree

OpenFlow/src/Messages/Message.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,13 @@ export class Message {
780780
} else if (msg.rawAssertion !== null && msg.rawAssertion !== undefined) {
781781
type = "samltoken";
782782
user = await LoginProvider.validateToken(msg.rawAssertion);
783+
// refresh, for roles and stuff
783784
if (user !== null && user != undefined) { tuser = TokenUser.From(user); }
784785
msg.rawAssertion = "";
785786
} else {
786787
user = await Auth.ValidateByPassword(msg.username, msg.password);
787788
tuser = null;
789+
// refresh, for roles and stuff
788790
if (user != null) tuser = TokenUser.From(user);
789791
if (user == null) {
790792
tuser = new TokenUser();
@@ -811,6 +813,16 @@ export class Message {
811813
}
812814

813815
msg.user = tuser;
816+
if (msg.impersonate == "-1" || msg.impersonate == "false") {
817+
user.impersonating = undefined;
818+
} else if (!NoderedUtil.IsNullEmpty(user.impersonating) && NoderedUtil.IsNullEmpty(msg.impersonate)) {
819+
const items = await Config.db.query({ _id: user.impersonating }, null, 1, 0, null, "users", msg.jwt);
820+
if (items.length == 0) {
821+
msg.impersonate = null;
822+
} else {
823+
msg.impersonate = user.impersonating;
824+
}
825+
}
814826
if (msg.impersonate !== undefined && msg.impersonate !== null && msg.impersonate !== "" && tuser._id != msg.impersonate) {
815827
const items = await Config.db.query({ _id: msg.impersonate }, null, 1, 0, null, "users", msg.jwt);
816828
if (items.length == 0) {

OpenFlow/src/WebSocketServerClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class WebSocketServerClient {
315315
});
316316
}
317317
private _Send(message: Message, cb: QueuedMessageCallback): void {
318-
const messages: string[] = this.chunkString(message.data, 500);
318+
const messages: string[] = this.chunkString(message.data, Config.websocket_package_size);
319319
if (NoderedUtil.IsNullUndefinded(messages) || messages.length === 0) {
320320
const singlemessage: SocketMessage = SocketMessage.frommessage(message, "", 1, 0);
321321
if (NoderedUtil.IsNullEmpty(message.replyto)) {

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.1.144",
3+
"version": "1.1.145",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.144
1+
1.1.145

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/openflow",
3-
"version": "1.1.144",
3+
"version": "1.1.145",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)