Update index.js
Browse files
index.js
CHANGED
|
@@ -265,15 +265,25 @@ async function fileDitch(media, ext){
|
|
| 265 |
let mime = await fileTypeFromBuffer(media)
|
| 266 |
let form = new FormData()
|
| 267 |
|
| 268 |
-
form.append("files[]", media,
|
| 269 |
|
| 270 |
axios.post("https://up1.fileditch.com/temp/upload.php", form, {
|
| 271 |
headers: {
|
| 272 |
-
"User-Agent":
|
| 273 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
...form.getHeaders()
|
| 275 |
}
|
| 276 |
-
}).then(({ data }) => resolve(data?.files[0]?.url)).catch(reject(null))
|
| 277 |
})
|
| 278 |
//https://up1.fileditch.com/upload.php
|
| 279 |
}
|
|
@@ -942,7 +952,7 @@ result : {name: file?.name,
|
|
| 942 |
size: formatSize(file?.size) || "0 B",
|
| 943 |
mimetype: mimes.lookup(file?.name) || (await fileTypeFromBuffer(data))?.mime || "application/octet-stream",
|
| 944 |
ext: mimes.extension(mimes.lookup(file?.name)) || (await fileTypeFromBuffer(data))?.ext || file?.name?.split(".")[1] || "bin",
|
| 945 |
-
|
| 946 |
}
|
| 947 |
})
|
| 948 |
} catch (e) {
|
|
|
|
| 265 |
let mime = await fileTypeFromBuffer(media)
|
| 266 |
let form = new FormData()
|
| 267 |
|
| 268 |
+
form.append("files[]", media, `${Date.now()}.${ext ? ext : mime?.ext || "bin"}`)
|
| 269 |
|
| 270 |
axios.post("https://up1.fileditch.com/temp/upload.php", form, {
|
| 271 |
headers: {
|
| 272 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
| 273 |
+
"accept": "*/*",
|
| 274 |
+
"accept-language": "id;q=0.9",
|
| 275 |
+
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Brave\";v=\"128\"",
|
| 276 |
+
"sec-ch-ua-mobile": "?0",
|
| 277 |
+
"sec-ch-ua-platform": "\"Windows\"",
|
| 278 |
+
"sec-fetch-dest": "empty",
|
| 279 |
+
"sec-fetch-mode": "cors",
|
| 280 |
+
"sec-fetch-site": "same-site",
|
| 281 |
+
"sec-gpc": "1",
|
| 282 |
+
"Referer": "https://fileditch.com/",
|
| 283 |
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
| 284 |
...form.getHeaders()
|
| 285 |
}
|
| 286 |
+
}).then(({ data }) => { console.log(data); resolve(data?.files[0]?.url)}).catch(reject(null))
|
| 287 |
})
|
| 288 |
//https://up1.fileditch.com/upload.php
|
| 289 |
}
|
|
|
|
| 952 |
size: formatSize(file?.size) || "0 B",
|
| 953 |
mimetype: mimes.lookup(file?.name) || (await fileTypeFromBuffer(data))?.mime || "application/octet-stream",
|
| 954 |
ext: mimes.extension(mimes.lookup(file?.name)) || (await fileTypeFromBuffer(data))?.ext || file?.name?.split(".")[1] || "bin",
|
| 955 |
+
data: await fileDitch(Buffer.from(data)),
|
| 956 |
}
|
| 957 |
})
|
| 958 |
} catch (e) {
|