fix(client): add sanitize-html to MkAutocomplete (#9433)

* fix(server): /emoji to accept `@.` host expression

* fix(client): use MkEmoji for custom emoji in MkEmojiPicker

* change convertToWebp

* nanka iroiro

* remove

* fix

* nearLosslessは労多くして益少なしなのでやめる

* do not cleanup tmp for development

* update sharp.js to 0.31.3

* mixed: true

* fix MkAutocomplete of 912791b3ab

* clean up

* https://github.com/misskey-dev/misskey/pull/9431#discussion_r1059215943

* edit mkautocomplete.vue use sanitize-html

* fix package.json
This commit is contained in:
tamaina 2022-12-30 13:02:18 +09:00 committed by GitHub
parent f213f30808
commit 87a0ed8b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -45,6 +45,7 @@
"rndstr": "1.0.0", "rndstr": "1.0.0",
"rollup": "3.9.0", "rollup": "3.9.0",
"s-age": "1.1.2", "s-age": "1.1.2",
"sanitize-html": "^2.8.1",
"sass": "1.57.1", "sass": "1.57.1",
"seedrandom": "3.0.5", "seedrandom": "3.0.5",
"strict-event-emitter-types": "2.0.0", "strict-event-emitter-types": "2.0.0",
@ -73,6 +74,7 @@
"@types/katex": "0.14.0", "@types/katex": "0.14.0",
"@types/matter-js": "0.18.2", "@types/matter-js": "0.18.2",
"@types/punycode": "2.1.0", "@types/punycode": "2.1.0",
"@types/sanitize-html": "^2.8.0",
"@types/seedrandom": "3.0.3", "@types/seedrandom": "3.0.3",
"@types/throttle-debounce": "5.0.0", "@types/throttle-debounce": "5.0.0",
"@types/tinycolor2": "1.4.3", "@types/tinycolor2": "1.4.3",

View File

@ -21,7 +21,8 @@
<MkEmoji :emoji="emoji.emoji" /> <MkEmoji :emoji="emoji.emoji" />
</div> </div>
<!-- eslint-disable-next-line vue/no-v-html --> <!-- eslint-disable-next-line vue/no-v-html -->
<span class="name" v-html="emoji.name.replace(q ?? '', `<b>${q}</b>`)"></span> <span v-if="q" class="name" v-html="sanitizeHtml(emoji.name.replace(q, `<b>${q}</b>`))"></span>
<span v-else v-text="emoji.name"></span>
<span v-if="emoji.aliasOf" class="alias">({{ emoji.aliasOf }})</span> <span v-if="emoji.aliasOf" class="alias">({{ emoji.aliasOf }})</span>
</li> </li>
</ol> </ol>
@ -44,6 +45,7 @@ import { defaultStore } from '@/store';
import { emojilist } from '@/scripts/emojilist'; import { emojilist } from '@/scripts/emojilist';
import { instance } from '@/instance'; import { instance } from '@/instance';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import * as sanitizeHtml from 'sanitize-html';
type EmojiDef = { type EmojiDef = {
emoji: string; emoji: string;
@ -453,6 +455,7 @@ onBeforeUnmount(() => {
> .emojis > li { > .emojis > li {
.emoji { .emoji {
flex-shrink: 0;
display: flex; display: flex;
margin: 0 4px 0 0; margin: 0 4px 0 0;
height: 24px; height: 24px;
@ -469,7 +472,12 @@ onBeforeUnmount(() => {
} }
.name {
flex-shrink: 1;
}
.alias { .alias {
flex-shrink: 9999999;
margin: 0 0 0 8px; margin: 0 0 0 8px;
} }
} }

View File

@ -2644,7 +2644,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/sanitize-html@npm:2.8.0": "@types/sanitize-html@npm:2.8.0, @types/sanitize-html@npm:^2.8.0":
version: 2.8.0 version: 2.8.0
resolution: "@types/sanitize-html@npm:2.8.0" resolution: "@types/sanitize-html@npm:2.8.0"
dependencies: dependencies:
@ -8055,6 +8055,7 @@ __metadata:
"@types/katex": 0.14.0 "@types/katex": 0.14.0
"@types/matter-js": 0.18.2 "@types/matter-js": 0.18.2
"@types/punycode": 2.1.0 "@types/punycode": 2.1.0
"@types/sanitize-html": ^2.8.0
"@types/seedrandom": 3.0.3 "@types/seedrandom": 3.0.3
"@types/throttle-debounce": 5.0.0 "@types/throttle-debounce": 5.0.0
"@types/tinycolor2": 1.4.3 "@types/tinycolor2": 1.4.3
@ -8101,6 +8102,7 @@ __metadata:
rndstr: 1.0.0 rndstr: 1.0.0
rollup: 3.9.0 rollup: 3.9.0
s-age: 1.1.2 s-age: 1.1.2
sanitize-html: ^2.8.1
sass: 1.57.1 sass: 1.57.1
seedrandom: 3.0.5 seedrandom: 3.0.5
start-server-and-test: 1.15.2 start-server-and-test: 1.15.2
@ -14944,7 +14946,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"sanitize-html@npm:2.8.1": "sanitize-html@npm:2.8.1, sanitize-html@npm:^2.8.1":
version: 2.8.1 version: 2.8.1
resolution: "sanitize-html@npm:2.8.1" resolution: "sanitize-html@npm:2.8.1"
dependencies: dependencies: