mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-24 14:45:12 +00:00
bump happy-dom, disable all JS&c when parsing
version 10 didn't quite support disabling all of that I have tested that `MfmService` (the other code that uses `happy-dom`) still works fine: the RSS feed for a user is generated correctly, with HTML rendered from MFM
This commit is contained in:
parent
27f3d76a2b
commit
26e0412fbb
3 changed files with 44 additions and 10 deletions
|
@ -122,7 +122,7 @@
|
|||
"form-data": "4.0.0",
|
||||
"glob": "10.3.10",
|
||||
"got": "14.4.2",
|
||||
"happy-dom": "10.0.3",
|
||||
"happy-dom": "15.6.1",
|
||||
"hpagent": "1.2.0",
|
||||
"htmlescape": "1.1.1",
|
||||
"http-link-header": "1.1.3",
|
||||
|
|
|
@ -209,17 +209,41 @@ export class ApRequestService {
|
|||
|
||||
if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate === true) {
|
||||
const html = await res.text();
|
||||
const window = new Window();
|
||||
const window = 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 document = window.document;
|
||||
document.documentElement.innerHTML = html;
|
||||
try {
|
||||
document.documentElement.innerHTML = html;
|
||||
|
||||
const alternate = document.querySelector('head > link[rel="alternate"][type="application/activity+json"]');
|
||||
if (alternate) {
|
||||
const href = alternate.getAttribute('href');
|
||||
if (href) {
|
||||
return await this.signedGet(href, user, false);
|
||||
const alternate = document.querySelector('head > link[rel="alternate"][type="application/activity+json"]');
|
||||
if (alternate) {
|
||||
const href = alternate.getAttribute('href');
|
||||
if (href) {
|
||||
return await this.signedGet(href, user, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// something went wrong parsing the HTML, ignore the whole thing
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
|
|
@ -257,8 +257,8 @@ importers:
|
|||
specifier: 14.4.2
|
||||
version: 14.4.2
|
||||
happy-dom:
|
||||
specifier: 10.0.3
|
||||
version: 10.0.3
|
||||
specifier: 15.6.1
|
||||
version: 15.6.1
|
||||
hpagent:
|
||||
specifier: 1.2.0
|
||||
version: 1.2.0
|
||||
|
@ -7671,6 +7671,10 @@ packages:
|
|||
happy-dom@10.0.3:
|
||||
resolution: {integrity: sha512-WkCP+Z5fX6U5PY+yHP3ElV5D9PoxRAHRWPFq3pG9rg/6Hjf5ak7dozAgSCywsTRUq2qfa8vV8OQvUy5pRXy8EQ==}
|
||||
|
||||
happy-dom@15.6.1:
|
||||
resolution: {integrity: sha512-dsMHLsJHZYhXeExP47B2siAfKNVxptlwFss3/bq/9sG3iBt0P2WYFBq68JgMR5vB5gsN2Ev0feTTPD/+rosUNQ==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
hard-rejection@2.1.0:
|
||||
resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -20175,6 +20179,12 @@ snapshots:
|
|||
whatwg-encoding: 2.0.0
|
||||
whatwg-mimetype: 3.0.0
|
||||
|
||||
happy-dom@15.6.1:
|
||||
dependencies:
|
||||
entities: 4.5.0
|
||||
webidl-conversions: 7.0.0
|
||||
whatwg-mimetype: 3.0.0
|
||||
|
||||
hard-rejection@2.1.0: {}
|
||||
|
||||
has-bigints@1.0.2: {}
|
||||
|
|
Loading…
Reference in a new issue