@meru2802/aux-server 1.0.13 → 1.0.15
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/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/swagger.d.ts.map +1 -1
- package/dist/config/swagger.js +2 -2
- package/dist/controllers/BaseController.d.ts +3 -0
- package/dist/controllers/BaseController.d.ts.map +1 -1
- package/dist/controllers/BaseController.js +7 -0
- package/dist/controllers/apiController.d.ts.map +1 -1
- package/dist/controllers/apiController.js +159 -4
- package/dist/controllers/coreController.d.ts.map +1 -1
- package/dist/controllers/coreController.js +4 -5
- package/dist/controllers/healthController.d.ts.map +1 -1
- package/dist/controllers/healthController.js +2 -1
- package/dist/lib/utils/index.d.ts +4 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +15 -0
- package/dist/middleware/BaseMiddleware.d.ts +3 -0
- package/dist/middleware/BaseMiddleware.d.ts.map +1 -1
- package/dist/middleware/BaseMiddleware.js +7 -0
- package/dist/middleware/authMiddleware.d.ts.map +1 -1
- package/dist/middleware/authMiddleware.js +4 -0
- package/dist/services/WebSocketService.d.ts +1 -0
- package/dist/services/WebSocketService.d.ts.map +1 -1
- package/dist/services/WebSocketService.js +11 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemas/index.d.ts +2 -0
- package/dist/types/schemas/index.d.ts.map +1 -1
- package/dist/types/schemas/index.js +9 -0
- package/package.json +3 -2
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO;WAIO,WAAW,IAAI,aAAa;IAO1C,OAAO,CAAC,UAAU;IAwDX,SAAS,IAAI,MAAM;IAInB,aAAa;;;;;;;IAIb,WAAW;;;;;;;IAIX,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO;WAIO,WAAW,IAAI,aAAa;IAO1C,OAAO,CAAC,UAAU;IAwDX,SAAS,IAAI,MAAM;IAInB,aAAa;;;;;;;IAIb,WAAW;;;;;;;IAIX,gBAAgB;;;;;;;;;IAIhB,gBAAgB;;;;;;;;CAGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../src/config/swagger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../src/config/swagger.ts"],"names":[],"mappings":"AA6QA,eAAO,MAAM,WAAW,QAAwB,CAAC"}
|
package/dist/config/swagger.js
CHANGED
|
@@ -10,11 +10,11 @@ const options = {
|
|
|
10
10
|
openapi: "3.0.0",
|
|
11
11
|
info: {
|
|
12
12
|
title: "Aux Server API",
|
|
13
|
-
version: "1.0.
|
|
13
|
+
version: "1.0.14",
|
|
14
14
|
description: "Nexus EPM auxiliary server to facilitate additional functionality required by Scogo Iceberg",
|
|
15
15
|
contact: {
|
|
16
16
|
name: "API Support",
|
|
17
|
-
email: "
|
|
17
|
+
email: "developer@scogo.in",
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
servers: [
|
|
@@ -3,6 +3,8 @@ import WebSocket from "ws";
|
|
|
3
3
|
import { IServiceContainer } from "../services/ServiceContainer";
|
|
4
4
|
import { Config } from "../types";
|
|
5
5
|
import { IWebSocketService } from "../services/WebSocketService";
|
|
6
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
7
|
+
import { Agent } from "https";
|
|
6
8
|
export declare abstract class BaseController {
|
|
7
9
|
protected serviceContainer: IServiceContainer;
|
|
8
10
|
constructor(serviceContainer?: IServiceContainer);
|
|
@@ -12,5 +14,6 @@ export declare abstract class BaseController {
|
|
|
12
14
|
protected get config(): Config;
|
|
13
15
|
protected get isWebSocketConnected(): boolean;
|
|
14
16
|
protected get meshServer(): string;
|
|
17
|
+
protected get httpsAgent(): HttpsProxyAgent<string> | Agent;
|
|
15
18
|
}
|
|
16
19
|
//# sourceMappingURL=BaseController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController.d.ts","sourceRoot":"","sources":["../../src/controllers/BaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAEL,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseController.d.ts","sourceRoot":"","sources":["../../src/controllers/BaseController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAEL,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,8BAAsB,cAAc;IAClC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;gBAElC,gBAAgB,CAAC,EAAE,iBAAiB;IAIhD,SAAS,KAAK,MAAM,IAAI,IAAI,CAE3B;IAED,SAAS,KAAK,SAAS,IAAI,SAAS,GAAG,IAAI,CAE1C;IAED,SAAS,KAAK,gBAAgB,IAAI,iBAAiB,CAElD;IAED,SAAS,KAAK,MAAM,IAAI,MAAM,CAE7B;IAED,SAAS,KAAK,oBAAoB,IAAI,OAAO,CAE5C;IAED,SAAS,KAAK,UAAU,IAAI,MAAM,CAEjC;IAED,SAAS,KAAK,UAAU,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,KAAK,CAM1D;CACF"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseController = void 0;
|
|
4
4
|
const ServiceContainer_1 = require("../services/ServiceContainer");
|
|
5
|
+
const utils_1 = require("../lib/utils");
|
|
5
6
|
class BaseController {
|
|
6
7
|
constructor(serviceContainer) {
|
|
7
8
|
this.serviceContainer = serviceContainer || ServiceContainer_1.ServiceContainer.getInstance();
|
|
@@ -24,5 +25,11 @@ class BaseController {
|
|
|
24
25
|
get meshServer() {
|
|
25
26
|
return this.config.meshcentralConfig.server;
|
|
26
27
|
}
|
|
28
|
+
get httpsAgent() {
|
|
29
|
+
if (this.config.icebergConfig.proxy_required) {
|
|
30
|
+
return (0, utils_1.getProxyAgent)(this.config.icebergConfig.HTTPS_PROXY);
|
|
31
|
+
}
|
|
32
|
+
return (0, utils_1.getNoProxyHttpAgent)();
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
exports.BaseController = BaseController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiController.d.ts","sourceRoot":"","sources":["../../src/controllers/apiController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"apiController.d.ts","sourceRoot":"","sources":["../../src/controllers/apiController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAOjE,qBAAa,aAAc,SAAQ,cAAc;gBACnC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,YAAY,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CA2EtE;IAEK,cAAc,GACnB,KAAK,OAAO,EACZ,KAAK,QAAQ,KACZ,OAAO,CAAC,IAAI,CAAC,CA+Pd;CACH"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ApiController = void 0;
|
|
7
7
|
const BaseController_1 = require("./BaseController");
|
|
8
8
|
const utils_1 = require("../lib/utils");
|
|
9
|
+
const utils_2 = require("@meru2802/rmm-lib/utils");
|
|
9
10
|
const axios_1 = __importDefault(require("axios"));
|
|
10
11
|
class ApiController extends BaseController_1.BaseController {
|
|
11
12
|
constructor(serviceContainer) {
|
|
@@ -35,7 +36,7 @@ class ApiController extends BaseController_1.BaseController {
|
|
|
35
36
|
const userEpmId = (_a = nexus_epm_user_id.rows[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
36
37
|
const expiration = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
|
|
37
38
|
const keyName = `${userEpmId}_${expiration.getTime()}`;
|
|
38
|
-
await axios_1.default.post(
|
|
39
|
+
await axios_1.default.post(`${this.config.epmConfig.server}/accounts/apikeys/`, {
|
|
39
40
|
name: keyName,
|
|
40
41
|
expiration: expiration.toISOString(),
|
|
41
42
|
user: userEpmId,
|
|
@@ -71,10 +72,11 @@ class ApiController extends BaseController_1.BaseController {
|
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
this.getConnectUrls = async (req, res) => {
|
|
74
|
-
var _a;
|
|
75
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
76
|
try {
|
|
76
77
|
const meshNodeId = req.body.meshNodeId;
|
|
77
78
|
const userId = req.body.userId;
|
|
79
|
+
const isApplet = req.body.isApplet;
|
|
78
80
|
if (!meshNodeId || !userId) {
|
|
79
81
|
const errorResponse = {
|
|
80
82
|
error: "'meshNodeId' or 'userId' are missing in body params",
|
|
@@ -83,7 +85,7 @@ class ApiController extends BaseController_1.BaseController {
|
|
|
83
85
|
res.status(400).json(errorResponse);
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
|
-
const nexus_epm_user_id_query = "SELECT id FROM accounts_user WHERE username= $1";
|
|
88
|
+
const nexus_epm_user_id_query = "SELECT id, role_id FROM accounts_user WHERE username= $1";
|
|
87
89
|
const nexus_epm_user_id = await this.dbPool.query(nexus_epm_user_id_query, [userId]);
|
|
88
90
|
if (nexus_epm_user_id.rows.length === 0) {
|
|
89
91
|
const errorResponse = {
|
|
@@ -93,7 +95,160 @@ class ApiController extends BaseController_1.BaseController {
|
|
|
93
95
|
res.status(400).json(errorResponse);
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
if (!isApplet) {
|
|
99
|
+
const nexus_epm_agent_id_query = "SELECT agent_id, site_id FROM agents_agent where mesh_node_id= $1";
|
|
100
|
+
const nexus_epm_agent_id = await this.dbPool.query(nexus_epm_agent_id_query, [meshNodeId]);
|
|
101
|
+
if (!((_a = nexus_epm_user_id.rows[0]) === null || _a === void 0 ? void 0 : _a.role_id)) {
|
|
102
|
+
const errorResponse = {
|
|
103
|
+
error: `'Role id corresponding to user ${userId}' Not Found`,
|
|
104
|
+
timestamp: new Date().toISOString(),
|
|
105
|
+
};
|
|
106
|
+
res.status(400).json(errorResponse);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (nexus_epm_agent_id.rows.length === 0) {
|
|
110
|
+
const errorResponse = {
|
|
111
|
+
error: `'Agent Id corresponding to mesh node id ${meshNodeId}' Not Found`,
|
|
112
|
+
timestamp: new Date().toISOString(),
|
|
113
|
+
};
|
|
114
|
+
res.status(400).json(errorResponse);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const nexus_epm_agent_client_id_query = "SELECT client_id FROM clients_site WHERE id= $1";
|
|
118
|
+
const nexus_epm_agent_client_id = await this.dbPool.query(nexus_epm_agent_client_id_query, [
|
|
119
|
+
(_b = nexus_epm_agent_id.rows[0]) === null || _b === void 0 ? void 0 : _b.site_id,
|
|
120
|
+
]);
|
|
121
|
+
if (nexus_epm_agent_client_id.rows.length === 0) {
|
|
122
|
+
const errorResponse = {
|
|
123
|
+
error: `'Client ID corresponding to site id ${(_c = nexus_epm_agent_id.rows[0]) === null || _c === void 0 ? void 0 : _c.site_id}' Not Found`,
|
|
124
|
+
timestamp: new Date().toISOString(),
|
|
125
|
+
};
|
|
126
|
+
res.status(400).json(errorResponse);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const nexus_epm_role_client_ids_query = "SELECT client_id FROM accounts_role_can_view_clients WHERE role_id= $1";
|
|
130
|
+
const nexus_epm_role_site_ids_query = "SELECT site_id FROM accounts_role_can_view_sites WHERE role_id= $1";
|
|
131
|
+
const [nexus_epm_role_client_ids, nexus_epm_role_site_ids] = await Promise.all([
|
|
132
|
+
this.dbPool.query(nexus_epm_role_client_ids_query, [
|
|
133
|
+
(_d = nexus_epm_user_id.rows[0]) === null || _d === void 0 ? void 0 : _d.role_id,
|
|
134
|
+
]),
|
|
135
|
+
this.dbPool.query(nexus_epm_role_site_ids_query, [
|
|
136
|
+
(_e = nexus_epm_user_id.rows[0]) === null || _e === void 0 ? void 0 : _e.role_id,
|
|
137
|
+
]),
|
|
138
|
+
]);
|
|
139
|
+
const roleHasPermissionForAgentClient = () => {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
for (let i = 0; i < nexus_epm_role_client_ids.rows.length; i++) {
|
|
142
|
+
if (((_a = nexus_epm_role_client_ids.rows[i]) === null || _a === void 0 ? void 0 : _a.client_id) ==
|
|
143
|
+
((_b = nexus_epm_agent_client_id.rows[0]) === null || _b === void 0 ? void 0 : _b.client_id)) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
};
|
|
149
|
+
const roleHasPermissionForAgentSite = () => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
for (let i = 0; i < nexus_epm_role_site_ids.rows.length; i++) {
|
|
152
|
+
if (((_a = nexus_epm_role_site_ids.rows[i]) === null || _a === void 0 ? void 0 : _a.site_id) ==
|
|
153
|
+
((_b = nexus_epm_agent_id.rows[0]) === null || _b === void 0 ? void 0 : _b.site_id)) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
};
|
|
159
|
+
if (!roleHasPermissionForAgentSite &&
|
|
160
|
+
!roleHasPermissionForAgentClient) {
|
|
161
|
+
const errorResponse = {
|
|
162
|
+
error: `'User ${userId}' does not have permission to take control of machine with mesh node id ${meshNodeId}`,
|
|
163
|
+
timestamp: new Date().toISOString(),
|
|
164
|
+
};
|
|
165
|
+
res.status(401).json(errorResponse);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const meshUser = `user//${userId}___${(_f = nexus_epm_user_id.rows[0]) === null || _f === void 0 ? void 0 : _f.id}`.toLowerCase();
|
|
170
|
+
const meshUserWithoutDomain = `${userId}___${(_g = nexus_epm_user_id.rows[0]) === null || _g === void 0 ? void 0 : _g.id}`.toLowerCase();
|
|
171
|
+
const addUserToDevice = async () => {
|
|
172
|
+
const rights = 4088024;
|
|
173
|
+
const responseId = `id-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
174
|
+
const base64NodeId = (0, utils_2.hexToBase64)(meshNodeId);
|
|
175
|
+
const addDeviceUserMessage = {
|
|
176
|
+
action: "adddeviceuser",
|
|
177
|
+
responseid: responseId,
|
|
178
|
+
usernames: [meshUserWithoutDomain],
|
|
179
|
+
nodeid: base64NodeId,
|
|
180
|
+
rights: rights,
|
|
181
|
+
};
|
|
182
|
+
console.log(JSON.stringify(addDeviceUserMessage));
|
|
183
|
+
const messageSent = this.WebSocketService.sendMessage(addDeviceUserMessage);
|
|
184
|
+
if (!messageSent) {
|
|
185
|
+
console.error("Could not send adddeviceuser message over socket");
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
if (!this.webSocket) {
|
|
189
|
+
console.error("Socket not found");
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
193
|
+
let responseReceived = false;
|
|
194
|
+
const timeout = setTimeout(() => {
|
|
195
|
+
if (!responseReceived) {
|
|
196
|
+
responseReceived = true;
|
|
197
|
+
console.error("Timeout waiting for adddeviceuser response");
|
|
198
|
+
resolve(false);
|
|
199
|
+
}
|
|
200
|
+
}, 10000);
|
|
201
|
+
const messageHandler = (data) => {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
if (responseReceived)
|
|
204
|
+
return;
|
|
205
|
+
try {
|
|
206
|
+
const message = JSON.parse(data.toString());
|
|
207
|
+
if (message.responseid === responseId) {
|
|
208
|
+
responseReceived = true;
|
|
209
|
+
clearTimeout(timeout);
|
|
210
|
+
(_a = this.webSocket) === null || _a === void 0 ? void 0 : _a.removeListener("message", messageHandler);
|
|
211
|
+
if (message.result === "ok" || message.success === true) {
|
|
212
|
+
console.log(`Successfully added user ${meshUser} to device ${base64NodeId}`);
|
|
213
|
+
resolve(true);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
console.error(`Failed to add user to device: ${message.result || message.error}`);
|
|
217
|
+
resolve(false);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else if (message.action === "adddeviceuser" &&
|
|
221
|
+
!message.responseid) {
|
|
222
|
+
responseReceived = true;
|
|
223
|
+
clearTimeout(timeout);
|
|
224
|
+
(_b = this.webSocket) === null || _b === void 0 ? void 0 : _b.removeListener("message", messageHandler);
|
|
225
|
+
if (message.result === "ok" || message.success === true) {
|
|
226
|
+
console.log(`Successfully added user ${meshUser} to device ${base64NodeId}`);
|
|
227
|
+
resolve(true);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
console.error(`Failed to add user to device: ${message.result || message.error}`);
|
|
231
|
+
resolve(false);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (parseError) {
|
|
236
|
+
console.error("Error parsing WebSocket message:", parseError);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
this.webSocket.on("message", messageHandler);
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
const userAdded = await addUserToDevice();
|
|
243
|
+
if (!userAdded) {
|
|
244
|
+
console.warn(`Could not add user ${meshUser} to device ${meshNodeId}, proceeding anyway`);
|
|
245
|
+
const errorResponse = {
|
|
246
|
+
error: `Failed to grant user ${userId} access to device`,
|
|
247
|
+
timestamp: new Date().toISOString(),
|
|
248
|
+
};
|
|
249
|
+
res.status(500).json(errorResponse);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
97
252
|
const loginEncryptionKey = (0, utils_1.getBinaryKey)(this.config.meshcentralConfig.loginEncryptionKey);
|
|
98
253
|
const authRelayCookie = (0, utils_1.encodeCookie)({ a: 3, u: meshUser }, loginEncryptionKey);
|
|
99
254
|
const token_param = `login=${authRelayCookie}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreController.d.ts","sourceRoot":"","sources":["../../src/controllers/coreController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC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 class CoreController extends BaseController_1.BaseController {
|
|
|
389
389
|
};
|
|
390
390
|
this.getEndpointInstallScript = async (req, res) => {
|
|
391
391
|
try {
|
|
392
|
-
const { clientId, siteId, agentType, endpointUrl, os } = req.body;
|
|
393
|
-
const baseUrl =
|
|
394
|
-
//Get Org_id, Site_id, AssetTypeID, and Org_token form db
|
|
392
|
+
const { clientId, siteId, agentType, endpointUrl, os, installerToken } = req.body;
|
|
393
|
+
const baseUrl = `${this.config.epmConfig.server}`;
|
|
395
394
|
const iceberg_org_id_query = "SELECT string_value FROM clients_clientcustomfield WHERE client_id = $1";
|
|
396
395
|
const iceberg_site_id_query = "SELECT string_value FROM clients_sitecustomfield WHERE site_id = $1";
|
|
397
396
|
const iceberg_org_token_query = "SELECT string_value FROM clients_clientcustomfield WHERE client_id = $1 AND field_id = $2";
|
|
@@ -449,7 +448,7 @@ $agenttype = '"${agentType}"'
|
|
|
449
448
|
$power = 0
|
|
450
449
|
$rdp = 1
|
|
451
450
|
$ping = 0
|
|
452
|
-
$auth = '"${
|
|
451
|
+
$auth = '"${installerToken}"'
|
|
453
452
|
$endpointdownloadlink = '${endpointUrl}'
|
|
454
453
|
$apilink = $endpointdownloadlink.split('/')
|
|
455
454
|
$assetTypeId = '"${assetTypeId}"'
|
|
@@ -638,7 +637,7 @@ agentDL='https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/rmmagent
|
|
|
638
637
|
meshDL='https://${this.config.meshcentralConfig.server}/meshagents?id=${response.deviceGroupId}&installflags=2&meshinstall=6'
|
|
639
638
|
|
|
640
639
|
apiURL='${baseUrl}'
|
|
641
|
-
token='${
|
|
640
|
+
token='${installerToken}'
|
|
642
641
|
clientID='${clientId}'
|
|
643
642
|
siteID='${siteId}'
|
|
644
643
|
agentType='${agentType}'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthController.d.ts","sourceRoot":"","sources":["../../src/controllers/healthController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,qBAAa,gBAAiB,SAAQ,cAAc;gBACtC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,MAAM,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"healthController.d.ts","sourceRoot":"","sources":["../../src/controllers/healthController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,qBAAa,gBAAiB,SAAQ,cAAc;gBACtC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,MAAM,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAAI,CAUjD;IAEK,MAAM,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAAI,CAgBjD;CACH"}
|
|
@@ -6,6 +6,7 @@ class HealthController extends BaseController_1.BaseController {
|
|
|
6
6
|
constructor(serviceContainer) {
|
|
7
7
|
super(serviceContainer);
|
|
8
8
|
this.health = (req, res) => {
|
|
9
|
+
console.log(`HMAC_SECRET: ${this.config.icebergConfig.HMAC_SECRET}`);
|
|
9
10
|
const response = {
|
|
10
11
|
status: "ok",
|
|
11
12
|
timestamp: new Date().toISOString(),
|
|
@@ -17,7 +18,7 @@ class HealthController extends BaseController_1.BaseController {
|
|
|
17
18
|
this.status = (req, res) => {
|
|
18
19
|
const response = {
|
|
19
20
|
service: "aux-server",
|
|
20
|
-
version: "1.0.
|
|
21
|
+
version: "1.0.15",
|
|
21
22
|
meshCentral: {
|
|
22
23
|
connected: this.isWebSocketConnected,
|
|
23
24
|
server: this.meshServer,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Agent } from "https";
|
|
2
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
1
3
|
export interface CookieObject {
|
|
2
4
|
time?: number;
|
|
3
5
|
[key: string]: any;
|
|
@@ -7,4 +9,6 @@ export declare class CookieEncryptionError extends Error {
|
|
|
7
9
|
}
|
|
8
10
|
export declare function encodeCookie(o: CookieObject, key: Buffer | null): string | null;
|
|
9
11
|
export declare function getBinaryKey(key: string): Buffer;
|
|
12
|
+
export declare function getNoProxyHttpAgent(): Agent;
|
|
13
|
+
export declare function getProxyAgent(proxy: string): HttpsProxyAgent<string>;
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,YAAY,CAC1B,CAAC,EAAE,YAAY,EACf,GAAG,EAAE,MAAM,GAAG,IAAI,GACjB,MAAM,GAAG,IAAI,CAqCf;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,mBAAmB,IAAI,KAAK,CAG3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAGpE"}
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -32,11 +32,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.CookieEncryptionError = void 0;
|
|
37
40
|
exports.encodeCookie = encodeCookie;
|
|
38
41
|
exports.getBinaryKey = getBinaryKey;
|
|
42
|
+
exports.getNoProxyHttpAgent = getNoProxyHttpAgent;
|
|
43
|
+
exports.getProxyAgent = getProxyAgent;
|
|
39
44
|
const crypto = __importStar(require("crypto"));
|
|
45
|
+
const https_1 = __importDefault(require("https"));
|
|
46
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
40
47
|
class CookieEncryptionError extends Error {
|
|
41
48
|
constructor(message) {
|
|
42
49
|
super(message);
|
|
@@ -76,3 +83,11 @@ function encodeCookie(o, key) {
|
|
|
76
83
|
function getBinaryKey(key) {
|
|
77
84
|
return Buffer.from(key, "hex");
|
|
78
85
|
}
|
|
86
|
+
function getNoProxyHttpAgent() {
|
|
87
|
+
const agent = new https_1.default.Agent({ rejectUnauthorized: false });
|
|
88
|
+
return agent;
|
|
89
|
+
}
|
|
90
|
+
function getProxyAgent(proxy) {
|
|
91
|
+
const agent = new https_proxy_agent_1.HttpsProxyAgent(proxy, { rejectUnauthorized: false });
|
|
92
|
+
return agent;
|
|
93
|
+
}
|
|
@@ -2,6 +2,8 @@ import { Pool } from "pg";
|
|
|
2
2
|
import { IServiceContainer } from "../services/ServiceContainer";
|
|
3
3
|
import { Config } from "../types";
|
|
4
4
|
import { WebSocket } from "ws";
|
|
5
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
6
|
+
import { Agent } from "https";
|
|
5
7
|
export declare abstract class BaseMiddleware {
|
|
6
8
|
protected serviceContainer: IServiceContainer;
|
|
7
9
|
constructor(serviceContainer?: IServiceContainer);
|
|
@@ -9,5 +11,6 @@ export declare abstract class BaseMiddleware {
|
|
|
9
11
|
protected get webSocket(): WebSocket | null;
|
|
10
12
|
protected get config(): Config;
|
|
11
13
|
protected get isWebSocketConnected(): boolean;
|
|
14
|
+
protected get httpsAgent(): HttpsProxyAgent<string> | Agent;
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=BaseMiddleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/BaseMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EACL,iBAAiB,EAElB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/BaseMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EACL,iBAAiB,EAElB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,8BAAsB,cAAc;IAClC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;gBAElC,gBAAgB,CAAC,EAAE,iBAAiB;IAIhD,SAAS,KAAK,MAAM,IAAI,IAAI,CAE3B;IAED,SAAS,KAAK,SAAS,IAAI,SAAS,GAAG,IAAI,CAE1C;IAED,SAAS,KAAK,MAAM,IAAI,MAAM,CAE7B;IAED,SAAS,KAAK,oBAAoB,IAAI,OAAO,CAE5C;IAED,SAAS,KAAK,UAAU,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,KAAK,CAM1D;CACF"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseMiddleware = void 0;
|
|
4
4
|
const ServiceContainer_1 = require("../services/ServiceContainer");
|
|
5
|
+
const utils_1 = require("../lib/utils");
|
|
5
6
|
class BaseMiddleware {
|
|
6
7
|
constructor(serviceContainer) {
|
|
7
8
|
this.serviceContainer = serviceContainer || ServiceContainer_1.ServiceContainer.getInstance();
|
|
@@ -18,5 +19,11 @@ class BaseMiddleware {
|
|
|
18
19
|
get isWebSocketConnected() {
|
|
19
20
|
return this.serviceContainer.getWebSocketService().isConnected();
|
|
20
21
|
}
|
|
22
|
+
get httpsAgent() {
|
|
23
|
+
if (this.config.icebergConfig.proxy_required) {
|
|
24
|
+
return (0, utils_1.getProxyAgent)(this.config.icebergConfig.HTTPS_PROXY);
|
|
25
|
+
}
|
|
26
|
+
return (0, utils_1.getNoProxyHttpAgent)();
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
29
|
exports.BaseMiddleware = BaseMiddleware;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UA8KhE;IAEK,WAAW,GAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAAC,CAmFd;CACH"}
|
|
@@ -160,6 +160,8 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
|
|
|
160
160
|
.createHmac("sha256", this.config.icebergConfig.HMAC_SECRET)
|
|
161
161
|
.update(message)
|
|
162
162
|
.digest("hex");
|
|
163
|
+
console.log(`Expected signature: ${expected}`);
|
|
164
|
+
console.log(`Iceberg signature: ${signature}`);
|
|
163
165
|
}
|
|
164
166
|
catch (hmacError) {
|
|
165
167
|
console.error("Error generating HMAC signature:", hmacError);
|
|
@@ -236,6 +238,8 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
|
|
|
236
238
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
237
239
|
},
|
|
238
240
|
validateStatus: () => true,
|
|
241
|
+
httpsAgent: this.httpsAgent,
|
|
242
|
+
proxy: false,
|
|
239
243
|
});
|
|
240
244
|
if (introspect_result.status != 200) {
|
|
241
245
|
const unauthorizedResponse = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketService.d.ts","sourceRoot":"","sources":["../../src/services/WebSocketService.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,OAAO,EACL,MAAM,EAKP,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"WebSocketService.d.ts","sourceRoot":"","sources":["../../src/services/WebSocketService.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,OAAO,EACL,MAAM,EAKP,MAAM,UAAU,CAAC;AAOlB,MAAM,WAAW,iBAAiB;IAChC,YAAY,IAAI,SAAS,GAAG,IAAI,CAAC;IACjC,WAAW,IAAI,OAAO,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC;CACpC;AAED,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,oBAAoB,CAAc;IAC1C,OAAO,CAAC,cAAc,CAAiB;gBAE3B,MAAM,EAAE,MAAM;IAIb,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8CxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;IAiBlC,YAAY,IAAI,SAAS,GAAG,IAAI;IAIhC,WAAW,IAAI,OAAO;YAQf,aAAa;IAiC3B,OAAO,CAAC,iBAAiB;IAmCzB,OAAO,CAAC,UAAU;CAOnB"}
|
|
@@ -42,6 +42,7 @@ const base64 = __importStar(require("base-64"));
|
|
|
42
42
|
const types_1 = require("../types");
|
|
43
43
|
const utils_1 = require("@meru2802/rmm-lib/utils");
|
|
44
44
|
const axios_1 = __importDefault(require("axios"));
|
|
45
|
+
const utils_2 = require("../lib/utils");
|
|
45
46
|
class WebSocketService {
|
|
46
47
|
constructor(config) {
|
|
47
48
|
this.ws = null;
|
|
@@ -56,7 +57,7 @@ class WebSocketService {
|
|
|
56
57
|
return new Promise((resolve, reject) => {
|
|
57
58
|
try {
|
|
58
59
|
const { user, password, server } = this.config.meshcentralConfig;
|
|
59
|
-
this.ws = new ws_1.default(
|
|
60
|
+
this.ws = new ws_1.default(`${server}/control.ashx`, {
|
|
60
61
|
headers: {
|
|
61
62
|
"x-meshauth": `${base64.encode(user)},${base64.encode(password)},`,
|
|
62
63
|
},
|
|
@@ -146,6 +147,9 @@ class WebSocketService {
|
|
|
146
147
|
room_id: event.msgArgs[1],
|
|
147
148
|
progress: "100",
|
|
148
149
|
logs: [meshNodeId],
|
|
150
|
+
}, {
|
|
151
|
+
httpsAgent: this.httpsAgent(),
|
|
152
|
+
proxy: false,
|
|
149
153
|
});
|
|
150
154
|
}
|
|
151
155
|
break;
|
|
@@ -176,5 +180,11 @@ class WebSocketService {
|
|
|
176
180
|
}
|
|
177
181
|
}, this.reconnectDelay);
|
|
178
182
|
}
|
|
183
|
+
httpsAgent() {
|
|
184
|
+
if (this.config.icebergConfig.proxy_required) {
|
|
185
|
+
return (0, utils_2.getProxyAgent)(this.config.icebergConfig.HTTPS_PROXY);
|
|
186
|
+
}
|
|
187
|
+
return (0, utils_2.getNoProxyHttpAgent)();
|
|
188
|
+
}
|
|
179
189
|
}
|
|
180
190
|
exports.WebSocketService = WebSocketService;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -103,7 +103,6 @@ export interface Config {
|
|
|
103
103
|
};
|
|
104
104
|
epmConfig: {
|
|
105
105
|
server: string;
|
|
106
|
-
installerToken: string;
|
|
107
106
|
masterApiKey: string;
|
|
108
107
|
tokenFieldId: number;
|
|
109
108
|
assetTypeFieldId: number;
|
|
@@ -113,6 +112,9 @@ export interface Config {
|
|
|
113
112
|
introspectEndpoint: string;
|
|
114
113
|
HMAC_SECRET: string;
|
|
115
114
|
assetEndpoint: string;
|
|
115
|
+
proxy_required: boolean;
|
|
116
|
+
HTTP_PROXY: string;
|
|
117
|
+
HTTPS_PROXY: string;
|
|
116
118
|
};
|
|
117
119
|
dbConfig: {
|
|
118
120
|
host: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,oBAAY,WAAW;IACrB,OAAO,WAAW;IAClB,KAAK,UAAU;IACf,WAAW,eAAe;IAC1B,aAAa,gBAAgB;CAC9B;AAED,oBAAY,oBAAoB;IAC9B,YAAY,iBAAiB;CAC9B;AAED,oBAAY,UAAU;IACpB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,UAAU;CAClB;AAED,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;CAI3B,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf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CAAyC,EAAE,MAAM,CAAC;IAClD,mDAAmD,EAAE,MAAM,CAAC;IAC5D,sDAAsD,EAAE,WAAW,CAAC;IACpE,mCAAmC,EAAE,WAAW,CAAC;CAClD;AAED,UAAU,WAAW;IACnB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAClB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;KAClC,CAAC;CACH"}
|
|
@@ -16,12 +16,14 @@ export declare const addUserToGroupSchema: z.ZodObject<{
|
|
|
16
16
|
export declare const generateConnectUrlsSchema: z.ZodObject<{
|
|
17
17
|
meshNodeId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
18
18
|
userId: z.ZodString;
|
|
19
|
+
isApplet: z.ZodPipe<z.ZodOptional<z.ZodBoolean>, z.ZodTransform<boolean | undefined, boolean | undefined>>;
|
|
19
20
|
}, z.core.$strip>;
|
|
20
21
|
export declare const getEndpointInstallScriptSchema: z.ZodObject<{
|
|
21
22
|
clientId: z.ZodNumber;
|
|
22
23
|
siteId: z.ZodNumber;
|
|
23
24
|
agentType: z.ZodEnum<typeof AgentTypes>;
|
|
24
25
|
endpointUrl: z.ZodURL;
|
|
26
|
+
installerToken: z.ZodString;
|
|
25
27
|
os: z.ZodEnum<typeof OperatingSystems>;
|
|
26
28
|
}, z.core.$strict>;
|
|
27
29
|
export type GenerateDownloadLinkRequest = z.infer<typeof generateDownloadLinkSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACL,UAAU,EACV,gBAAgB,EAGjB,MAAM,IAAI,CAAC;AAEZ,eAAO,MAAM,0BAA0B;;;iBAkEpC,CAAC;AAEJ,eAAO,MAAM,uBAAuB;;;iBA+BlC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;iBAkH9B,CAAC;AAEJ,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EACL,UAAU,EACV,gBAAgB,EAGjB,MAAM,IAAI,CAAC;AAEZ,eAAO,MAAM,0BAA0B;;;iBAkEpC,CAAC;AAEJ,eAAO,MAAM,uBAAuB;;;iBA+BlC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;iBAkH9B,CAAC;AAEJ,eAAO,MAAM,yBAAyB;;;;iBAmEpC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;kBA8BvC,CAAC;AAEL,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,0BAA0B,CAClC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,yBAAyB,CACjC,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -195,6 +195,14 @@ exports.generateConnectUrlsSchema = zod_1.default.object({
|
|
|
195
195
|
}, {
|
|
196
196
|
message: "User ID cannot contain consecutive dots",
|
|
197
197
|
}),
|
|
198
|
+
isApplet: zod_1.default
|
|
199
|
+
.boolean()
|
|
200
|
+
.optional()
|
|
201
|
+
.describe("Indicates whether the connection URL is for an applet or standard application")
|
|
202
|
+
.refine((value) => value === undefined || typeof value === "boolean", {
|
|
203
|
+
message: "isApplet must be a boolean value",
|
|
204
|
+
})
|
|
205
|
+
.transform((value) => (value === undefined ? undefined : Boolean(value))),
|
|
198
206
|
});
|
|
199
207
|
exports.getEndpointInstallScriptSchema = zod_1.default
|
|
200
208
|
.object({
|
|
@@ -216,6 +224,7 @@ exports.getEndpointInstallScriptSchema = zod_1.default
|
|
|
216
224
|
.regex(/^https:\/\//, "Endpoint URL must use HTTPS")
|
|
217
225
|
.max(4096, "Endpoint URL too long")
|
|
218
226
|
.describe("Direct download URL for the endpoint installer"),
|
|
227
|
+
installerToken: zod_1.default.string().describe("EPM installer token"),
|
|
219
228
|
os: zod_1.default
|
|
220
229
|
.enum(__1.OperatingSystems)
|
|
221
230
|
.describe("Target operating system for the installation script"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meru2802/aux-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Nexus EPM auxillary server to facilitate additional functionality required by Scogo Iceberg",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"author": "meru2802",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@meru2802/rmm-lib": "^1.0.
|
|
33
|
+
"@meru2802/rmm-lib": "^1.0.6",
|
|
34
34
|
"axios": "^1.9.0",
|
|
35
35
|
"base-64": "^1.0.0",
|
|
36
36
|
"cookie-parser": "^1.4.7",
|
|
37
37
|
"cors": "^2.8.5",
|
|
38
38
|
"express": "^4.19.2",
|
|
39
39
|
"helmet": "^8.0.0",
|
|
40
|
+
"https-proxy-agent": "^7.0.6",
|
|
40
41
|
"pg": "^8.16.0",
|
|
41
42
|
"qs": "^6.14.0",
|
|
42
43
|
"swagger-jsdoc": "^6.2.8",
|