bdy 1.20.5-stage → 1.21.0-dev
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/distTs/package.json +1 -1
- package/distTs/src/agent/linux.js +2 -0
- package/distTs/src/agent/osx.js +2 -0
- package/distTs/src/agent/system.js +43 -40
- package/distTs/src/command/agent/install.js +2 -2
- package/distTs/src/command/tunnel/http.js +1 -1
- package/distTs/src/command/tunnel/start.js +1 -1
- package/distTs/src/command/tunnel/tcp.js +1 -1
- package/distTs/src/command/tunnel/tls.js +1 -1
- package/distTs/src/tunnel/api/buddy.js +2 -1
- package/distTs/src/tunnel/server/sftp.js +28 -8
- package/distTs/src/utils.js +16 -1
- package/package.json +1 -1
package/distTs/package.json
CHANGED
|
@@ -77,6 +77,7 @@ WantedBy=multi-user.target`;
|
|
|
77
77
|
await this.downloadBinaryArchive();
|
|
78
78
|
logger_1.default.info(texts_1.LOG_AGENT_EXTRACTING_ARCHIVE);
|
|
79
79
|
await this.extractBinaryArchive();
|
|
80
|
+
await this.fixBinaryRights();
|
|
80
81
|
logger_1.default.info(texts_1.LOG_AGENT_SYSTEM_SERVICE_CONFIG);
|
|
81
82
|
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, user, debug));
|
|
82
83
|
logger_1.default.info(texts_1.LOG_AGENT_ENABLING_SYSTEM);
|
|
@@ -99,6 +100,7 @@ WantedBy=multi-user.target`;
|
|
|
99
100
|
await this.downloadBinaryArchive();
|
|
100
101
|
logger_1.default.info(texts_1.LOG_AGENT_EXTRACTING_ARCHIVE);
|
|
101
102
|
await this.extractBinaryArchive();
|
|
103
|
+
await this.fixBinaryRights();
|
|
102
104
|
logger_1.default.info(texts_1.LOG_AGENT_STARTING_SYSTEM);
|
|
103
105
|
await this.start();
|
|
104
106
|
}
|
package/distTs/src/agent/osx.js
CHANGED
|
@@ -94,6 +94,7 @@ class AgentOsx extends system_1.default {
|
|
|
94
94
|
await this.downloadBinaryArchive();
|
|
95
95
|
logger_1.default.info(texts_1.LOG_AGENT_EXTRACTING_ARCHIVE);
|
|
96
96
|
await this.extractBinaryArchive();
|
|
97
|
+
await this.fixBinaryRights();
|
|
97
98
|
logger_1.default.info(texts_1.LOG_AGENT_SYSTEM_SERVICE_CONFIG);
|
|
98
99
|
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, user, debug));
|
|
99
100
|
logger_1.default.info(texts_1.LOG_AGENT_ENABLING_SYSTEM);
|
|
@@ -116,6 +117,7 @@ class AgentOsx extends system_1.default {
|
|
|
116
117
|
await this.downloadBinaryArchive();
|
|
117
118
|
logger_1.default.info(texts_1.LOG_AGENT_EXTRACTING_ARCHIVE);
|
|
118
119
|
await this.extractBinaryArchive();
|
|
120
|
+
await this.fixBinaryRights();
|
|
119
121
|
logger_1.default.info(texts_1.LOG_AGENT_STARTING_SYSTEM);
|
|
120
122
|
await this.start();
|
|
121
123
|
logger_1.default.info(texts_1.LOG_AGENT_ENABLED);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
7
|
const https_1 = __importDefault(require("https"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const utils_1 = require("../utils");
|
|
@@ -73,11 +73,11 @@ class AgentSystem {
|
|
|
73
73
|
.then(({ default: decompress }) => {
|
|
74
74
|
decompress(source, dest)
|
|
75
75
|
.then(() => {
|
|
76
|
-
(0,
|
|
76
|
+
(0, node_fs_1.rmSync)(source, { force: true });
|
|
77
77
|
resolve();
|
|
78
78
|
})
|
|
79
79
|
.catch((err) => {
|
|
80
|
-
(0,
|
|
80
|
+
(0, node_fs_1.rmSync)(source, { force: true });
|
|
81
81
|
reject(err);
|
|
82
82
|
});
|
|
83
83
|
})
|
|
@@ -87,57 +87,51 @@ class AgentSystem {
|
|
|
87
87
|
extractBinaryArchive() {
|
|
88
88
|
return this.extractArchive(this.getBinaryArchivePath(), this.getSystemConfigDir());
|
|
89
89
|
}
|
|
90
|
+
fixBinaryRights() {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
(0, node_fs_1.chmod)(this.getSystemBinaryPath(), 0o777, (err) => {
|
|
93
|
+
if (err)
|
|
94
|
+
reject(err);
|
|
95
|
+
else
|
|
96
|
+
resolve();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
90
100
|
loadSystemConfig() {
|
|
91
|
-
const str = (0,
|
|
101
|
+
const str = (0, node_fs_1.readFileSync)(this.getSystemConfigPath(), 'utf-8');
|
|
92
102
|
return JSON.parse(str);
|
|
93
103
|
}
|
|
94
104
|
loadStandaloneProcConfig() {
|
|
95
|
-
return (0,
|
|
96
|
-
}
|
|
97
|
-
isStandaloneProcRunning() {
|
|
98
|
-
let pid;
|
|
99
|
-
try {
|
|
100
|
-
const str = this.loadStandaloneProcConfig();
|
|
101
|
-
pid = Number.parseInt(str, 10);
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
try {
|
|
107
|
-
process.kill(pid, 0);
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
return err.code === 'EPERM';
|
|
112
|
-
}
|
|
105
|
+
return (0, node_fs_1.readFileSync)(this.getSystemStandalonePath(), 'utf-8');
|
|
113
106
|
}
|
|
114
107
|
loadNewAgentConfig() {
|
|
115
|
-
const exists = (0,
|
|
108
|
+
const exists = (0, node_fs_1.existsSync)(this.getAgentConfigPath());
|
|
116
109
|
if (exists) {
|
|
117
|
-
(0,
|
|
110
|
+
(0, node_fs_1.cpSync)(this.getAgentConfigPath(), this.getNewAgentConfigPath(), {
|
|
118
111
|
force: true,
|
|
119
112
|
});
|
|
113
|
+
(0, node_fs_1.chmodSync)(this.getNewAgentConfigPath(), 0o666);
|
|
120
114
|
this.clearAgentFiles();
|
|
121
115
|
}
|
|
122
|
-
const str = (0,
|
|
116
|
+
const str = (0, node_fs_1.readFileSync)(this.getNewAgentConfigPath(), 'utf-8');
|
|
123
117
|
return JSON.parse(str);
|
|
124
118
|
}
|
|
125
119
|
clearSystemFiles() {
|
|
126
|
-
(0,
|
|
127
|
-
(0,
|
|
120
|
+
(0, node_fs_1.rmSync)(this.getSystemBinaryPath(), { force: true });
|
|
121
|
+
(0, node_fs_1.rmSync)(this.getSystemConfigPath(), { force: true });
|
|
128
122
|
}
|
|
129
123
|
clearAgentFiles() {
|
|
130
|
-
(0,
|
|
124
|
+
(0, node_fs_1.rmSync)(this.getAgentConfigPath(), { force: true });
|
|
131
125
|
}
|
|
132
126
|
clearNewAgentFiles() {
|
|
133
|
-
(0,
|
|
127
|
+
(0, node_fs_1.rmSync)(this.getNewAgentConfigPath(), { force: true });
|
|
134
128
|
}
|
|
135
129
|
ensureSystemConfigDir() {
|
|
136
|
-
(0,
|
|
130
|
+
(0, node_fs_1.mkdirSync)(this.getSystemConfigDir(), { recursive: true, mode: 0o777 });
|
|
137
131
|
}
|
|
138
132
|
saveFile(p, c) {
|
|
139
133
|
return new Promise((resolve, reject) => {
|
|
140
|
-
(0,
|
|
134
|
+
(0, node_fs_1.writeFile)(p, c, { encoding: 'utf-8', mode: 0o666 }, (err) => {
|
|
141
135
|
if (!err)
|
|
142
136
|
resolve();
|
|
143
137
|
else
|
|
@@ -153,11 +147,11 @@ class AgentSystem {
|
|
|
153
147
|
}
|
|
154
148
|
downloadFile(url, dest) {
|
|
155
149
|
return new Promise((resolve, reject) => {
|
|
156
|
-
const file = (0,
|
|
150
|
+
const file = (0, node_fs_1.createWriteStream)(dest, { mode: 0o666 });
|
|
157
151
|
const request = https_1.default.get(url, (response) => {
|
|
158
152
|
if (response.statusCode !== 200) {
|
|
159
153
|
file.close();
|
|
160
|
-
(0,
|
|
154
|
+
(0, node_fs_1.rmSync)(dest);
|
|
161
155
|
reject(new Error('File not found'));
|
|
162
156
|
return;
|
|
163
157
|
}
|
|
@@ -173,7 +167,7 @@ class AgentSystem {
|
|
|
173
167
|
});
|
|
174
168
|
request.once('error', (err) => {
|
|
175
169
|
file.close();
|
|
176
|
-
(0,
|
|
170
|
+
(0, node_fs_1.rmSync)(dest);
|
|
177
171
|
reject(err);
|
|
178
172
|
});
|
|
179
173
|
});
|
|
@@ -263,7 +257,7 @@ class AgentSystem {
|
|
|
263
257
|
try {
|
|
264
258
|
logger_1.default.info(texts_1.LOG_REMOVING_AGENT_PROC_ID);
|
|
265
259
|
this.ensureSystemConfigDir();
|
|
266
|
-
(0,
|
|
260
|
+
(0, node_fs_1.rmSync)(this.getSystemStandalonePath(), {
|
|
267
261
|
force: true,
|
|
268
262
|
});
|
|
269
263
|
return true;
|
|
@@ -278,7 +272,10 @@ class AgentSystem {
|
|
|
278
272
|
try {
|
|
279
273
|
logger_1.default.info(texts_1.LOG_SAVING_AGENT_PROC_ID);
|
|
280
274
|
this.ensureSystemConfigDir();
|
|
281
|
-
(0,
|
|
275
|
+
(0, node_fs_1.writeFileSync)(this.getSystemStandalonePath(), String(process.pid), {
|
|
276
|
+
encoding: 'utf-8',
|
|
277
|
+
mode: 0o666,
|
|
278
|
+
});
|
|
282
279
|
return true;
|
|
283
280
|
}
|
|
284
281
|
catch (err) {
|
|
@@ -300,14 +297,17 @@ class AgentSystem {
|
|
|
300
297
|
try {
|
|
301
298
|
logger_1.default.info(texts_1.LOG_SAVING_AGENT_SYSTEM_CONFIG);
|
|
302
299
|
this.ensureSystemConfigDir();
|
|
303
|
-
(0,
|
|
300
|
+
(0, node_fs_1.writeFileSync)(this.getSystemConfigPath(), JSON.stringify({
|
|
304
301
|
id,
|
|
305
302
|
host,
|
|
306
303
|
token,
|
|
307
304
|
port,
|
|
308
305
|
standalone,
|
|
309
306
|
debug,
|
|
310
|
-
}),
|
|
307
|
+
}), {
|
|
308
|
+
encoding: 'utf-8',
|
|
309
|
+
mode: 0o666,
|
|
310
|
+
});
|
|
311
311
|
return true;
|
|
312
312
|
}
|
|
313
313
|
catch (err) {
|
|
@@ -325,9 +325,12 @@ class AgentSystem {
|
|
|
325
325
|
}
|
|
326
326
|
try {
|
|
327
327
|
logger_1.default.info(texts_1.LOG_SAVING_AGENT_LOCAL_CONFIG);
|
|
328
|
-
(0,
|
|
328
|
+
(0, node_fs_1.writeFileSync)(this.getNewAgentConfigPath(), JSON.stringify({
|
|
329
329
|
sshHostKey,
|
|
330
|
-
}),
|
|
330
|
+
}), {
|
|
331
|
+
encoding: 'utf-8',
|
|
332
|
+
mode: 0o666,
|
|
333
|
+
});
|
|
331
334
|
return true;
|
|
332
335
|
}
|
|
333
336
|
catch (err) {
|
|
@@ -90,7 +90,7 @@ const installService = async (options) => {
|
|
|
90
90
|
}
|
|
91
91
|
if (!agent) {
|
|
92
92
|
const tags = prepareTags(options.tag);
|
|
93
|
-
agent = await ApiBuddy.register(true, target, tunneling, proxy, host, token, tags, (region) => {
|
|
93
|
+
agent = await ApiBuddy.register(true, target, tunneling, proxy, host, token, tags, (0, utils_1.getServiceUser)(options.user, options.pass), (region) => {
|
|
94
94
|
cfg_1.default.setRegionIfNotSet(region);
|
|
95
95
|
});
|
|
96
96
|
id = agent.id;
|
|
@@ -159,7 +159,7 @@ const installApp = async (options) => {
|
|
|
159
159
|
const tags = prepareTags(options.tag);
|
|
160
160
|
try {
|
|
161
161
|
output_1.default.normal(texts_1.TXT_AGENT_STANDALONE_AGENT_REGISTERING, false);
|
|
162
|
-
const agent = await ApiBuddy.register(true, !!options.target, !!options.tunnels, !!options.proxy, host, token, tags, (region) => {
|
|
162
|
+
const agent = await ApiBuddy.register(true, !!options.target, !!options.tunnels, !!options.proxy, host, token, tags, (0, utils_1.getCurrentUser)(), (region) => {
|
|
163
163
|
cfg_1.default.setRegionIfNotSet(region);
|
|
164
164
|
});
|
|
165
165
|
logger_1.default.info(texts_1.TXT_AGENT_STANDALONE_AGENT_REGISTERED);
|
|
@@ -20,7 +20,7 @@ commandHttp.action(async (target, options) => {
|
|
|
20
20
|
const { host, token } = await Input.tunnelToken(options.token);
|
|
21
21
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.HTTP, target, options, true);
|
|
22
22
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
23
|
-
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
23
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), (region) => {
|
|
24
24
|
Cfg.setRegionIfNotSet(region);
|
|
25
25
|
});
|
|
26
26
|
await agent.start();
|
|
@@ -20,7 +20,7 @@ commandStart.action(async (name, options) => {
|
|
|
20
20
|
const { token, host } = await Input.tunnelToken(options.token);
|
|
21
21
|
const prepared = Cfg.getTunnel(name);
|
|
22
22
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
23
|
-
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
23
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), (region) => {
|
|
24
24
|
Cfg.setRegionIfNotSet(region);
|
|
25
25
|
});
|
|
26
26
|
await agent.start();
|
|
@@ -19,7 +19,7 @@ commandTcp.action(async (target, options) => {
|
|
|
19
19
|
const { host, token } = await Input.tunnelToken(options.token);
|
|
20
20
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TCP, target, options, true);
|
|
21
21
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
22
|
-
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
22
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), (region) => {
|
|
23
23
|
Cfg.setRegionIfNotSet(region);
|
|
24
24
|
});
|
|
25
25
|
await agent.start();
|
|
@@ -19,7 +19,7 @@ commandTls.action(async (target, options) => {
|
|
|
19
19
|
const { token, host } = await Input.tunnelToken(options.token);
|
|
20
20
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TLS, target, options, true);
|
|
21
21
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
22
|
-
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (region) => {
|
|
22
|
+
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), (region) => {
|
|
23
23
|
Cfg.setRegionIfNotSet(region);
|
|
24
24
|
});
|
|
25
25
|
await agent.start();
|
|
@@ -53,7 +53,7 @@ const makeRequest = async (host, path, body, method = 'POST', respAsJson = true,
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
class ApiBuddyClass {
|
|
56
|
-
async register(service, target, tunneling, proxy, host, token, tags, onDefaultRegion) {
|
|
56
|
+
async register(service, target, tunneling, proxy, host, token, tags, user, onDefaultRegion) {
|
|
57
57
|
const version = (0, utils_1.getVersion)();
|
|
58
58
|
const hostname = (0, utils_1.getHostname)();
|
|
59
59
|
const platform = (0, utils_1.getPlatform)();
|
|
@@ -65,6 +65,7 @@ class ApiBuddyClass {
|
|
|
65
65
|
platform,
|
|
66
66
|
service,
|
|
67
67
|
tags,
|
|
68
|
+
user,
|
|
68
69
|
target,
|
|
69
70
|
tunneling,
|
|
70
71
|
proxy
|
|
@@ -6,9 +6,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const logger_1 = __importDefault(require("../../logger"));
|
|
7
7
|
const ssh2_1 = __importDefault(require("ssh2"));
|
|
8
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const fs_1 = require("fs");
|
|
9
10
|
const path_1 = require("path");
|
|
10
11
|
const node_os_1 = require("node:os");
|
|
11
|
-
const {
|
|
12
|
+
const { STATUS_CODE } = ssh2_1.default.utils.sftp;
|
|
13
|
+
var SftpOpenFlag;
|
|
14
|
+
(function (SftpOpenFlag) {
|
|
15
|
+
SftpOpenFlag[SftpOpenFlag["READ"] = 1] = "READ";
|
|
16
|
+
SftpOpenFlag[SftpOpenFlag["WRITE"] = 2] = "WRITE";
|
|
17
|
+
SftpOpenFlag[SftpOpenFlag["APPEND"] = 4] = "APPEND";
|
|
18
|
+
SftpOpenFlag[SftpOpenFlag["CREAT"] = 8] = "CREAT";
|
|
19
|
+
SftpOpenFlag[SftpOpenFlag["TRUNC"] = 16] = "TRUNC";
|
|
20
|
+
SftpOpenFlag[SftpOpenFlag["EXCL"] = 32] = "EXCL";
|
|
21
|
+
})(SftpOpenFlag || (SftpOpenFlag = {}));
|
|
22
|
+
function sftpFlagsToPosix(flags) {
|
|
23
|
+
const read = !!(flags & SftpOpenFlag.READ);
|
|
24
|
+
const write = !!(flags & SftpOpenFlag.WRITE);
|
|
25
|
+
let f = read && write ? fs_1.constants.O_RDWR
|
|
26
|
+
: write ? fs_1.constants.O_WRONLY
|
|
27
|
+
: fs_1.constants.O_RDONLY;
|
|
28
|
+
if (flags & SftpOpenFlag.APPEND)
|
|
29
|
+
f |= fs_1.constants.O_APPEND;
|
|
30
|
+
if (flags & SftpOpenFlag.CREAT)
|
|
31
|
+
f |= fs_1.constants.O_CREAT;
|
|
32
|
+
if (flags & SftpOpenFlag.TRUNC)
|
|
33
|
+
f |= fs_1.constants.O_TRUNC;
|
|
34
|
+
if (flags & SftpOpenFlag.EXCL)
|
|
35
|
+
f |= fs_1.constants.O_EXCL;
|
|
36
|
+
return f;
|
|
37
|
+
}
|
|
12
38
|
class ServerSftp {
|
|
13
39
|
openHandlers;
|
|
14
40
|
count;
|
|
@@ -63,16 +89,10 @@ class ServerSftp {
|
|
|
63
89
|
const p = this.fixPath(fileName);
|
|
64
90
|
const s = this.debugStart(`SFTP want to open file ${p}`);
|
|
65
91
|
try {
|
|
66
|
-
const flag = flagsToString(flags);
|
|
67
|
-
if (!flag) {
|
|
68
|
-
this.sftp.status(reqId, STATUS_CODE.FAILURE);
|
|
69
|
-
this.debugEnd('SFTP open file failed', s);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
92
|
const id = ++this.count;
|
|
73
93
|
const handle = Buffer.alloc(4);
|
|
74
94
|
handle.writeUint32BE(id, 0);
|
|
75
|
-
const fd = await promises_1.default.open(p,
|
|
95
|
+
const fd = await promises_1.default.open(p, sftpFlagsToPosix(flags), attrs?.mode ?? 0o666);
|
|
76
96
|
this.openHandlers.set(id, fd);
|
|
77
97
|
await this._fsetstat(fd, attrs);
|
|
78
98
|
this.sftp.handle(reqId, handle);
|
package/distTs/src/utils.js
CHANGED
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getCurrentVersionWithoutEnv = exports.getVersionWithoutEnv = exports.getVersion = exports.isInstalledByChoco = exports.isInstalledByApt = exports.isInstalledByBrew = exports.isInstalledByNpm = exports.tryGetEmail = exports.execLocally = exports.getHomeDirectory = exports.newCommand = exports.formatBytes = exports.formatHelp = exports.getPlatform = exports.getHostname = exports.isStringRegExp = exports.getWorkingDir = exports.getRootDir = exports.TARGET_ONLY_PORT_REGEX = exports.TARGET_HTTP_REGEX = exports.TARGET_TCP_TLS_REGEX = exports.ApiErrorTunnelsDisabled = exports.ApiErrorWorkspaceFlagged = exports.ApiErrorTunnelLimitReached = exports.ApiErrorAgentLimitReached = exports.ApiErrorDomainRestricted = exports.ApiErrorTargetInvalid = exports.ApiErrorWrongToken = exports.ApiErrorFailedToConnect = exports.ApiErrorAgentNotFound = exports.ARTIFACT_AUTH_TYPE = exports.ARTIFACT_SCOPE = exports.ARTIFACT_TYPE = exports.SANDBOX_SNAPSHOT_STATUS = exports.SANDBOX_APP_STATUS = exports.SANDBOX_SETUP_STATUS = exports.SANDBOX_EXEC_STATUS = exports.SANDBOX_EXEC_RUNTIME = exports.SANDBOX_STATUS = exports.REST_API_ENDPOINT = exports.REST_API_REGION = exports.SUGGESTED_BROWSER_VERSION = exports.DEFAULT_TIMEOUT = exports.TUNNEL_HTTP_CB_MIN_REQUESTS = exports.TUNNEL_HTTP_CB_WINDOW = exports.TUNNEL_MAX_REQUEST_SIZE_TO_SYNC = exports.TUNNEL_HTTP_LOG_MAX_REQUESTS = exports.TUNNEL_HTTP_LOG_MAX_BODY = exports.TUNNEL_HTTP_RATE_WINDOW = exports.TUNNEL_HTTP_RATE_LIMIT = void 0;
|
|
40
|
-
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = void 0;
|
|
40
|
+
exports.getBasicCommandTls = exports.getBasicCommandHttp = exports.getBasicCommandSandboxEndpoint = exports.getBasicCommandTcp = exports.getCurrentUser = exports.getServiceUser = exports.getRealTargetHost = exports.isWindows = exports.isLinux = exports.isOsx = exports.isDocker = exports.sleep = exports.getLatestVersion = exports.getVersionEnv = void 0;
|
|
41
41
|
exports.apiErrorCodeToClass = apiErrorCodeToClass;
|
|
42
42
|
exports.isFile = isFile;
|
|
43
43
|
exports.getAppWorkspaceUrl = getAppWorkspaceUrl;
|
|
@@ -506,6 +506,21 @@ const getRealTargetHost = (target) => {
|
|
|
506
506
|
return target || '';
|
|
507
507
|
};
|
|
508
508
|
exports.getRealTargetHost = getRealTargetHost;
|
|
509
|
+
const getServiceUser = (user, pass) => {
|
|
510
|
+
if ((0, exports.isWindows)()) {
|
|
511
|
+
if (user && pass)
|
|
512
|
+
return user;
|
|
513
|
+
return 'LocalSystem';
|
|
514
|
+
}
|
|
515
|
+
if (user)
|
|
516
|
+
return user;
|
|
517
|
+
return 'root';
|
|
518
|
+
};
|
|
519
|
+
exports.getServiceUser = getServiceUser;
|
|
520
|
+
const getCurrentUser = () => {
|
|
521
|
+
return node_os_1.default.userInfo().username;
|
|
522
|
+
};
|
|
523
|
+
exports.getCurrentUser = getCurrentUser;
|
|
509
524
|
const getBasicCommandTcp = () => {
|
|
510
525
|
const commandTcp = (0, exports.newCommand)('tcp');
|
|
511
526
|
commandTcp.alias('TCP');
|