Type fixes

This commit is contained in:
Cadence Ember 2024-09-14 00:58:21 +12:00
parent 555d7cb126
commit d6dc5cb88f
4 changed files with 14 additions and 9 deletions

View file

@ -9,7 +9,7 @@ const {createServer} = require("http")
const {prompt} = require("enquirer") const {prompt} = require("enquirer")
const Input = require("enquirer/lib/prompts/input") const Input = require("enquirer/lib/prompts/input")
const fetch = require("node-fetch") const fetch = require("node-fetch").default
const {magenta, bold, cyan} = require("ansi-colors") const {magenta, bold, cyan} = require("ansi-colors")
const HeatSync = require("heatsync") const HeatSync = require("heatsync")
const {SnowTransfer} = require("snowtransfer") const {SnowTransfer} = require("snowtransfer")

View file

@ -10,7 +10,9 @@ function fakeSpecificReactionRemoval(userID, emoji, emojiID) {
channel_id: "THE_CHANNEL", channel_id: "THE_CHANNEL",
message_id: "THE_MESSAGE", message_id: "THE_MESSAGE",
user_id: userID, user_id: userID,
emoji: {id: emojiID, name: emoji} emoji: {id: emojiID, name: emoji},
burst: false,
type: 0
} }
} }

View file

@ -3,7 +3,7 @@
const Ty = require("../types") const Ty = require("../types")
const assert = require("assert").strict const assert = require("assert").strict
const fetch = require("node-fetch") const fetch = require("node-fetch").default
const passthrough = require("../passthrough") const passthrough = require("../passthrough")
const { discord, sync, db } = passthrough const { discord, sync, db } = passthrough
@ -315,7 +315,7 @@ async function ping() {
/** /**
* @param {string} mxc * @param {string} mxc
* @param {RequestInit} [init] * @param {fetch.RequestInit} [init]
*/ */
function getMedia(mxc, init = {}) { function getMedia(mxc, init = {}) {
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/) const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/)

View file

@ -1,8 +1,9 @@
// @ts-check // @ts-check
const assert = require("assert/strict")
const {defineEventHandler, getValidatedRouterParams, setResponseStatus, setResponseHeader, sendStream, createError} = require("h3") const {defineEventHandler, getValidatedRouterParams, setResponseStatus, setResponseHeader, sendStream, createError} = require("h3")
const {z} = require("zod") const {z} = require("zod")
const fetch = require("node-fetch") const fetch = require("node-fetch").default
/** @type {import("xxhash-wasm").XXHashAPI} */ // @ts-ignore /** @type {import("xxhash-wasm").XXHashAPI} */ // @ts-ignore
let hasher = null let hasher = null
@ -40,9 +41,11 @@ as.router.get(`/download/matrix/:server_name/:media_id`, defineEventHandler(asyn
} }
}) })
setResponseStatus(event, res.status) const contentType = res.headers.get("content-type")
setResponseHeader(event, "Content-Type", res.headers.get("content-type")) assert(contentType)
setResponseHeader(event, "Transfer-Encoding", "chunked")
return sendStream(event, res.body) setResponseStatus(event, res.status)
setResponseHeader(event, "Content-Type", contentType)
setResponseHeader(event, "Transfer-Encoding", "chunked")
return res.body
})) }))