From 9959f5bd04fc5cd5d3b8f66bf0e790ca6064f8be Mon Sep 17 00:00:00 2001 From: okayurisotto Date: Thu, 6 Jul 2023 08:47:47 +0900 Subject: [PATCH 1/9] =?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 2d9e7a14ee..ca148916dc 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/9] =?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 f620dadce9..ed725314b2 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 b29871c363..df49bcb26d 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/9] 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 cb229fa241..4e36defb7c 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/9] =?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 1d62778ce1..2a4954ec8b 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/9] =?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 dd878f7bba..3612ac806f 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 } From 3597da5c49d88b6279eb109087d92a9bfc344834 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 6 Jul 2023 15:04:39 +0900 Subject: [PATCH 6/9] Update about-misskey.vue --- packages/frontend/src/pages/about-misskey.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend/src/pages/about-misskey.vue b/packages/frontend/src/pages/about-misskey.vue index 0017145fa1..b67cf26473 100644 --- a/packages/frontend/src/pages/about-misskey.vue +++ b/packages/frontend/src/pages/about-misskey.vue @@ -155,6 +155,12 @@ const patronsWithIcon = [{ }, { name: 'spinlock', icon: 'https://misskey-hub.net/patrons/6a1cebc819d540a78bf20e9e3115baa8.jpg', +}, { + name: 'じゅくま', + icon: 'https://misskey-hub.net/patrons/3e56bdac69dd42f7a06e0f12cf2fc895.jpg', +}, { + name: '清遊あみ', + icon: 'https://misskey-hub.net/patrons/de25195b88e940a388388bea2e7637d8.jpg', }]; const patrons = [ From 9e955d20c4425273732828ef3181968816998af8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 6 Jul 2023 15:07:51 +0900 Subject: [PATCH 7/9] :art: --- packages/frontend/src/components/MkMediaImage.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/components/MkMediaImage.vue b/packages/frontend/src/components/MkMediaImage.vue index df49bcb26d..9791a88f7c 100644 --- a/packages/frontend/src/components/MkMediaImage.vue +++ b/packages/frontend/src/components/MkMediaImage.vue @@ -120,9 +120,9 @@ function showMenu(ev: MouseEvent) { border-radius: 6px; background-color: var(--fg); color: var(--accentLighten); - font-size: 14px; + font-size: 12px; opacity: .5; - padding: 3px 6px; + padding: 5px 8px; text-align: center; cursor: pointer; top: 12px; @@ -153,8 +153,8 @@ function showMenu(ev: MouseEvent) { backdrop-filter: var(--blur, blur(15px)); color: #fff; font-size: 0.8em; - width: 32px; - height: 32px; + width: 28px; + height: 28px; text-align: center; bottom: 10px; right: 10px; From 06bf5c1ff1b52bc1eb72d7a3358995470ff3a97c Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 6 Jul 2023 06:43:05 +0000 Subject: [PATCH 8/9] =?UTF-8?q?fix(frontend):=20In=20MkPagination,=20init(?= =?UTF-8?q?)=20also=20initializes=20items=20=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E3=83=8E=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=82=BF=E3=83=96=E3=81=A7=E5=B0=8F=E3=82=BF=E3=83=96?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B=E3=81=A8=E5=89=8D?= =?UTF-8?q?=E3=81=AE=E3=82=BF=E3=82=A4=E3=83=A0=E3=83=A9=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=81=8C=E6=AE=8B=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/MkPagination.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/frontend/src/components/MkPagination.vue b/packages/frontend/src/components/MkPagination.vue index b361d568e8..661b04c365 100644 --- a/packages/frontend/src/components/MkPagination.vue +++ b/packages/frontend/src/components/MkPagination.vue @@ -188,6 +188,7 @@ watch(queue, (a, b) => { }, { deep: true }); async function init(): Promise { + items.value = new Map(); queue.value = new Map(); fetching.value = true; const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {}; @@ -219,8 +220,6 @@ async function init(): Promise { } const reload = (): Promise => { - items.value = new Map(); - queue.value = new Map(); return init(); }; From 0137af892ad277936c292bea54b4f2cb002c2fd7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 6 Jul 2023 16:18:06 +0900 Subject: [PATCH 9/9] chore(frontend): tweak photoswipe animation Resolve #11117 --- packages/frontend/src/components/MkMediaList.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/frontend/src/components/MkMediaList.vue b/packages/frontend/src/components/MkMediaList.vue index a0a2450054..34f59c5573 100644 --- a/packages/frontend/src/components/MkMediaList.vue +++ b/packages/frontend/src/components/MkMediaList.vue @@ -115,6 +115,8 @@ onMounted(() => { imageClickAction: 'close', tapAction: 'toggle-controls', bgOpacity: 1, + showAnimationDuration: 100, + hideAnimationDuration: 100, pswpModule: PhotoSwipe, });