mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 13:16:08 +02:00
@@ -10,8 +10,8 @@ import { randomUUID } from 'node:crypto';
|
||||
import { inspect } from 'node:util';
|
||||
import WebSocket, { ClientOptions } from 'ws';
|
||||
import fetch, { File, RequestInit, type Headers } from 'node-fetch';
|
||||
import * as htmlParser from 'node-html-parser';
|
||||
import { DataSource } from 'typeorm';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { type Response } from 'node-fetch';
|
||||
import Fastify from 'fastify';
|
||||
import { entities } from '../src/postgres.js';
|
||||
@@ -468,7 +468,7 @@ export function makeStreamCatcher<T>(
|
||||
|
||||
export type SimpleGetResponse = {
|
||||
status: number,
|
||||
body: any | htmlParser.HTMLElement | null,
|
||||
body: any | JSDOM | null,
|
||||
type: string | null,
|
||||
location: string | null
|
||||
};
|
||||
@@ -499,7 +499,7 @@ export const simpleGet = async (path: string, accept = '*/*', cookie: any = unde
|
||||
|
||||
const body =
|
||||
jsonTypes.includes(res.headers.get('content-type') ?? '') ? await res.json() :
|
||||
htmlTypes.includes(res.headers.get('content-type') ?? '') ? htmlParser.parse(await res.text()) :
|
||||
htmlTypes.includes(res.headers.get('content-type') ?? '') ? new JSDOM(await res.text()) :
|
||||
await bodyExtractor(res);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user