mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-11 04:33:02 +02:00
Remove node-fetch
This commit is contained in:
parent
7782c120bf
commit
984d4362a5
14 changed files with 30 additions and 131 deletions
|
@ -1,7 +1,5 @@
|
|||
// @ts-check
|
||||
|
||||
const fetch = require("node-fetch").default
|
||||
|
||||
const passthrough = require("../passthrough")
|
||||
const {sync, db, select} = passthrough
|
||||
/** @type {import("./mreq")} */
|
||||
|
@ -47,7 +45,7 @@ async function uploadDiscordFileToMxc(path) {
|
|||
}
|
||||
|
||||
// Download from Discord
|
||||
const promise = fetch(url, {}).then(/** @param {import("node-fetch").Response} res */ async res => {
|
||||
const promise = fetch(url, {}).then(async res => {
|
||||
// Upload to Matrix
|
||||
const root = await module.exports._actuallyUploadDiscordFileToMxc(urlNoExpiry, res)
|
||||
|
||||
|
@ -62,6 +60,10 @@ async function uploadDiscordFileToMxc(path) {
|
|||
return promise
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @param {Response} res
|
||||
*/
|
||||
async function _actuallyUploadDiscordFileToMxc(url, res) {
|
||||
const body = res.body
|
||||
/** @type {import("../types").R.FileUploaded} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue