Skip to content

Commit 5106f1d

Browse files
committed
Update agent for nodered
1 parent bb420aa commit 5106f1d

7 files changed

Lines changed: 16 additions & 8 deletions

File tree

OpenFlow/src/WebSocketServerClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export class WebSocketServerClient {
113113
qname = "webapp." + Math.random().toString(36).substr(2, 9); autoDelete = true;
114114
} else if (this.clientagent == "web") {
115115
qname = "web." + Math.random().toString(36).substr(2, 9); autoDelete = true;
116+
} else if (this.clientagent == "openrpa") {
117+
qname = "openrpa." + Math.random().toString(36).substr(2, 9); autoDelete = true;
116118
} else {
117119
qname = "unknown." + Math.random().toString(36).substr(2, 9); autoDelete = true;
118120
}

OpenFlow/src/cli.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ function getToken(): Promise<string> {
4242
return new Promise<string>(async (resolve, reject) => {
4343
logger.info("wsurl " + Config.api_ws_url);
4444
var socket: WebSocketClient = new WebSocketClient(logger, Config.api_ws_url);
45+
socket.agent = "openflow-cli";
46+
socket.version = Config.version;
4547
socket.events.on("onopen", async () => {
4648
try {
4749
var username: string = readlineSync.question('username? ');
4850
var password: string = readlineSync.question('password? ', { hideEchoBack: true });
49-
50-
socket.version = Config.version;
51-
socket.agent = "nodered-cli";
5251
var result = await NoderedUtil.SigninWithUsername(username, password, null, true);
5352
logger.info("signed in as " + result.user.name + " with id " + result.user._id);
5453
WebSocketClient.instance.user = result.user;

OpenFlow/src/public/Controllers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { userdata, api, entityCtrl, entitiesCtrl } from "./CommonControllers";
22
import { TokenUser, QueueMessage, SigninMessage, Ace, NoderedUser, Billing, stripe_customer, stripe_list, stripe_base, stripe_plan, stripe_subscription_item, Base, NoderedUtil, WebSocketClient, Role, NoderedConfig, Resources, ResourceValues, stripe_invoice } from "openflow-api";
33
import { RPAWorkflow, Provider, Form, WorkflowInstance, Workflow, unattendedclient } from "./Entities";
44
import { WebSocketClientService } from "./WebSocketClientService";
5+
import * as jsondiffpatch from "jsondiffpatch";
56

67
function treatAsUTC(date): number {
78
var result = new Date(date);
@@ -12,7 +13,6 @@ function daysBetween(startDate, endDate): number {
1213
var millisecondsPerDay = 24 * 60 * 60 * 1000;
1314
return (treatAsUTC(endDate) - treatAsUTC(startDate)) / millisecondsPerDay;
1415
}
15-
declare var jsondiffpatch: any;
1616
declare var Formio: any;
1717
declare var FileSaver: any;
1818
export class RPAWorkflowCtrl extends entityCtrl<RPAWorkflow> {
@@ -3014,6 +3014,8 @@ export class AuditlogsCtrl extends entitiesCtrl<Role> {
30143014
if (model.clientagent == 'samlverify') model.fa = 'fab fa-windows';
30153015
if (model.clientagent == 'aiotwebapp') model.fa = 'fas fa-globe';
30163016
if (model.clientagent == 'aiotmobileapp') model.fa = 'fas fa-mobile-alt';
3017+
if (model.clientagent == 'nodered-cli') model.fa = 'fab fa-node-js';
3018+
if (model.clientagent == 'openflow-cli') model.fa = 'fab fa-node-js';
30173019

30183020
if (model.impostorname != '' && model.impostorname != null) model.fa2 = 'fas fa-user-secret';
30193021
}

OpenFlow/src/public/WebSocketClientService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export class WebSocketClientService {
3636
if (WebSocketClient.instance == null) {
3737
var cli: WebSocketClient;
3838
cli = new WebSocketClient(this.logger, wsurl);
39-
WebSocketClient.instance.version = data.version;
39+
cli.agent = "webapp";
40+
cli.version = data.version;
4041
}
4142
cli.events.on('connect', () => {
4243
this.logger.info('connected to ' + wsurl);

OpenFlowNodeRED/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ function getToken(): Promise<string> {
7070
return new Promise<string>(async (resolve, reject) => {
7171
logger.info("wsurl " + Config.api_ws_url);
7272
var socket: WebSocketClient = new WebSocketClient(logger, Config.api_ws_url);
73+
socket.agent = "nodered-cli";
74+
socket.version = Config.version;
7375
socket.events.on("onopen", async () => {
7476
try {
7577
var username: string = readlineSync.question('username? ');
7678
var password: string = readlineSync.question('password? ', { hideEchoBack: true });
7779

78-
socket.version = Config.version;
79-
socket.agent = "nodered-cli";
8080
var result = await NoderedUtil.SigninWithUsername(username, password, null, true);
8181
logger.info("signed in as " + result.user.name + " with id " + result.user._id);
8282
WebSocketClient.instance.user = result.user;

OpenFlowNodeRED/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ rejectionEmitter.on("rejectionHandled", (error, promise) => {
2727
try {
2828
var c = Config;
2929
var socket: WebSocketClient = new WebSocketClient(logger, Config.api_ws_url);
30+
socket.agent = "nodered";
31+
socket.version = Config.version;
3032
logger.info("VERSION: " + Config.version);
3133
socket.events.on("onopen", async () => {
3234
try {

OpenFlowNodeRED/src/nodered/nodes/amqp_nodes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ export class amqp_connection {
3131
this.host = this.config.host;
3232
if (!NoderedUtil.IsNullUndefinded(this.host)) {
3333
this.webcli = new WebSocketClient(WebSocketClient.instance._logger, this.host);
34+
this.webcli.agent = "remotenodered";
35+
this.webcli.version = Config.version;
3436
this.webcli._logger.info("amqp_condig: connecting to " + this.host);
3537
this.webcli.events.on("onopen", async () => {
3638
try {
3739
var q: SigninMessage = new SigninMessage();
38-
q.clientagent = "nodered";
40+
q.clientagent = "remotenodered";
3941
q.clientversion = Config.version;
4042
q.username = this.username;
4143
q.password = this.password;

0 commit comments

Comments
 (0)