mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-27 14:28:59 +09:00
jsdomに戻す
This commit is contained in:
parent
c4bd6dfb6b
commit
c03603611b
@ -119,7 +119,6 @@
|
||||
"fluent-ffmpeg": "2.1.3",
|
||||
"form-data": "4.0.0",
|
||||
"got": "14.4.2",
|
||||
"happy-dom": "15.7.4",
|
||||
"hpagent": "1.2.0",
|
||||
"htmlescape": "1.1.1",
|
||||
"http-link-header": "1.1.3",
|
||||
@ -132,8 +131,8 @@
|
||||
"json5": "2.2.3",
|
||||
"jsonld": "8.3.2",
|
||||
"jsrsasign": "11.1.0",
|
||||
"meilisearch": "0.42.0",
|
||||
"juice": "11.0.0",
|
||||
"meilisearch": "0.42.0",
|
||||
"mfm-js": "0.24.0",
|
||||
"microformats-parser": "2.0.2",
|
||||
"mime-types": "2.1.35",
|
||||
|
@ -6,7 +6,7 @@
|
||||
import { URL } from 'node:url';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import * as parse5 from 'parse5';
|
||||
import { Window, XMLSerializer } from 'happy-dom';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { intersperse } from '@/misc/prelude/array.js';
|
||||
@ -239,7 +239,7 @@ export class MfmService {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { happyDOM, window } = new Window();
|
||||
const { window } = new JSDOM();
|
||||
|
||||
const doc = window.document;
|
||||
|
||||
@ -457,9 +457,9 @@ export class MfmService {
|
||||
|
||||
appendChildren(nodes, body);
|
||||
|
||||
const serialized = new XMLSerializer().serializeToString(body);
|
||||
const serialized = body.outerHTML;
|
||||
|
||||
happyDOM.close().catch(err => {});
|
||||
window.close();
|
||||
|
||||
return serialized;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
import * as crypto from 'node:crypto';
|
||||
import { URL } from 'node:url';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Window } from 'happy-dom';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
@ -211,26 +211,7 @@ export class ApRequestService {
|
||||
&& _followAlternate === true
|
||||
) {
|
||||
const html = await res.text();
|
||||
const { window, happyDOM } = new Window({
|
||||
settings: {
|
||||
disableJavaScriptEvaluation: true,
|
||||
disableJavaScriptFileLoading: true,
|
||||
disableCSSFileLoading: true,
|
||||
disableComputedStyleRendering: true,
|
||||
handleDisabledFileLoadingAsSuccess: true,
|
||||
navigation: {
|
||||
disableMainFrameNavigation: true,
|
||||
disableChildFrameNavigation: true,
|
||||
disableChildPageNavigation: true,
|
||||
disableFallbackToSetURL: true,
|
||||
},
|
||||
timer: {
|
||||
maxTimeout: 0,
|
||||
maxIntervalTime: 0,
|
||||
maxIntervalIterations: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
const { window } = new JSDOM(html);
|
||||
const document = window.document;
|
||||
try {
|
||||
document.documentElement.innerHTML = html;
|
||||
@ -245,7 +226,7 @@ export class ApRequestService {
|
||||
} catch (e) {
|
||||
// something went wrong parsing the HTML, ignore the whole thing
|
||||
} finally {
|
||||
happyDOM.close().catch(err => {});
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
@ -245,9 +245,6 @@ importers:
|
||||
got:
|
||||
specifier: 14.4.2
|
||||
version: 14.4.2
|
||||
happy-dom:
|
||||
specifier: 15.7.4
|
||||
version: 15.7.4
|
||||
hpagent:
|
||||
specifier: 1.2.0
|
||||
version: 1.2.0
|
||||
@ -7345,10 +7342,6 @@ packages:
|
||||
happy-dom@10.0.3:
|
||||
resolution: {integrity: sha512-WkCP+Z5fX6U5PY+yHP3ElV5D9PoxRAHRWPFq3pG9rg/6Hjf5ak7dozAgSCywsTRUq2qfa8vV8OQvUy5pRXy8EQ==}
|
||||
|
||||
happy-dom@15.7.4:
|
||||
resolution: {integrity: sha512-r1vadDYGMtsHAAsqhDuk4IpPvr6N8MGKy5ntBo7tSdim+pWDxus2PNqOcOt8LuDZ4t3KJHE+gCuzupcx/GKnyQ==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
har-schema@2.0.0:
|
||||
resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==}
|
||||
engines: {node: '>=4'}
|
||||
@ -12277,7 +12270,7 @@ snapshots:
|
||||
'@babel/traverse': 7.23.5
|
||||
'@babel/types': 7.24.7
|
||||
convert-source-map: 2.0.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
gensync: 1.0.0-beta.2
|
||||
json5: 2.2.3
|
||||
semver: 6.3.1
|
||||
@ -12297,7 +12290,7 @@ snapshots:
|
||||
'@babel/traverse': 7.24.7
|
||||
'@babel/types': 7.24.7
|
||||
convert-source-map: 2.0.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
gensync: 1.0.0-beta.2
|
||||
json5: 2.2.3
|
||||
semver: 6.3.1
|
||||
@ -12556,7 +12549,7 @@ snapshots:
|
||||
'@babel/helper-split-export-declaration': 7.22.6
|
||||
'@babel/parser': 7.24.7
|
||||
'@babel/types': 7.24.7
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -12571,7 +12564,7 @@ snapshots:
|
||||
'@babel/helper-split-export-declaration': 7.24.7
|
||||
'@babel/parser': 7.24.7
|
||||
'@babel/types': 7.24.7
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -15978,7 +15971,7 @@ snapshots:
|
||||
'@typescript-eslint/types': 7.17.0
|
||||
'@typescript-eslint/typescript-estree': 7.17.0(typescript@5.6.2)
|
||||
'@typescript-eslint/visitor-keys': 7.17.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
eslint: 9.11.0
|
||||
optionalDependencies:
|
||||
typescript: 5.6.2
|
||||
@ -16036,7 +16029,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 7.17.0(typescript@5.6.2)
|
||||
'@typescript-eslint/utils': 7.17.0(eslint@9.11.0)(typescript@5.6.2)
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
eslint: 9.11.0
|
||||
ts-api-utils: 1.3.0(typescript@5.6.2)
|
||||
optionalDependencies:
|
||||
@ -16094,7 +16087,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 7.17.0
|
||||
'@typescript-eslint/visitor-keys': 7.17.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
minimatch: 9.0.4
|
||||
@ -16491,14 +16484,14 @@ snapshots:
|
||||
|
||||
agent-base@6.0.2:
|
||||
dependencies:
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
|
||||
agent-base@7.1.0:
|
||||
dependencies:
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@ -17676,12 +17669,20 @@ snapshots:
|
||||
dependencies:
|
||||
ms: 2.0.0
|
||||
|
||||
debug@3.2.7:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
debug@3.2.7(supports-color@8.1.1):
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
optionalDependencies:
|
||||
supports-color: 8.1.1
|
||||
|
||||
debug@4.3.4:
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
|
||||
debug@4.3.4(supports-color@5.5.0):
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
@ -18287,7 +18288,7 @@ snapshots:
|
||||
|
||||
eslint-import-resolver-node@0.3.9:
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
is-core-module: 2.15.1
|
||||
resolve: 1.22.8
|
||||
transitivePeerDependencies:
|
||||
@ -18295,7 +18296,7 @@ snapshots:
|
||||
|
||||
eslint-module-utils@2.11.0(@typescript-eslint/parser@7.17.0(eslint@9.11.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.0):
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 7.17.0(eslint@9.11.0)(typescript@5.6.2)
|
||||
eslint: 9.11.0
|
||||
@ -18320,7 +18321,7 @@ snapshots:
|
||||
array.prototype.findlastindex: 1.2.5
|
||||
array.prototype.flat: 1.3.2
|
||||
array.prototype.flatmap: 1.3.2
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
doctrine: 2.1.0
|
||||
eslint: 9.11.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
@ -19288,12 +19289,6 @@ snapshots:
|
||||
whatwg-encoding: 2.0.0
|
||||
whatwg-mimetype: 3.0.0
|
||||
|
||||
happy-dom@15.7.4:
|
||||
dependencies:
|
||||
entities: 4.5.0
|
||||
webidl-conversions: 7.0.0
|
||||
whatwg-mimetype: 3.0.0
|
||||
|
||||
har-schema@2.0.0: {}
|
||||
|
||||
har-validator@5.1.5:
|
||||
@ -19426,7 +19421,7 @@ snapshots:
|
||||
http-proxy-agent@7.0.2:
|
||||
dependencies:
|
||||
agent-base: 7.1.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@ -19457,7 +19452,7 @@ snapshots:
|
||||
https-proxy-agent@2.2.4:
|
||||
dependencies:
|
||||
agent-base: 4.3.0
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
@ -19465,7 +19460,7 @@ snapshots:
|
||||
https-proxy-agent@5.0.1:
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
optional: true
|
||||
@ -19473,14 +19468,14 @@ snapshots:
|
||||
https-proxy-agent@7.0.2:
|
||||
dependencies:
|
||||
agent-base: 7.1.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
https-proxy-agent@7.0.5:
|
||||
dependencies:
|
||||
agent-base: 7.1.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@ -19584,7 +19579,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@ioredis/commands': 1.2.0
|
||||
cluster-key-slot: 1.1.2
|
||||
debug: 4.3.4(supports-color@5.5.0)
|
||||
debug: 4.3.4
|
||||
denque: 2.1.0
|
||||
lodash.defaults: 4.2.0
|
||||
lodash.isarguments: 3.1.0
|
||||
@ -19844,7 +19839,7 @@ snapshots:
|
||||
|
||||
istanbul-lib-source-maps@4.0.1:
|
||||
dependencies:
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
istanbul-lib-coverage: 3.2.2
|
||||
source-map: 0.6.1
|
||||
transitivePeerDependencies:
|
||||
@ -21259,7 +21254,7 @@ snapshots:
|
||||
|
||||
needle@2.9.1:
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7
|
||||
iconv-lite: 0.4.24
|
||||
sax: 1.2.4
|
||||
transitivePeerDependencies:
|
||||
@ -22526,7 +22521,7 @@ snapshots:
|
||||
|
||||
require-in-the-middle@7.3.0:
|
||||
dependencies:
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
module-details-from-path: 1.0.3
|
||||
resolve: 1.22.8
|
||||
transitivePeerDependencies:
|
||||
@ -22868,7 +22863,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@hapi/hoek': 11.0.4
|
||||
'@hapi/wreck': 18.0.1
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
joi: 17.11.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -22968,7 +22963,7 @@ snapshots:
|
||||
socks-proxy-agent@8.0.2:
|
||||
dependencies:
|
||||
agent-base: 7.1.0
|
||||
debug: 4.3.5(supports-color@8.1.1)
|
||||
debug: 4.3.5(supports-color@5.5.0)
|
||||
socks: 2.7.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -23609,7 +23604,7 @@ snapshots:
|
||||
chalk: 4.1.2
|
||||
cli-highlight: 2.1.11
|
||||
dayjs: 1.11.10
|
||||
debug: 4.3.4(supports-color@5.5.0)
|
||||
debug: 4.3.4
|
||||
dotenv: 16.0.3
|
||||
glob: 10.3.10
|
||||
mkdirp: 2.1.6
|
||||
|
Loading…
Reference in New Issue
Block a user