chore: switch to axios

pull/250/head
William Harrison 1 year ago
parent 58fd55cfa6
commit 26c8e2f5f5

@ -1,9 +1,9 @@
import { BusBoyFile, AssFile } from 'ass';
import axios from 'axios';
import fs from 'fs-extra';
import bb from 'express-busboy';
import crypto from 'crypto';
import fetch from 'node-fetch';
import { Router } from 'express';
import { Readable } from 'stream';
@ -93,12 +93,10 @@ router.post('/', rateLimiterMiddleware("upload", UserConfig.config?.rateLimit?.u
// Send to Discord webhook
try {
await fetch(UserConfig.config.discordWebhook, {
method: "POST",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ content: `New upload: ${req.ass.host}/${assFile.fakeid}` })
await axios.post(UserConfig.config.discordWebhook, {
body: JSON.stringify({
content: `New upload: ${req.ass.host}/${assFile.fakeid}`
})
})
} catch (err) {
log.warn("Failed to send request to Discord webhook");

@ -42,6 +42,7 @@
"@xoi/gps-metadata-remover": "^1.1.2",
"any-shell-escape": "^0.1.1",
"autoprefixer": "^10.4.16",
"axios": "^1.6.2",
"bcrypt": "^5.1.1",
"crypto-random-string": "3.3.1",
"cssnano": "^6.0.1",
@ -54,7 +55,6 @@
"luxon": "^3.4.4",
"memorystore": "^1.6.7",
"mysql2": "^3.6.5",
"node-fetch": "^3.3.2",
"node-vibrant": "^3.1.6",
"pg": "^8.11.3",
"pug": "^3.0.2",

Loading…
Cancel
Save