From 5cc3d3c8733fca22fb3052b06f3fefcb998468ad Mon Sep 17 00:00:00 2001 From: woxtu Date: Fri, 15 Dec 2023 11:22:49 +0900 Subject: [PATCH 01/30] Remove an unnecessary type assertion (#12666) --- packages/backend/src/server/ActivityPubServerService.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index 78d2daa403..380cdfc34c 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -493,8 +493,7 @@ export class ActivityPubServerService { @bindThis public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) { - // addConstraintStrategy の型定義がおかしいため - (fastify.addConstraintStrategy as any)({ + fastify.addConstraintStrategy({ name: 'apOrHtml', storage() { const store = {} as any; From bd4d8694dda63dfe8093e605bcb9184231818cad Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Fri, 15 Dec 2023 11:24:13 +0900 Subject: [PATCH 02/30] perf: early return users/notes and users/featured-notes if me is blocked by requesting user (#12663) --- .../src/server/api/endpoints/users/featured-notes.ts | 11 ++++++++--- .../backend/src/server/api/endpoints/users/notes.ts | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/users/featured-notes.ts b/packages/backend/src/server/api/endpoints/users/featured-notes.ts index f84148d727..7243aa3b3e 100644 --- a/packages/backend/src/server/api/endpoints/users/featured-notes.ts +++ b/packages/backend/src/server/api/endpoints/users/featured-notes.ts @@ -51,6 +51,13 @@ export default class extends Endpoint { // eslint- private cacheService: CacheService, ) { super(meta, paramDef, async (ps, me) => { + const userIdsWhoBlockingMe = me ? await this.cacheService.userBlockedCache.fetch(me.id) : new Set(); + + // early return if me is blocked by requesting user + if (userIdsWhoBlockingMe.has(ps.userId)) { + return []; + } + let noteIds = await this.featuredService.getPerUserNotesRanking(ps.userId, 50); noteIds.sort((a, b) => a > b ? -1 : 1); @@ -65,11 +72,9 @@ export default class extends Endpoint { // eslint- const [ userIdsWhoMeMuting, - userIdsWhoBlockingMe, ] = me ? await Promise.all([ this.cacheService.userMutingsCache.fetch(me.id), - this.cacheService.userBlockedCache.fetch(me.id), - ]) : [new Set(), new Set()]; + ]) : [new Set()]; const query = this.notesRepository.createQueryBuilder('note') .where('note.id IN (:...noteIds)', { noteIds: noteIds }) diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index b32128a8aa..b485126ed8 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -86,6 +86,14 @@ export default class extends Endpoint { // eslint- if (ps.withReplies && ps.withFiles) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles); + // early return if me is blocked by requesting user + if (me != null) { + const userIdsWhoBlockingMe = await this.cacheService.userBlockedCache.fetch(me.id); + if (userIdsWhoBlockingMe.has(ps.userId)) { + return []; + } + } + if (!serverSettings.enableFanoutTimeline) { const timeline = await this.getFromDb({ untilId, From eacc2040a1a3ef1c28af5293a163289e7ec1958a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2023 15:37:19 +0900 Subject: [PATCH 03/30] perf(frontend): introduce MkLazy for lazy loading --- .../frontend/src/components/global/MkLazy.vue | 53 +++++++++++++++++++ packages/frontend/src/components/index.ts | 3 ++ packages/frontend/src/pages/user/home.vue | 12 +++-- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/src/components/global/MkLazy.vue diff --git a/packages/frontend/src/components/global/MkLazy.vue b/packages/frontend/src/components/global/MkLazy.vue new file mode 100644 index 0000000000..6d7ff4ca49 --- /dev/null +++ b/packages/frontend/src/components/global/MkLazy.vue @@ -0,0 +1,53 @@ + + + + + + + diff --git a/packages/frontend/src/components/index.ts b/packages/frontend/src/components/index.ts index c740d181f9..a3e13c3a50 100644 --- a/packages/frontend/src/components/index.ts +++ b/packages/frontend/src/components/index.ts @@ -25,6 +25,7 @@ import MkPageHeader from './global/MkPageHeader.vue'; import MkSpacer from './global/MkSpacer.vue'; import MkFooterSpacer from './global/MkFooterSpacer.vue'; import MkStickyContainer from './global/MkStickyContainer.vue'; +import MkLazy from './global/MkLazy.vue'; export default function(app: App) { for (const [key, value] of Object.entries(components)) { @@ -53,6 +54,7 @@ export const components = { MkSpacer: MkSpacer, MkFooterSpacer: MkFooterSpacer, MkStickyContainer: MkStickyContainer, + MkLazy: MkLazy, }; declare module '@vue/runtime-core' { @@ -77,5 +79,6 @@ declare module '@vue/runtime-core' { MkSpacer: typeof MkSpacer; MkFooterSpacer: typeof MkFooterSpacer; MkStickyContainer: typeof MkStickyContainer; + MkLazy: typeof MkLazy; } } diff --git a/packages/frontend/src/pages/user/home.vue b/packages/frontend/src/pages/user/home.vue index ecc3bb36c1..a0163bfc68 100644 --- a/packages/frontend/src/pages/user/home.vue +++ b/packages/frontend/src/pages/user/home.vue @@ -128,12 +128,18 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.userPagePinTip }}
{{ i18n.ts.featured }}
- + + +
From c41924399b1c0b06b451159644789fe00a29d7da Mon Sep 17 00:00:00 2001 From: 1STEP621 <86859447+1STEP621@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:18:31 +0900 Subject: [PATCH 04/30] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=A7Tab?= =?UTF-8?q?=E3=82=92=E5=85=A5=E5=8A=9B=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20(#12671)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/MkTextarea.vue | 10 ++++++++++ packages/frontend/src/pages/flash/flash-edit.vue | 2 +- packages/frontend/src/pages/registry.value.vue | 2 +- packages/frontend/src/pages/settings/custom-css.vue | 2 +- .../frontend/src/pages/settings/plugin.install.vue | 2 +- packages/frontend/src/pages/settings/theme.install.vue | 2 +- packages/frontend/src/pages/theme-editor.vue | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/components/MkTextarea.vue b/packages/frontend/src/components/MkTextarea.vue index 23fdd5bfe1..696787122e 100644 --- a/packages/frontend/src/components/MkTextarea.vue +++ b/packages/frontend/src/components/MkTextarea.vue @@ -91,6 +91,16 @@ const onKeydown = (ev: KeyboardEvent) => { if (ev.code === 'Enter') { emit('enter'); } + + if (props.code && ev.key === 'Tab') { + const pos = inputEl.value?.selectionStart ?? 0; + const posEnd = inputEl.value?.selectionEnd ?? v.value.length; + v.value = v.value.slice(0, pos) + '\t' + v.value.slice(posEnd); + nextTick(() => { + inputEl.value?.setSelectionRange(pos + 1, pos + 1); + }); + ev.preventDefault(); + } }; const updated = () => { diff --git a/packages/frontend/src/pages/flash/flash-edit.vue b/packages/frontend/src/pages/flash/flash-edit.vue index cfda4d6556..365b054f7a 100644 --- a/packages/frontend/src/pages/flash/flash-edit.vue +++ b/packages/frontend/src/pages/flash/flash-edit.vue @@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.selectFromPresets }} - +
diff --git a/packages/frontend/src/pages/registry.value.vue b/packages/frontend/src/pages/registry.value.vue index 29406ec83c..1b2cf9f237 100644 --- a/packages/frontend/src/pages/registry.value.vue +++ b/packages/frontend/src/pages/registry.value.vue @@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + diff --git a/packages/frontend/src/pages/settings/custom-css.vue b/packages/frontend/src/pages/settings/custom-css.vue index e33e778246..8e52686c12 100644 --- a/packages/frontend/src/pages/settings/custom-css.vue +++ b/packages/frontend/src/pages/settings/custom-css.vue @@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.customCssWarn }} - +
diff --git a/packages/frontend/src/pages/settings/plugin.install.vue b/packages/frontend/src/pages/settings/plugin.install.vue index f304d777a5..44472d47d9 100644 --- a/packages/frontend/src/pages/settings/plugin.install.vue +++ b/packages/frontend/src/pages/settings/plugin.install.vue @@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._plugin.installWarn }} - + diff --git a/packages/frontend/src/pages/settings/theme.install.vue b/packages/frontend/src/pages/settings/theme.install.vue index c2ca53c743..0f3fbad0b7 100644 --- a/packages/frontend/src/pages/settings/theme.install.vue +++ b/packages/frontend/src/pages/settings/theme.install.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-
{{ i18n.ts.featured }}
- +
@@ -193,6 +192,7 @@ function calcAge(birthdate: string): number { const XFiles = defineAsyncComponent(() => import('./index.files.vue')); const XActivity = defineAsyncComponent(() => import('./index.activity.vue')); +const XTimeline = defineAsyncComponent(() => import('./index.timeline.vue')); const props = withDefaults(defineProps<{ user: Misskey.entities.UserDetailed; @@ -219,14 +219,6 @@ watch(moderationNote, async () => { await os.api('admin/update-user-note', { userId: props.user.id, text: moderationNote.value }); }); -const pagination = { - endpoint: 'users/featured-notes' as const, - limit: 10, - params: computed(() => ({ - userId: props.user.id, - })), -}; - const style = computed(() => { if (props.user.bannerUrl == null) return {}; return { diff --git a/packages/frontend/src/pages/user/index.timeline.vue b/packages/frontend/src/pages/user/index.timeline.vue index 6cf5bcf91f..e5a0f49e3d 100644 --- a/packages/frontend/src/pages/user/index.timeline.vue +++ b/packages/frontend/src/pages/user/index.timeline.vue @@ -4,18 +4,17 @@ SPDX-License-Identifier: AGPL-3.0-only --> From 776eea736a2607c62145c01b48a8271dd355f006 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2023 17:37:50 +0900 Subject: [PATCH 21/30] enhance(frontend): tweak avatar decoration setting ui --- locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + ...n.vue => avatar-decoration.decoration.vue} | 0 ...ialog.vue => avatar-decoration.dialog.vue} | 0 ...r-decoration.vue => avatar-decoration.vue} | 77 ++++++++++++------- .../frontend/src/pages/settings/profile.vue | 28 ++++--- packages/frontend/src/router.ts | 4 + 7 files changed, 68 insertions(+), 43 deletions(-) rename packages/frontend/src/pages/settings/{profile.avatar-decoration.decoration.vue => avatar-decoration.decoration.vue} (100%) rename packages/frontend/src/pages/settings/{profile.avatar-decoration.dialog.vue => avatar-decoration.dialog.vue} (100%) rename packages/frontend/src/pages/settings/{profile.avatar-decoration.vue => avatar-decoration.vue} (58%) diff --git a/locales/index.d.ts b/locales/index.d.ts index c8a7b4c70d..cd15bd968f 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1183,6 +1183,7 @@ export interface Locale { "remainingN": string; "overwriteContentConfirm": string; "seasonalScreenEffect": string; + "decorate": string; "_announcement": { "forExistingUsers": string; "forExistingUsersDescription": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 25a734ef4f..5537db9d56 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1180,6 +1180,7 @@ reloadRequiredToApplySettings: "設定の反映にはリロードが必要です remainingN: "残り: {n}" overwriteContentConfirm: "現在の内容に上書きされますがよろしいですか?" seasonalScreenEffect: "季節に応じた画面の演出" +decorate: "デコる" _announcement: forExistingUsers: "既存ユーザーのみ" diff --git a/packages/frontend/src/pages/settings/profile.avatar-decoration.decoration.vue b/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue similarity index 100% rename from packages/frontend/src/pages/settings/profile.avatar-decoration.decoration.vue rename to packages/frontend/src/pages/settings/avatar-decoration.decoration.vue diff --git a/packages/frontend/src/pages/settings/profile.avatar-decoration.dialog.vue b/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue similarity index 100% rename from packages/frontend/src/pages/settings/profile.avatar-decoration.dialog.vue rename to packages/frontend/src/pages/settings/avatar-decoration.dialog.vue diff --git a/packages/frontend/src/pages/settings/profile.avatar-decoration.vue b/packages/frontend/src/pages/settings/avatar-decoration.vue similarity index 58% rename from packages/frontend/src/pages/settings/profile.avatar-decoration.vue rename to packages/frontend/src/pages/settings/avatar-decoration.vue index 8579acfed8..6551fc917e 100644 --- a/packages/frontend/src/pages/settings/profile.avatar-decoration.vue +++ b/packages/frontend/src/pages/settings/avatar-decoration.vue @@ -4,51 +4,56 @@ SPDX-License-Identifier: AGPL-3.0-only -->