1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-02 13:16:08 +02:00

Revert "chore(backend): remove jsdom"

This reverts commit 2effd9da6e.
This commit is contained in:
syuilo
2025-11-29 20:11:38 +09:00
parent 2effd9da6e
commit cad93071da
3 changed files with 130 additions and 23 deletions

View File

@@ -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 {