diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-11-29 19:16:05 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-29 19:16:05 +0900 |
| commit | 27320344470f7c2457216ab64eecb5e513417ac4 (patch) | |
| tree | 8eec493ed429d63de1c089f6e1fcdb0aeca18de8 /packages/backend/src/server/web/ClientServerService.ts | |
| parent | [skip ci] Update CHANGELOG.md (prepend template) (diff) | |
| download | misskey-27320344470f7c2457216ab64eecb5e513417ac4.tar.gz misskey-27320344470f7c2457216ab64eecb5e513417ac4.tar.bz2 misskey-27320344470f7c2457216ab64eecb5e513417ac4.zip | |
perf(backend): jsdom、happy-domをやめて軽量な実装にし、メモリ削減・高速化 (#16885)
* wip
* Update packages/backend/src/server/api/endpoints/i/update.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/FetchInstanceMetadataService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* remove some packages
* コミット漏れ
* clean up
* fix
* Update MfmService.ts
* fix
* fix
* Update MfmService.ts
* wip
* rename
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/activitypub/ApRendererService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/backend/src/core/MfmService.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update MfmService.ts
* Update CHANGELOG.md
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/server/web/ClientServerService.ts')
| -rw-r--r-- | packages/backend/src/server/web/ClientServerService.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index f9d904f3cd..fef6a27087 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -15,7 +15,6 @@ import fastifyStatic from '@fastify/static'; import fastifyView from '@fastify/view'; import fastifyProxy from '@fastify/http-proxy'; import vary from 'vary'; -import htmlSafeJsonStringify from 'htmlescape'; import type { Config } from '@/config.js'; import { getNoteSummary } from '@/misc/get-note-summary.js'; import { DI } from '@/di-symbols.js'; @@ -63,6 +62,20 @@ const frontendViteOut = `${_dirname}/../../../../../built/_frontend_vite_/`; const frontendEmbedViteOut = `${_dirname}/../../../../../built/_frontend_embed_vite_/`; const tarball = `${_dirname}/../../../../../built/tarball/`; +const ESCAPE_LOOKUP = { + '&': '\\u0026', + '>': '\\u003e', + '<': '\\u003c', + '\u2028': '\\u2028', + '\u2029': '\\u2029', +} as Record<string, string>; + +const ESCAPE_REGEX = /[&><\u2028\u2029]/g; + +function htmlSafeJsonStringify(obj: any): string { + return JSON.stringify(obj).replace(ESCAPE_REGEX, x => ESCAPE_LOOKUP[x]); +} + @Injectable() export class ClientServerService { private logger: Logger; |