From 3919382302000b61e6255b86dcabd4eb2e121622 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sat, 23 Aug 2025 02:40:03 +0900 Subject: [PATCH 1/4] chore: update masto.js from v6.10.4 to v7.2.0 --- package.json | 2 +- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index b3bd63c8..1f38f9d3 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "iso-639-1": "^3.0.0", "js-yaml": "^4.1.0", "lru-cache": "^11.0.0", - "masto": "^6.10.4", + "masto": "^7.2.0", "mocked-exports": "^0.1.1", "node-emoji": "^2.1.3", "node-mock-http": "^1.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bed4c237..9f8d8485 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -176,8 +176,8 @@ importers: specifier: ^11.0.0 version: 11.0.0 masto: - specifier: ^6.10.4 - version: 6.10.4 + specifier: ^7.2.0 + version: 7.2.0 mocked-exports: specifier: ^0.1.1 version: 0.1.1 @@ -7141,8 +7141,8 @@ packages: markdown-table@3.0.3: resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==} - masto@6.10.4: - resolution: {integrity: sha512-TqIkWaZa884j9jik39efsv6mdpgalUElwiGLLPHevLlIuCSnGjapGC++VovlQvvVV6O5e4ce/gzWNy17cF6PHg==} + masto@7.2.0: + resolution: {integrity: sha512-fjaLIEj0rOn4fzrvOzA/YXgI8kwFX10Z5G8c7hIof6zmbS9aPg5sdrRp54F0gjQZWgBjjWKxVh155zxWnx4Udg==} math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} @@ -17701,9 +17701,9 @@ snapshots: isobject@3.0.1: {} - isomorphic-ws@5.0.0(ws@8.18.2): + isomorphic-ws@5.0.0(ws@8.18.3): dependencies: - ws: 8.18.2 + ws: 8.18.3 jackspeak@3.4.3: dependencies: @@ -18025,13 +18025,13 @@ snapshots: markdown-table@3.0.3: {} - masto@6.10.4: + masto@7.2.0: dependencies: change-case: 4.1.2 events-to-async: 2.0.1 - isomorphic-ws: 5.0.0(ws@8.18.2) + isomorphic-ws: 5.0.0(ws@8.18.3) ts-custom-error: 3.3.1 - ws: 8.18.2 + ws: 8.18.3 transitivePeerDependencies: - bufferutil - utf-8-validate From b0269c43664eaf5cad169e45770423893885dc40 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sun, 24 Aug 2025 17:18:06 +0900 Subject: [PATCH 2/4] chore: migrate to new masto.js API --- app/components/timeline/TimelineNotifications.vue | 2 +- app/composables/masto/notification.ts | 2 +- app/composables/paginator.ts | 2 +- app/composables/tiptap/suggestion.ts | 10 ++++++++-- app/middleware/1.permalink.global.ts | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/components/timeline/TimelineNotifications.vue b/app/components/timeline/TimelineNotifications.vue index b966b7d4..e64d2702 100644 --- a/app/components/timeline/TimelineNotifications.vue +++ b/app/components/timeline/TimelineNotifications.vue @@ -13,7 +13,7 @@ const options = { limit: 30, types: filter ? [filter] : [] } // Default limit is 20 notifications, and servers are normally caped to 30 const paginator = useMastoClient().v1.notifications.list(options) -const stream = useStreaming(client => client.user.notification.subscribe()) +const stream = useStreaming(client => client.user.subscribe()) lastAccessedNotificationRoute.value = route.path.replace(/\/notifications\/?/, '') diff --git a/app/composables/masto/notification.ts b/app/composables/masto/notification.ts index 20939bec..fb62bf11 100644 --- a/app/composables/masto/notification.ts +++ b/app/composables/masto/notification.ts @@ -44,7 +44,7 @@ export function useNotifications() { processNotifications(stream, id) const position = await client.value.v1.markers.fetch({ timeline: ['notifications'] }) - const paginator = client.value.v1.notifications.list({ limit: 30 }) + const paginator = client.value.v1.notifications.list({ limit: 30 }).values() do { const result = await paginator.next() diff --git a/app/composables/paginator.ts b/app/composables/paginator.ts index 93aeed1f..e7f47724 100644 --- a/app/composables/paginator.ts +++ b/app/composables/paginator.ts @@ -12,7 +12,7 @@ export function usePaginator( // called `next` method will mutate the internal state of the variable, // and we need its initial state after HMR // so clone it - const paginator = _paginator.clone() + const paginator = _paginator.values() const state = ref(isHydrated.value ? 'idle' : 'loading') const items = ref([]) diff --git a/app/composables/tiptap/suggestion.ts b/app/composables/tiptap/suggestion.ts index fdaa24cd..3b4b0b16 100644 --- a/app/composables/tiptap/suggestion.ts +++ b/app/composables/tiptap/suggestion.ts @@ -14,6 +14,7 @@ import { currentCustomEmojis, updateCustomEmojis } from '~/composables/emojis' export type { Emoji } export type CustomEmoji = (mastodon.v1.CustomEmoji & { custom: true }) + export function isCustomEmoji(emoji: CustomEmoji | Emoji): emoji is CustomEmoji { return !!(emoji as CustomEmoji).custom } @@ -27,7 +28,12 @@ export const TiptapMentionSuggestion: Partial = import.meta.s if (query.length === 0) return [] - const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true }) + const paginator = useMastoClient().v2.search.list({ + q: query, + type: 'accounts', + limit: 25, + resolve: true, + }).values() return (await paginator.next()).value?.accounts ?? [] }, render: createSuggestionRenderer(TiptapMentionList), @@ -46,7 +52,7 @@ export const TiptapHashtagSuggestion: Partial = { limit: 25, resolve: false, excludeUnreviewed: true, - }) + }).values() return (await paginator.next()).value?.hashtags ?? [] }, render: createSuggestionRenderer(TiptapHashtagList), diff --git a/app/middleware/1.permalink.global.ts b/app/middleware/1.permalink.global.ts index 754d0815..c61e1a97 100644 --- a/app/middleware/1.permalink.global.ts +++ b/app/middleware/1.permalink.global.ts @@ -43,7 +43,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { } // If we're logged in, search for the local id the account or status corresponds to - const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 }) + const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 }).values() const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] } if (statuses[0]) From 3ea6e4448eacf3ef0cbcf2b40d0bf1634cd9c52b Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sun, 24 Aug 2025 20:01:33 +0900 Subject: [PATCH 3/4] chore: fix remaining type mismatch --- app/composables/cache.ts | 2 +- app/composables/masto/search.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/composables/cache.ts b/app/composables/cache.ts index 83d25c05..27f8f9de 100644 --- a/app/composables/cache.ts +++ b/app/composables/cache.ts @@ -74,7 +74,7 @@ export async function fetchAccountByHandle(acct: string): Promise, options: UseSearchOpt const q = computed(() => resolveUnref(query).trim()) - let paginator: mastodon.Paginator | undefined + let paginator: AsyncIterableIterator | undefined const appendResults = (results: mastodon.v2.Search, empty = false) => { if (empty) { @@ -76,7 +76,7 @@ export function useSearch(query: MaybeRefOrGetter, options: UseSearchOpt q: q.value, ...resolveUnref(options), resolve: !!currentUser.value, - }) + }).values() const nextResults = await paginator.next() done.value = !!nextResults.done From dc0cdbcc5eae25a8fdad1262d78a31e2afbf0a8f Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Tue, 30 Sep 2025 12:19:18 +0900 Subject: [PATCH 4/4] chore: update `pnpm-lock.yaml` --- pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b7b73ce..4bf3c802 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -198,8 +198,8 @@ importers: specifier: ^0.30.19 version: 0.30.19 masto: - specifier: ^6.10.4 - version: 6.10.4 + specifier: ^7.2.0 + version: 7.2.0 mocked-exports: specifier: ^0.1.1 version: 0.1.1 @@ -6384,8 +6384,8 @@ packages: marky@1.3.0: resolution: {integrity: sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==} - masto@6.10.4: - resolution: {integrity: sha512-TqIkWaZa884j9jik39efsv6mdpgalUElwiGLLPHevLlIuCSnGjapGC++VovlQvvVV6O5e4ce/gzWNy17cF6PHg==} + masto@7.2.0: + resolution: {integrity: sha512-fjaLIEj0rOn4fzrvOzA/YXgI8kwFX10Z5G8c7hIof6zmbS9aPg5sdrRp54F0gjQZWgBjjWKxVh155zxWnx4Udg==} math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} @@ -16202,7 +16202,7 @@ snapshots: marky@1.3.0: {} - masto@6.10.4: + masto@7.2.0: dependencies: change-case: 4.1.2 events-to-async: 2.0.2