From 9959f5bd04fc5cd5d3b8f66bf0e790ca6064f8be Mon Sep 17 00:00:00 2001 From: okayurisotto Date: Thu, 6 Jul 2023 08:47:47 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor(`ApDbResolverService.ts`):=20URL?= =?UTF-8?q?=E3=82=92=E6=89=B1=E3=81=86=E8=A4=87=E9=9B=91=E3=81=AA=E6=AD=A3?= =?UTF-8?q?=E8=A6=8F=E8=A1=A8=E7=8F=BE=E3=82=92URL=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=83=BC=E3=83=95=E3=82=A7=E3=82=A4=E3=82=B9=E3=81=A7?= =?UTF-8?q?=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=81=88=20(#11123)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(`ApDbResolverService.ts`): URLを扱う複雑な正規表現をURLインターフェイスで置き換え * fixup! refactor(`ApDbResolverService.ts`): URLを扱う複雑な正規表現をURLインターフェイスで置き換え --- .../core/activitypub/ApDbResolverService.ts | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/packages/backend/src/core/activitypub/ApDbResolverService.ts b/packages/backend/src/core/activitypub/ApDbResolverService.ts index 2d9e7a14e..ca148916d 100644 --- a/packages/backend/src/core/activitypub/ApDbResolverService.ts +++ b/packages/backend/src/core/activitypub/ApDbResolverService.ts @@ -1,5 +1,4 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; -import escapeRegexp from 'escape-regexp'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js'; import type { Config } from '@/config.js'; @@ -56,25 +55,18 @@ export class ApDbResolverService implements OnApplicationShutdown { @bindThis public parseUri(value: string | IObject): UriParseResult { - const uri = getApId(value); - - // the host part of a URL is case insensitive, so use the 'i' flag. - const localRegex = new RegExp('^' + escapeRegexp(this.config.url) + '/(\\w+)/(\\w+)(?:\/(.+))?', 'i'); - const matchLocal = uri.match(localRegex); - - if (matchLocal) { - return { - local: true, - type: matchLocal[1], - id: matchLocal[2], - rest: matchLocal[3], - }; - } else { - return { - local: false, - uri, - }; - } + const separator = '/'; + + const uri = new URL(getApId(value)); + if (uri.origin !== this.config.url) return { local: false, uri: uri.href }; + + const [, type, id, ...rest] = uri.pathname.split(separator); + return { + local: true, + type, + id, + rest: rest.length === 0 ? undefined : rest.join(separator), + }; } /** From dc8763215ada27149e8b4370bb86b8fb6ad3a002 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 6 Jul 2023 08:49:07 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat(frontend):=20=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=82=92=E5=8B=95=E7=94=BB=E3=81=A8=E5=90=8C=E6=A7=98=E3=81=AB?= =?UTF-8?q?=E7=B0=A1=E5=8D=98=E3=81=AB=E9=9A=A0=E3=81=9B=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20(#11127)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: hide image easily * docs(changelog): add 画像を動画と同様に簡単に隠せるように --- CHANGELOG.md | 1 + .../frontend/src/components/MkMediaImage.vue | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f620dadce..ed725314b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Fix: sparkle内にリンクを入れるとクリック不能になる問題の修正 - deck UIのカラムのメニューからアンテナとリストの編集画面を開けるように - ドライブファイルのメニューで画像をクロップできるように +- 画像を動画と同様に簡単に隠せるように ### Server - JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました diff --git a/packages/frontend/src/components/MkMediaImage.vue b/packages/frontend/src/components/MkMediaImage.vue index b29871c36..df49bcb26 100644 --- a/packages/frontend/src/components/MkMediaImage.vue +++ b/packages/frontend/src/components/MkMediaImage.vue @@ -33,6 +33,7 @@
NSFW
+ @@ -113,6 +114,21 @@ function showMenu(ev: MouseEvent) { align-items: center; } +.hide { + display: block; + position: absolute; + border-radius: 6px; + background-color: var(--fg); + color: var(--accentLighten); + font-size: 14px; + opacity: .5; + padding: 3px 6px; + text-align: center; + cursor: pointer; + top: 12px; + right: 12px; +} + .hiddenTextWrapper { display: table-cell; text-align: center; From 6b2c92cb68cf808e1e45aa8f8d4e5bea4b1e81ba Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Thu, 6 Jul 2023 09:19:10 +0900 Subject: [PATCH 3/5] chore(backend): fix typo in MkImgWithBlurhash.vue (#11125) occured -> occurred --- packages/frontend/src/components/MkImgWithBlurhash.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/MkImgWithBlurhash.vue b/packages/frontend/src/components/MkImgWithBlurhash.vue index cb229fa24..4e36defb7 100644 --- a/packages/frontend/src/components/MkImgWithBlurhash.vue +++ b/packages/frontend/src/components/MkImgWithBlurhash.vue @@ -108,7 +108,7 @@ function waitForDecode() { .then(() => { loaded = true; }, error => { - console.error('Error occured during decoding image', img.value, error); + console.error('Error occurred during decoding image', img.value, error); throw Error(error); }); } else { @@ -180,7 +180,7 @@ async function draw() { render(props.hash, work); drawImage(work); } catch (error) { - console.error('Error occured during drawing blurhash', error); + console.error('Error occurred during drawing blurhash', error); } } } From d2f8ed95aa10bc3200b7c0186c89dee69922d0fb Mon Sep 17 00:00:00 2001 From: EdamAme <121654029+EdamAme-x@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:42:57 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=82=A8=E3=82=B9=E3=82=B1=E3=83=BC?= =?UTF-8?q?=E3=83=97=E3=81=9B=E3=81=9A=E3=81=ABDescription=E3=82=92?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=E3=80=81Update=20info-card.pug=20(#11108)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HTMLのタグがエスケープされ、 misskey-hub.netのサーバー一覧で、iframeで読み込む際にタグがそのまま出力される状況が発生していた。 pugにおける仕様に則り、!=に変更、エスケープを行わないように。 --- packages/backend/src/server/web/views/info-card.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/web/views/info-card.pug b/packages/backend/src/server/web/views/info-card.pug index 1d62778ce..2a4954ec8 100644 --- a/packages/backend/src/server/web/views/info-card.pug +++ b/packages/backend/src/server/web/views/info-card.pug @@ -47,4 +47,4 @@ html header#banner(style=`background-image: url(${meta.bannerUrl})`) div#title= meta.name || host div#content - div#description= meta.description + div#description!= meta.description From 4a7da723b3327c5905b95e3a01cd4b43dd5e9ad9 Mon Sep 17 00:00:00 2001 From: okayurisotto Date: Thu, 6 Jul 2023 11:25:46 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor(backend):=20=E3=83=8E=E3=83=BC?= =?UTF-8?q?=E3=83=88=E5=89=8A=E9=99=A4=E6=99=82=E3=81=AE`findCascadingNote?= =?UTF-8?q?s`=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E6=95=B4=E7=90=86=20(#11?= =?UTF-8?q?131)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(backend): ノート削除時の`findCascadingNotes`の処理を整理 * cleanup: unneeded async await Co-authored-by: syuilo --------- Co-authored-by: syuilo --- packages/backend/src/core/NoteDeleteService.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts index dd878f7bb..3612ac806 100644 --- a/packages/backend/src/core/NoteDeleteService.ts +++ b/packages/backend/src/core/NoteDeleteService.ts @@ -121,10 +121,8 @@ export class NoteDeleteService { } @bindThis - private async findCascadingNotes(note: Note) { - const cascadingNotes: Note[] = []; - - const recursive = async (noteId: string) => { + private async findCascadingNotes(note: Note): Promise { + const recursive = async (noteId: string): Promise => { const query = this.notesRepository.createQueryBuilder('note') .where('note.replyId = :noteId', { noteId }) .orWhere(new Brackets(q => { @@ -133,12 +131,14 @@ export class NoteDeleteService { })) .leftJoinAndSelect('note.user', 'user'); const replies = await query.getMany(); - for (const reply of replies) { - cascadingNotes.push(reply); - await recursive(reply.id); - } + + return [ + replies, + ...await Promise.all(replies.map(reply => recursive(reply.id))), + ].flat(); }; - await recursive(note.id); + + const cascadingNotes: Note[] = await recursive(note.id); return cascadingNotes.filter(note => note.userHost === null); // filter out non-local users }