bdy 1.12.4-dev → 1.12.5-beta
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
|
@@ -20,12 +20,16 @@ const output_1 = __importDefault(require("../output"));
|
|
|
20
20
|
const texts_1 = require("../texts");
|
|
21
21
|
const eventsource_1 = require("eventsource");
|
|
22
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
|
}
|
|
27
31
|
const tokenParts = context_1.token.split('_');
|
|
28
|
-
const isDevToken =
|
|
32
|
+
const isDevToken = checkIfIsDevToken(context_1.token);
|
|
29
33
|
const devServiceUrl = Buffer.from(tokenParts[3], 'base64url').toString('utf-8');
|
|
30
34
|
if (isDevToken) {
|
|
31
35
|
if (devServiceUrl.includes('local.io')) {
|
|
@@ -279,6 +283,7 @@ async function downloadScrapPackage(buildId) {
|
|
|
279
283
|
async function sendRequest({ path, payload, multipart, }) {
|
|
280
284
|
const fullUrl = new URL(path, getServiceUrl());
|
|
281
285
|
output_1.default.debug((0, texts_1.LOG_SENDING_REQUEST)(fullUrl.toString()));
|
|
286
|
+
const isDevToken = checkIfIsDevToken(context_1.token);
|
|
282
287
|
const init = {
|
|
283
288
|
method: 'GET',
|
|
284
289
|
redirect: 'follow',
|
|
@@ -286,6 +291,13 @@ async function sendRequest({ path, payload, multipart, }) {
|
|
|
286
291
|
'X-CLI-VERSION': context_1.cliVersion,
|
|
287
292
|
'X-TOKEN': context_1.token,
|
|
288
293
|
},
|
|
294
|
+
dispatcher: isDevToken
|
|
295
|
+
? new undici_1.Agent({
|
|
296
|
+
connect: {
|
|
297
|
+
rejectUnauthorized: false,
|
|
298
|
+
},
|
|
299
|
+
})
|
|
300
|
+
: undefined,
|
|
289
301
|
};
|
|
290
302
|
if (payload && !multipart) {
|
|
291
303
|
init.method = 'POST';
|