Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
chore: switch to axios
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Dec 22, 2023
1 parent 58fd55c commit 26c8e2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions backend/routers/index.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 26c8e2f

Please sign in to comment.