@neoxr/wb 2.6.3 → 2.6.5
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/package.json +1 -1
- package/system/functions.js +21 -20
package/package.json
CHANGED
package/system/functions.js
CHANGED
|
@@ -323,12 +323,12 @@ module.exports = class Function {
|
|
|
323
323
|
mime = await (await fromBuffer(source)).mime
|
|
324
324
|
ext = await (await fromBuffer(source)).ext
|
|
325
325
|
} catch {
|
|
326
|
-
mime = require('mime-types').lookup(filename ? filename.split
|
|
326
|
+
mime = require('mime-types').lookup(filename ? filename.split`.`.pop() : 'txt')
|
|
327
327
|
ext = require('mime-types').extension(mime)
|
|
328
328
|
}
|
|
329
|
-
const extension = filename ? filename.split
|
|
329
|
+
const extension = filename ? filename.split`.`.pop() : ext
|
|
330
330
|
const size = Buffer.byteLength(source)
|
|
331
|
-
const filepath = 'temp/' + (this.uuid() + '.' +
|
|
331
|
+
const filepath = 'temp/' + (this.uuid() + '.' + extension)
|
|
332
332
|
const file = fs.writeFileSync(filepath, source)
|
|
333
333
|
const name = filename || path.basename(filepath)
|
|
334
334
|
return new Promise(resolve => {
|
|
@@ -344,9 +344,9 @@ module.exports = class Function {
|
|
|
344
344
|
return resolve(data)
|
|
345
345
|
})
|
|
346
346
|
} else if (source.startsWith('./') || source.startsWith('/')) {
|
|
347
|
-
const mime = require('mime-types').lookup(filename ? filename.split
|
|
347
|
+
const mime = require('mime-types').lookup(filename ? filename.split`.`.pop() : source.split`.`.pop())
|
|
348
348
|
const ext = require('mime-types').extension(mime)
|
|
349
|
-
const extension = filename ? filename.split
|
|
349
|
+
const extension = filename ? filename.split`.`.pop() : ext
|
|
350
350
|
const size = fs.statSync(source).size
|
|
351
351
|
const name = filename || path.basename(source)
|
|
352
352
|
return new Promise(resolve => {
|
|
@@ -355,7 +355,7 @@ module.exports = class Function {
|
|
|
355
355
|
file: source,
|
|
356
356
|
filename: name,
|
|
357
357
|
mime: mime,
|
|
358
|
-
extension:
|
|
358
|
+
extension: extension,
|
|
359
359
|
size: this.formatSize(size),
|
|
360
360
|
bytes: size
|
|
361
361
|
}
|
|
@@ -366,21 +366,21 @@ module.exports = class Function {
|
|
|
366
366
|
try {
|
|
367
367
|
const mg = new Miniget(source, {
|
|
368
368
|
headers: {
|
|
369
|
-
"Accept": "*/*",
|
|
370
|
-
"Cache-Control": "no-cache",
|
|
371
|
-
"Connection": "Keep-Alive",
|
|
369
|
+
// "Accept": "*/*",
|
|
370
|
+
// "Cache-Control": "no-cache",
|
|
371
|
+
// "Connection": "Keep-Alive",
|
|
372
372
|
"Dnt": "1",
|
|
373
|
-
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
374
|
-
"sec-ch-ua": '"Chromium";v="107", "Not=A?Brand";v="24"',
|
|
375
|
-
"sec-ch-ua-platform": "Android",
|
|
376
|
-
"sec-fetch-dest": "empty",
|
|
377
|
-
"sec-fetch-mode": "cors",
|
|
378
|
-
"sec-fetch-site": "same-origin",
|
|
379
|
-
"Pragma": "no-cache",
|
|
380
|
-
"Priority": "u=1, i",
|
|
381
|
-
"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
|
373
|
+
// "Referrer-Policy": "strict-origin-when-cross-origin",
|
|
374
|
+
// "sec-ch-ua": '"Chromium";v="107", "Not=A?Brand";v="24"',
|
|
375
|
+
// "sec-ch-ua-platform": "Android",
|
|
376
|
+
// "sec-fetch-dest": "empty",
|
|
377
|
+
// "sec-fetch-mode": "cors",
|
|
378
|
+
// "sec-fetch-site": "same-origin",
|
|
379
|
+
// "Pragma": "no-cache",
|
|
380
|
+
// "Priority": "u=1, i",
|
|
381
|
+
// "User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
|
382
382
|
"Upgrade-Insecure-Requests": "1",
|
|
383
|
-
"X-Requested-With": "XMLHttpRequest",
|
|
383
|
+
// "X-Requested-With": "XMLHttpRequest",
|
|
384
384
|
...options
|
|
385
385
|
}
|
|
386
386
|
})
|
|
@@ -406,8 +406,9 @@ module.exports = class Function {
|
|
|
406
406
|
})
|
|
407
407
|
return
|
|
408
408
|
}
|
|
409
|
-
const extension = filename ? filename.split
|
|
409
|
+
const extension = filename ? filename.split`.`.pop() : mime.extension(response.headers['content-type'])
|
|
410
410
|
const file = fs.createWriteStream(`temp/${this.uuid() + '.' + extension}`)
|
|
411
|
+
console.log(file)
|
|
411
412
|
const name = filename || path.basename(file.path)
|
|
412
413
|
const transformStream = new stream.Transform({
|
|
413
414
|
transform(chunk, encoding, callback) {
|