bdy 1.12.3-dev → 1.12.5-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
CHANGED
|
@@ -10,7 +10,7 @@ const utils_1 = require("../utils");
|
|
|
10
10
|
const node_fs_1 = require("node:fs");
|
|
11
11
|
const undici_1 = require("undici");
|
|
12
12
|
const token = process.env.BUDDY_UT_TOKEN || '';
|
|
13
|
-
const customServiceUrl = process.env.
|
|
13
|
+
const customServiceUrl = process.env.BUDDY_UT_SERVICE_URL;
|
|
14
14
|
function getServiceUrl() {
|
|
15
15
|
if (customServiceUrl) {
|
|
16
16
|
return customServiceUrl;
|
|
@@ -19,11 +19,24 @@ const node_fs_1 = require("node:fs");
|
|
|
19
19
|
const output_1 = __importDefault(require("../output"));
|
|
20
20
|
const texts_1 = require("../texts");
|
|
21
21
|
const eventsource_1 = require("eventsource");
|
|
22
|
-
const customServiceUrl = process.env.
|
|
22
|
+
const customServiceUrl = process.env.BUDDY_VT_SERVICE_URL;
|
|
23
|
+
function checkIfIsDevToken(token) {
|
|
24
|
+
const tokenParts = token.split('_');
|
|
25
|
+
return tokenParts.length === 5;
|
|
26
|
+
}
|
|
23
27
|
function getServiceUrl() {
|
|
24
28
|
if (customServiceUrl) {
|
|
25
29
|
return customServiceUrl;
|
|
26
30
|
}
|
|
31
|
+
const tokenParts = context_1.token.split('_');
|
|
32
|
+
const isDevToken = checkIfIsDevToken(context_1.token);
|
|
33
|
+
const devServiceUrl = Buffer.from(tokenParts[3], 'base64url').toString('utf-8');
|
|
34
|
+
if (isDevToken) {
|
|
35
|
+
if (devServiceUrl.includes('local.io')) {
|
|
36
|
+
throw new Error('Use BUDDY_VT_SERVICE_URL to set the service URL in this environment');
|
|
37
|
+
}
|
|
38
|
+
return devServiceUrl;
|
|
39
|
+
}
|
|
27
40
|
if (context_1.token.startsWith('bud_vt_eu')) {
|
|
28
41
|
return 'https://vt.eu.buddy.works';
|
|
29
42
|
}
|
|
@@ -270,6 +283,7 @@ async function downloadScrapPackage(buildId) {
|
|
|
270
283
|
async function sendRequest({ path, payload, multipart, }) {
|
|
271
284
|
const fullUrl = new URL(path, getServiceUrl());
|
|
272
285
|
output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(fullUrl.toString()));
|
|
286
|
+
const isDevToken = checkIfIsDevToken(context_1.token);
|
|
273
287
|
const init = {
|
|
274
288
|
method: 'GET',
|
|
275
289
|
redirect: 'follow',
|
|
@@ -277,6 +291,13 @@ async function sendRequest({ path, payload, multipart, }) {
|
|
|
277
291
|
'X-CLI-VERSION': context_1.cliVersion,
|
|
278
292
|
'X-TOKEN': context_1.token,
|
|
279
293
|
},
|
|
294
|
+
dispatcher: isDevToken
|
|
295
|
+
? new undici_1.Agent({
|
|
296
|
+
connect: {
|
|
297
|
+
rejectUnauthorized: false,
|
|
298
|
+
},
|
|
299
|
+
})
|
|
300
|
+
: undefined,
|
|
280
301
|
};
|
|
281
302
|
if (payload && !multipart) {
|
|
282
303
|
init.method = 'POST';
|