amiudmodz 5.0.7 → 5.0.8
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/lib/Utils/messages-media.js +16 -3
- package/package.json +1 -1
|
@@ -391,7 +391,19 @@ async function generateThumbnail(file, mediaType, options) {
|
|
|
391
391
|
exports.generateThumbnail = generateThumbnail;
|
|
392
392
|
const getHttpStream = async (url, options = {}) => {
|
|
393
393
|
const { default: axios } = await import('axios');
|
|
394
|
-
const fetched = await axios.get(url.toString(), {
|
|
394
|
+
const fetched = await axios.get(url.toString(), {
|
|
395
|
+
...options,
|
|
396
|
+
responseType: 'stream',
|
|
397
|
+
maxContentLength: Infinity,
|
|
398
|
+
maxBodyLength: Infinity,
|
|
399
|
+
decompress: false,
|
|
400
|
+
headers: {
|
|
401
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
402
|
+
'Accept': '*/*',
|
|
403
|
+
'Accept-Encoding': 'identity',
|
|
404
|
+
...options.headers,
|
|
405
|
+
}
|
|
406
|
+
});
|
|
395
407
|
return fetched.data;
|
|
396
408
|
};
|
|
397
409
|
exports.getHttpStream = getHttpStream;
|
|
@@ -414,7 +426,7 @@ const prepareStream = async (media, mediaType, { logger, saveOriginalFileIfRequi
|
|
|
414
426
|
didSaveToTmpPath = true;
|
|
415
427
|
}
|
|
416
428
|
|
|
417
|
-
const writeStream =
|
|
429
|
+
const writeStream = didSaveToTmpPath ? (0, fs_1.createWriteStream)(bodyPath) : undefined;
|
|
418
430
|
|
|
419
431
|
try {
|
|
420
432
|
for await (const chunk of stream) {
|
|
@@ -737,10 +749,11 @@ const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options },
|
|
|
737
749
|
'Origin': Defaults_1.DEFAULT_ORIGIN
|
|
738
750
|
},
|
|
739
751
|
httpsAgent: fetchAgent,
|
|
740
|
-
timeout: timeoutMs,
|
|
752
|
+
timeout: timeoutMs || Defaults_1.UPLOAD_TIMEOUT,
|
|
741
753
|
responseType: 'json',
|
|
742
754
|
maxBodyLength: Infinity,
|
|
743
755
|
maxContentLength: Infinity,
|
|
756
|
+
decompress: false
|
|
744
757
|
});
|
|
745
758
|
result = body.data;
|
|
746
759
|
if ((result === null || result === void 0 ? void 0 : result.url) || (result === null || result === void 0 ? void 0 : result.directPath)) {
|