diff --git a/components/account/AccountFollowButton.vue b/components/account/AccountFollowButton.vue
index bb7cc240..36916a7d 100644
--- a/components/account/AccountFollowButton.vue
+++ b/components/account/AccountFollowButton.vue
@@ -19,7 +19,7 @@ const { client } = $(useMasto())
async function unblock() {
relationship!.blocking = false
try {
- const newRel = await client.v1.accounts.unblock(account.id)
+ const newRel = await client.v1.accounts.$select(account.id).unblock()
Object.assign(relationship!, newRel)
}
catch (err) {
@@ -32,7 +32,7 @@ async function unblock() {
async function unmute() {
relationship!.muting = false
try {
- const newRel = await client.v1.accounts.unmute(account.id)
+ const newRel = await client.v1.accounts.$select(account.id).unmute()
Object.assign(relationship!, newRel)
}
catch (err) {
diff --git a/components/account/AccountFollowRequestButton.vue b/components/account/AccountFollowRequestButton.vue
index 61cab918..2c60a760 100644
--- a/components/account/AccountFollowRequestButton.vue
+++ b/components/account/AccountFollowRequestButton.vue
@@ -12,7 +12,7 @@ async function authorizeFollowRequest() {
relationship!.requestedBy = false
relationship!.followedBy = true
try {
- const newRel = await client.v1.followRequests.authorize(account.id)
+ const newRel = await client.v1.followRequests.$select(account.id).authorize()
Object.assign(relationship!, newRel)
}
catch (err) {
@@ -25,7 +25,7 @@ async function authorizeFollowRequest() {
async function rejectFollowRequest() {
relationship!.requestedBy = false
try {
- const newRel = await client.v1.followRequests.reject(account.id)
+ const newRel = await client.v1.followRequests.$select(account.id).reject()
Object.assign(relationship!, newRel)
}
catch (err) {
diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue
index 85d2cfe5..c97cf369 100644
--- a/components/account/AccountHeader.vue
+++ b/components/account/AccountHeader.vue
@@ -53,7 +53,7 @@ function previewAvatar() {
async function toggleNotifications() {
relationship!.notifying = !relationship?.notifying
try {
- const newRel = await client.v1.accounts.follow(account.id, { notify: relationship?.notifying })
+ const newRel = await client.v1.accounts.$select(account.id).follow({ notify: relationship?.notifying })
Object.assign(relationship!, newRel)
}
catch {
@@ -97,7 +97,7 @@ async function editNote(event: Event) {
if (relationship.note?.trim() === newNote.trim())
return
- const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote })
+ const newNoteApiResult = await client.v1.accounts.$select(account.id).note.create({ comment: newNote })
relationship.note = newNoteApiResult.note
personalNoteDraft.value = relationship.note ?? ''
}
diff --git a/components/account/AccountMoreButton.vue b/components/account/AccountMoreButton.vue
index 5c524e9a..3a179fa2 100644
--- a/components/account/AccountMoreButton.vue
+++ b/components/account/AccountMoreButton.vue
@@ -33,7 +33,7 @@ async function toggleReblogs() {
return
const showingReblogs = !relationship?.showingReblogs
- relationship = await client.v1.accounts.follow(account.id, { reblogs: showingReblogs })
+ relationship = await client.v1.accounts.$select(account.id).follow({ reblogs: showingReblogs })
}
async function addUserNote() {
@@ -44,7 +44,7 @@ async function removeUserNote() {
if (!relationship!.note || relationship!.note.length === 0)
return
- const newNote = await client.v1.accounts.createNote(account.id, { comment: '' })
+ const newNote = await client.v1.accounts.$select(account.id).note.create({ comment: '' })
relationship!.note = newNote.note
emit('removeNote')
}
diff --git a/components/account/AccountPaginator.vue b/components/account/AccountPaginator.vue
index 86bcccb8..0445439d 100644
--- a/components/account/AccountPaginator.vue
+++ b/components/account/AccountPaginator.vue
@@ -1,8 +1,8 @@
diff --git a/components/timeline/TimelineDomainBlocks.vue b/components/timeline/TimelineDomainBlocks.vue
index 0763e8ec..a4dfcf20 100644
--- a/components/timeline/TimelineDomainBlocks.vue
+++ b/components/timeline/TimelineDomainBlocks.vue
@@ -3,7 +3,7 @@ const { client } = $(useMasto())
const paginator = client.v1.domainBlocks.list()
async function unblock(domain: string) {
- await client.v1.domainBlocks.unblock(domain)
+ await client.v1.domainBlocks.remove({ domain })
}
diff --git a/components/timeline/TimelineHome.vue b/components/timeline/TimelineHome.vue
index 95793794..905335d3 100644
--- a/components/timeline/TimelineHome.vue
+++ b/components/timeline/TimelineHome.vue
@@ -1,8 +1,8 @@
diff --git a/components/timeline/TimelinePublic.vue b/components/timeline/TimelinePublic.vue
index ec4fac85..2a110e9a 100644
--- a/components/timeline/TimelinePublic.vue
+++ b/components/timeline/TimelinePublic.vue
@@ -1,8 +1,8 @@
diff --git a/composables/cache.ts b/composables/cache.ts
index 4a8d122f..68b2e002 100644
--- a/composables/cache.ts
+++ b/composables/cache.ts
@@ -24,7 +24,7 @@ export function fetchStatus(id: string, force = false): Promise {
cacheStatus(status)
return status
@@ -44,7 +44,7 @@ export function fetchAccountById(id?: string | null): Promise {
if (r.acct && !r.acct.includes('@') && domain)
r.acct = `${r.acct}@${domain}`
@@ -74,7 +74,7 @@ export async function fetchAccountByHandle(acct: string): Promise(undefined as never)
- let params = $ref>()
- const canStreaming = $computed(() => !!params?.streamingApiUrl)
-
- const setParams = (newParams: Partial) => {
- const p = { ...params, ...newParams } as CreateClientParams
- client = createClient(p)
- params = p
- }
-
return {
- client: $$(client),
- params: readonly($$(params)),
- canStreaming: $$(canStreaming),
- setParams,
+ client: shallowRef(undefined as never),
+ streamingClient: shallowRef(),
}
}
export type ElkMasto = ReturnType
@@ -34,23 +21,25 @@ export function useMastoClient() {
}
export function mastoLogin(masto: ElkMasto, user: Pick) {
- const { setParams } = $(masto)
-
const server = user.server
const url = `https://${server}`
const instance: ElkInstance = reactive(getInstanceCache(server) || { uri: server, accountDomain: server })
- setParams({
- url,
- accessToken: user?.token,
- disableVersionCheck: true,
- streamingApiUrl: instance?.urls?.streamingApi,
- })
+ const accessToken = user.token
- fetchV1Instance({ url }).then((newInstance) => {
+ const createStreamingClient = (streamingApiUrl: string | undefined) => {
+ return streamingApiUrl ? createStreamingAPIClient({ streamingApiUrl, accessToken, implementation: globalThis.WebSocket }) : undefined
+ }
+
+ const streamingApiUrl = instance?.urls?.streamingApi
+ masto.client.value = createRestAPIClient({ url, accessToken })
+ masto.streamingClient.value = createStreamingClient(streamingApiUrl)
+
+ // Refetch instance info in the background on login
+ masto.client.value.v1.instance.fetch().then((newInstance) => {
Object.assign(instance, newInstance)
- setParams({
- streamingApiUrl: newInstance.urls.streamingApi,
- })
+ if (newInstance.urls.streamingApi !== streamingApiUrl)
+ masto.streamingClient.value = createStreamingClient(newInstance.urls.streamingApi)
+
instanceStorage.value[server] = newInstance
})
@@ -73,21 +62,21 @@ interface UseStreamingOptions {
}
export function useStreaming(
- cb: (client: mastodon.Client) => Promise,
+ cb: (client: mastodon.streaming.Client) => mastodon.streaming.Subscription,
options: UseStreamingOptions,
-): { stream: Ref | undefined> } & Pausable
+): { stream: Ref } & Pausable
export function useStreaming(
- cb: (client: mastodon.Client) => Promise,
+ cb: (client: mastodon.streaming.Client) => mastodon.streaming.Subscription,
options?: UseStreamingOptions,
-): Ref | undefined>
+): Ref
export function useStreaming(
- cb: (client: mastodon.Client) => Promise,
+ cb: (client: mastodon.streaming.Client) => mastodon.streaming.Subscription,
{ immediate = true, controls }: UseStreamingOptions = {},
-): ({ stream: Ref | undefined> } & Pausable) | Ref | undefined> {
- const { canStreaming, client } = useMasto()
+): ({ stream: Ref } & Pausable) | Ref {
+ const { streamingClient } = useMasto()
const isActive = ref(immediate)
- const stream = ref>()
+ const stream = ref()
function pause() {
isActive.value = false
@@ -99,15 +88,15 @@ export function useStreaming(
function cleanup() {
if (stream.value) {
- stream.value.then(s => s.disconnect()).catch(() => Promise.resolve())
+ stream.value.unsubscribe()
stream.value = undefined
}
}
watchEffect(() => {
cleanup()
- if (canStreaming.value && isActive.value)
- stream.value = cb(client.value)
+ if (streamingClient.value && isActive.value)
+ stream.value = cb(streamingClient.value)
})
if (process.client && !process.test)
diff --git a/composables/masto/notification.ts b/composables/masto/notification.ts
index 65df56bc..8577b252 100644
--- a/composables/masto/notification.ts
+++ b/composables/masto/notification.ts
@@ -1,11 +1,11 @@
-import type { WsEvents } from 'masto'
+import type { mastodon } from 'masto'
-const notifications = reactive, string[]]>>({})
+const notifications = reactive, string[]]>>({})
export function useNotifications() {
const id = currentUser.value?.account.id
- const { client, canStreaming } = $(useMasto())
+ const { client, streamingClient } = $(useMasto())
async function clearNotifications() {
if (!id || !notifications[id])
@@ -19,21 +19,27 @@ export function useNotifications() {
}
}
+ async function processNotifications(stream: mastodon.streaming.Subscription, id: string) {
+ for await (const entry of stream) {
+ if (entry.event === 'notification' && notifications[id])
+ notifications[id]![1].unshift(entry.payload.id)
+ }
+ }
+
async function connect(): Promise {
- if (!isHydrated.value || !id || notifications[id] || !currentUser.value?.token)
+ if (!isHydrated.value || !id || notifications[id] !== undefined || !currentUser.value?.token)
return
let resolveStream
- const stream = new Promise(resolve => resolveStream = resolve)
- notifications[id] = [stream, []]
+ const streamPromise = new Promise(resolve => resolveStream = resolve)
+ notifications[id] = [streamPromise, []]
- await until($$(canStreaming)).toBe(true)
+ await until($$(streamingClient)).toBe(true)
- client.v1.stream.streamUser().then(resolveStream)
- stream.then(s => s.on('notification', (n) => {
- if (notifications[id])
- notifications[id]![1].unshift(n.id)
- }))
+ const stream = streamingClient!.user.subscribe()
+ resolveStream!(stream)
+
+ processNotifications(stream, id)
const position = await client.v1.markers.fetch({ timeline: ['notifications'] })
const paginator = client.v1.notifications.list({ limit: 30 })
@@ -55,7 +61,7 @@ export function useNotifications() {
function disconnect(): void {
if (!id || !notifications[id])
return
- notifications[id]![0].then(stream => stream.disconnect())
+ notifications[id]![0].then(stream => stream.unsubscribe())
notifications[id] = undefined
}
@@ -67,7 +73,6 @@ export function useNotifications() {
return {
notifications: computed(() => id ? notifications[id]?.[1].length ?? 0 : 0),
- disconnect,
clearNotifications,
}
}
diff --git a/composables/masto/publish.ts b/composables/masto/publish.ts
index 9c5ed276..5d70383f 100644
--- a/composables/masto/publish.ts
+++ b/composables/masto/publish.ts
@@ -93,7 +93,7 @@ export function usePublish(options: {
language: draft.params.language || preferredLanguage,
poll,
...(isGlitchEdition.value ? { 'content-type': 'text/markdown' } : {}),
- } as mastodon.v1.CreateStatusParams
+ } as mastodon.rest.v1.CreateStatusParams
if (process.dev) {
// eslint-disable-next-line no-console
@@ -116,14 +116,13 @@ export function usePublish(options: {
}
else {
- const updatePayload = {
+ status = await client.v1.statuses.$select(draft.editingStatus.id).update({
...payload,
mediaAttributes: draft.attachments.map(media => ({
id: media.id,
description: media.description,
})),
- } as mastodon.v1.UpdateStatusParams
- status = await client.v1.statuses.update(draft.editingStatus.id, updatePayload)
+ })
}
if (draft.params.inReplyToId)
navigateToStatus({ status })
@@ -232,7 +231,7 @@ export function useUploadMediaAttachment(draftRef: Ref) {
if (draft.attachments.length < limit) {
isExceedingAttachmentLimit = false
try {
- const attachment = await client.v1.mediaAttachments.create({
+ const attachment = await client.v1.media.create({
file: await processFile(file),
})
draft.attachments.push(attachment)
@@ -266,7 +265,7 @@ export function useUploadMediaAttachment(draftRef: Ref) {
async function setDescription(att: mastodon.v1.MediaAttachment, description: string) {
att.description = description
if (!draft.editingStatus)
- await client.v1.mediaAttachments.update(att.id, { description: att.description })
+ await client.v1.media.$select(att.id).update({ description: att.description })
}
function removeAttachment(index: number) {
diff --git a/composables/masto/relationship.ts b/composables/masto/relationship.ts
index 00f3cf72..f515e439 100644
--- a/composables/masto/relationship.ts
+++ b/composables/masto/relationship.ts
@@ -27,7 +27,7 @@ export function useRelationship(account: mastodon.v1.Account): Ref !r.value)
- const relationships = await useMastoClient().v1.accounts.fetchRelationships(requested.map(([id]) => id))
+ const relationships = await useMastoClient().v1.accounts.relationships.fetch({ id: requested.map(([id]) => id) })
for (let i = 0; i < requested.length; i++)
requested[i][1].value = relationships[i]
}
@@ -58,7 +58,7 @@ export async function toggleFollowAccount(relationship: mastodon.v1.Relationship
relationship!.following = true
}
- relationship = await client.v1.accounts[unfollow ? 'unfollow' : 'follow'](account.id)
+ relationship = await client.v1.accounts.$select(account.id)[unfollow ? 'unfollow' : 'follow']()
}
export async function toggleMuteAccount(relationship: mastodon.v1.Relationship, account: mastodon.v1.Account) {
@@ -74,10 +74,10 @@ export async function toggleMuteAccount(relationship: mastodon.v1.Relationship,
relationship!.muting = !relationship!.muting
relationship = relationship!.muting
- ? await client.v1.accounts.mute(account.id, {
+ ? await client.v1.accounts.$select(account.id).mute({
// TODO support more options
})
- : await client.v1.accounts.unmute(account.id)
+ : await client.v1.accounts.$select(account.id).unmute()
}
export async function toggleBlockAccount(relationship: mastodon.v1.Relationship, account: mastodon.v1.Account) {
@@ -92,7 +92,7 @@ export async function toggleBlockAccount(relationship: mastodon.v1.Relationship,
return
relationship!.blocking = !relationship!.blocking
- relationship = await client.v1.accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
+ relationship = await client.v1.accounts.$select(account.id)[relationship!.blocking ? 'block' : 'unblock']()
}
export async function toggleBlockDomain(relationship: mastodon.v1.Relationship, account: mastodon.v1.Account) {
@@ -107,5 +107,5 @@ export async function toggleBlockDomain(relationship: mastodon.v1.Relationship,
return
relationship!.domainBlocking = !relationship!.domainBlocking
- await client.v1.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
+ await client.v1.domainBlocks[relationship!.domainBlocking ? 'create' : 'remove']({ domain: getServerName(account) })
}
diff --git a/composables/masto/search.ts b/composables/masto/search.ts
index 3e337cf7..b672a87b 100644
--- a/composables/masto/search.ts
+++ b/composables/masto/search.ts
@@ -1,9 +1,9 @@
import type { MaybeRefOrGetter } from '@vueuse/core'
-import type { Paginator, mastodon } from 'masto'
+import type { mastodon } from 'masto'
import type { RouteLocation } from 'vue-router'
export type UseSearchOptions = MaybeRefOrGetter<
- Partial>
+ Partial>
>
export interface BuildSearchResult {
@@ -30,7 +30,7 @@ export function useSearch(query: MaybeRefOrGetter, options: UseSearchOpt
const q = $computed(() => resolveUnref(query).trim())
- let paginator: Paginator | undefined
+ let paginator: mastodon.Paginator | undefined
const appendResults = (results: mastodon.v2.Search, empty = false) => {
if (empty) {
@@ -72,7 +72,7 @@ export function useSearch(query: MaybeRefOrGetter, options: UseSearchOpt
* Based on the source it seems like modifying the params when calling next would result in a new search,
* but that doesn't seem to be the case. So instead we just create a new paginator with the new params.
*/
- paginator = client.v2.search({
+ paginator = client.v2.search.list({
q,
...resolveUnref(options),
resolve: !!currentUser.value,
diff --git a/composables/masto/status.ts b/composables/masto/status.ts
index 5dc6ee87..5120837f 100644
--- a/composables/masto/status.ts
+++ b/composables/masto/status.ts
@@ -61,7 +61,7 @@ export function useStatusActions(props: StatusActionsProps) {
const toggleReblog = () => toggleStatusAction(
'reblogged',
- () => client.v1.statuses[status.reblogged ? 'unreblog' : 'reblog'](status.id).then((res) => {
+ () => client.v1.statuses.$select(status.id)[status.reblogged ? 'unreblog' : 'reblog']().then((res) => {
if (status.reblogged)
// returns the original status
return res.reblog!
@@ -72,23 +72,23 @@ export function useStatusActions(props: StatusActionsProps) {
const toggleFavourite = () => toggleStatusAction(
'favourited',
- () => client.v1.statuses[status.favourited ? 'unfavourite' : 'favourite'](status.id),
+ () => client.v1.statuses.$select(status.id)[status.favourited ? 'unfavourite' : 'favourite'](),
'favouritesCount',
)
const toggleBookmark = () => toggleStatusAction(
'bookmarked',
- () => client.v1.statuses[status.bookmarked ? 'unbookmark' : 'bookmark'](status.id),
+ () => client.v1.statuses.$select(status.id)[status.bookmarked ? 'unbookmark' : 'bookmark'](),
)
const togglePin = async () => toggleStatusAction(
'pinned',
- () => client.v1.statuses[status.pinned ? 'unpin' : 'pin'](status.id),
+ () => client.v1.statuses.$select(status.id)[status.pinned ? 'unpin' : 'pin'](),
)
const toggleMute = async () => toggleStatusAction(
'muted',
- () => client.v1.statuses[status.muted ? 'unmute' : 'mute'](status.id),
+ () => client.v1.statuses.$select(status.id)[status.muted ? 'unmute' : 'mute'](),
)
return {
diff --git a/composables/masto/statusDrafts.ts b/composables/masto/statusDrafts.ts
index 82a27307..34b429bb 100644
--- a/composables/masto/statusDrafts.ts
+++ b/composables/masto/statusDrafts.ts
@@ -25,7 +25,7 @@ function getDefaultVisibility(currentVisibility: mastodon.v1.StatusVisibility) {
: preferredVisibility
}
-export function getDefaultDraft(options: Partial & Omit> = {}): Draft {
+export function getDefaultDraft(options: Partial & Omit> = {}): Draft {
const {
attachments = [],
initialText = '',
diff --git a/composables/paginator.ts b/composables/paginator.ts
index 4ef49667..295c51ac 100644
--- a/composables/paginator.ts
+++ b/composables/paginator.ts
@@ -1,10 +1,10 @@
-import type { Paginator, WsEvents, mastodon } from 'masto'
+import type { mastodon } from 'masto'
import type { Ref } from 'vue'
import type { PaginatorState } from '~/types'
export function usePaginator(
- _paginator: Paginator,
- stream: Ref | undefined>,
+ _paginator: mastodon.Paginator,
+ stream: Ref,
eventType: 'notification' | 'update' = 'update',
preprocess: (items: (T | U)[]) => U[] = items => items as unknown as U[],
buffer = 10,
@@ -30,10 +30,15 @@ export function usePaginator(
prevItems.value = []
}
- watch(stream, (stream) => {
- stream?.then((s) => {
- s.on(eventType, (status) => {
- if ('uri' in status)
+ watch(stream, async (stream) => {
+ if (!stream)
+ return
+
+ for await (const entry of stream) {
+ if (entry.event === 'update') {
+ const status = entry.payload
+
+ if ('uri' in entry)
cacheStatus(status, undefined, true)
const index = prevItems.value.findIndex((i: any) => i.id === status.id)
@@ -41,27 +46,27 @@ export function usePaginator(
prevItems.value.splice(index, 1)
prevItems.value.unshift(status as any)
- })
-
- // TODO: update statuses
- s.on('status.update', (status) => {
+ }
+ else if (entry.event === 'status.update') {
+ const status = entry.payload
cacheStatus(status, undefined, true)
const data = items.value as mastodon.v1.Status[]
const index = data.findIndex(s => s.id === status.id)
if (index >= 0)
data[index] = status
- })
+ }
- s.on('delete', (id) => {
+ else if (entry.event === 'delete') {
+ const id = entry.payload
removeCachedStatus(id)
const data = items.value as mastodon.v1.Status[]
const index = data.findIndex(s => s.id === id)
if (index >= 0)
data.splice(index, 1)
- })
- })
+ }
+ }
}, { immediate: true })
async function loadNext() {
diff --git a/composables/push-notifications/createPushSubscription.ts b/composables/push-notifications/createPushSubscription.ts
index fd3d260f..4368a40b 100644
--- a/composables/push-notifications/createPushSubscription.ts
+++ b/composables/push-notifications/createPushSubscription.ts
@@ -8,7 +8,7 @@ import { PushSubscriptionError } from '~/composables/push-notifications/types'
export async function createPushSubscription(user: RequiredUserLogin,
notificationData: CreatePushNotification,
- policy: mastodon.v1.SubscriptionPolicy = 'all',
+ policy: mastodon.v1.WebPushSubscriptionPolicy = 'all',
force = false): Promise {
const { server: serverEndpoint, vapidKey } = user
@@ -115,10 +115,10 @@ async function removePushNotificationDataOnError(e: Error) {
async function sendSubscriptionToBackend(
subscription: PushSubscription,
data: CreatePushNotification,
- policy: mastodon.v1.SubscriptionPolicy,
+ policy: mastodon.v1.WebPushSubscriptionPolicy,
): Promise {
const { endpoint, keys } = subscription.toJSON()
- const params: mastodon.v1.CreateWebPushSubscriptionParams = {
+ return await useMastoClient().v1.push.subscription.create({
policy,
subscription: {
endpoint: endpoint!,
@@ -128,7 +128,5 @@ async function sendSubscriptionToBackend(
},
},
data,
- }
-
- return await useMastoClient().v1.webPushSubscriptions.create(params)
+ })
}
diff --git a/composables/push-notifications/types.ts b/composables/push-notifications/types.ts
index 979c7669..5c344b82 100644
--- a/composables/push-notifications/types.ts
+++ b/composables/push-notifications/types.ts
@@ -14,11 +14,11 @@ export interface RequiredUserLogin extends Required | null
- policy?: mastodon.v1.SubscriptionPolicy
+ policy?: mastodon.v1.WebPushSubscriptionPolicy
}
export type PushNotificationRequest = Record
-export type PushNotificationPolicy = Record
+export type PushNotificationPolicy = Record
export interface CustomEmojisInfo {
lastUpdate: number
diff --git a/composables/push-notifications/usePushManager.ts b/composables/push-notifications/usePushManager.ts
index 09f98757..b092bd31 100644
--- a/composables/push-notifications/usePushManager.ts
+++ b/composables/push-notifications/usePushManager.ts
@@ -61,7 +61,7 @@ export function usePushManager() {
const subscribe = async (
notificationData?: CreatePushNotification,
- policy?: mastodon.v1.SubscriptionPolicy,
+ policy?: mastodon.v1.WebPushSubscriptionPolicy,
force?: boolean,
): Promise => {
if (!isSupported)
@@ -116,7 +116,7 @@ export function usePushManager() {
await removePushNotificationData(currentUser.value)
}
- const saveSettings = async (policy?: mastodon.v1.SubscriptionPolicy) => {
+ const saveSettings = async (policy?: mastodon.v1.WebPushSubscriptionPolicy) => {
if (policy)
pushNotificationData.value.policy = policy
@@ -173,7 +173,7 @@ export function usePushManager() {
if (policyChanged)
await subscribe(data, policy, true)
else
- currentUser.value.pushSubscription = await client.v1.webPushSubscriptions.update({ data })
+ currentUser.value.pushSubscription = await client.v1.push.subscription.update({ data })
policyChanged && await nextTick()
@@ -198,7 +198,7 @@ export function usePushManager() {
function createRawSettings(
pushSubscription?: mastodon.v1.WebPushSubscription,
- subscriptionPolicy?: mastodon.v1.SubscriptionPolicy,
+ subscriptionPolicy?: mastodon.v1.WebPushSubscriptionPolicy,
) {
return {
follow: pushSubscription?.alerts.follow ?? true,
diff --git a/composables/tiptap/suggestion.ts b/composables/tiptap/suggestion.ts
index eb648e8c..0add4f01 100644
--- a/composables/tiptap/suggestion.ts
+++ b/composables/tiptap/suggestion.ts
@@ -27,8 +27,8 @@ export const TiptapMentionSuggestion: Partial = process.serve
if (query.length === 0)
return []
- const results = await useMastoClient().v2.search({ q: query, type: 'accounts', limit: 25, resolve: true })
- return results.accounts
+ const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true })
+ return (await paginator.next()).value?.accounts ?? []
},
render: createSuggestionRenderer(TiptapMentionList),
}
@@ -40,14 +40,14 @@ export const TiptapHashtagSuggestion: Partial = {
if (query.length === 0)
return []
- const results = await useMastoClient().v2.search({
+ const paginator = useMastoClient().v2.search.list({
q: query,
type: 'hashtags',
limit: 25,
resolve: false,
excludeUnreviewed: true,
})
- return results.hashtags
+ return (await paginator.next()).value?.hashtags ?? []
},
render: createSuggestionRenderer(TiptapHashtagList),
}
diff --git a/composables/users.ts b/composables/users.ts
index 5bdc33b7..00fbf0fc 100644
--- a/composables/users.ts
+++ b/composables/users.ts
@@ -149,7 +149,7 @@ export async function loginTo(masto: ElkMasto, user: Overwrite Promise.resolve(undefined))
+ ? client.v1.push.subscription.fetch().catch(() => Promise.resolve(undefined))
: Promise.resolve(undefined),
])
@@ -172,6 +172,7 @@ export async function loginTo(masto: ElkMasto, user: Overwrite>()
/**
+ * @param account
* @returns `true` when user ticked the preference to always expand posts with content warnings
*/
export function getExpandSpoilersByDefault(account: mastodon.v1.AccountCredentials) {
@@ -179,6 +180,7 @@ export function getExpandSpoilersByDefault(account: mastodon.v1.AccountCredentia
}
/**
+ * @param account
* @returns `true` when user selected "Always show media" as Media Display preference
*/
export function getExpandMediaByDefault(account: mastodon.v1.AccountCredentials) {
@@ -186,13 +188,14 @@ export function getExpandMediaByDefault(account: mastodon.v1.AccountCredentials)
}
/**
+ * @param account
* @returns `true` when user selected "Always hide media" as Media Display preference
*/
export function getHideMediaByDefault(account: mastodon.v1.AccountCredentials) {
return accountPreferencesMap.get(account.acct)?.['reading:expand:media'] === 'hide_all' ?? false
}
-export async function fetchAccountInfo(client: mastodon.Client, server: string) {
+export async function fetchAccountInfo(client: mastodon.rest.Client, server: string) {
// Try to fetch user preferences if the backend supports it.
const fetchPrefs = async (): Promise> => {
try {
@@ -267,7 +270,7 @@ export async function removePushNotifications(user: UserLogin) {
return
// unsubscribe push notifications
- await useMastoClient().v1.webPushSubscriptions.remove().catch(() => Promise.resolve())
+ await useMastoClient().v1.push.subscription.remove().catch(() => Promise.resolve())
}
export async function switchUser(user: UserLogin) {
@@ -336,6 +339,8 @@ interface UseUserLocalStorageCache {
/**
* Create reactive storage for the current user
+ * @param key
+ * @param initial
*/
export function useUserLocalStorage(key: string, initial: () => T): Ref {
if (process.server || process.test)
@@ -382,6 +387,7 @@ export function useUserLocalStorage(key: string, initial: () =
/**
* Clear all storages for the given account
+ * @param account
*/
export function clearUserLocalStorage(account?: mastodon.v1.Account) {
if (!account)
diff --git a/middleware/1.permalink.global.ts b/middleware/1.permalink.global.ts
index c6aa8901..e27f5fdc 100644
--- a/middleware/1.permalink.global.ts
+++ b/middleware/1.permalink.global.ts
@@ -43,7 +43,9 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
}
// If we're logged in, search for the local id the account or status corresponds to
- const { accounts, statuses } = await masto.client.value.v2.search({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 })
+ const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 })
+ const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] }
+
if (statuses[0])
return getStatusRoute(statuses[0])
diff --git a/package.json b/package.json
index 5fc5d337..770ff340 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
"iso-639-1": "^3.0.0",
"js-yaml": "^4.1.0",
"lru-cache": "^10.0.0",
- "masto": "^5.11.3",
+ "masto": "^6.5.2",
"node-emoji": "^2.1.3",
"nuxt-security": "^0.13.1",
"page-lifecycle": "^0.1.2",
@@ -108,7 +108,8 @@
"vue-advanced-cropper": "^2.8.8",
"vue-virtual-scroller": "2.0.0-beta.8",
"workbox-build": "^7.0.0",
- "workbox-window": "^7.0.0"
+ "workbox-window": "^7.0.0",
+ "ws": "^8.15.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.41.3",
@@ -121,6 +122,7 @@
"@types/js-yaml": "^4.0.5",
"@types/prettier": "^2.7.3",
"@types/wicg-file-system-access": "^2020.9.6",
+ "@types/ws": "^8.5.10",
"@unlazy/nuxt": "^0.9.3",
"@vue/test-utils": "^2.4.3",
"bumpp": "^9.2.0",
diff --git a/pages/[[server]]/@[account]/[status].vue b/pages/[[server]]/@[account]/[status].vue
index a3aa4350..abf3082a 100644
--- a/pages/[[server]]/@[account]/[status].vue
+++ b/pages/[[server]]/@[account]/[status].vue
@@ -22,7 +22,7 @@ const { data: status, pending, refresh: refreshStatus } = useAsyncData(
const { client } = $(useMasto())
const { data: context, pending: pendingContext, refresh: refreshContext } = useAsyncData(
`context:${id}`,
- async () => client.v1.statuses.fetchContext(id),
+ async () => client.v1.statuses.$select(id).context.fetch(),
{ watch: [isHydrated], immediate: isHydrated.value, lazy: true, default: () => shallowRef() },
)
diff --git a/pages/[[server]]/@[account]/index/followers.vue b/pages/[[server]]/@[account]/index/followers.vue
index 691ae2fa..08ced164 100644
--- a/pages/[[server]]/@[account]/index/followers.vue
+++ b/pages/[[server]]/@[account]/index/followers.vue
@@ -6,7 +6,7 @@ const handle = $(computedEager(() => params.account as string))
definePageMeta({ name: 'account-followers' })
const account = await fetchAccountByHandle(handle)
-const paginator = account ? useMastoClient().v1.accounts.listFollowers(account.id, {}) : null
+const paginator = account ? useMastoClient().v1.accounts.$select(account.id).followers.list() : null
const isSelf = useSelfAccount(account)
diff --git a/pages/[[server]]/@[account]/index/following.vue b/pages/[[server]]/@[account]/index/following.vue
index 173502b9..b0822c6a 100644
--- a/pages/[[server]]/@[account]/index/following.vue
+++ b/pages/[[server]]/@[account]/index/following.vue
@@ -6,7 +6,7 @@ const handle = $(computedEager(() => params.account as string))
definePageMeta({ name: 'account-following' })
const account = await fetchAccountByHandle(handle)
-const paginator = account ? useMastoClient().v1.accounts.listFollowing(account.id, {}) : null
+const paginator = account ? useMastoClient().v1.accounts.$select(account.id).following.list() : null
const isSelf = useSelfAccount(account)
diff --git a/pages/[[server]]/@[account]/index/index.vue b/pages/[[server]]/@[account]/index/index.vue
index b909ca2d..4db4c751 100644
--- a/pages/[[server]]/@[account]/index/index.vue
+++ b/pages/[[server]]/@[account]/index/index.vue
@@ -14,7 +14,7 @@ function reorderAndFilter(items: mastodon.v1.Status[]) {
return reorderedTimeline(items, 'account')
}
-const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { limit: 30, excludeReplies: true })
+const paginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ limit: 30, excludeReplies: true })
if (account) {
useHydratedHead({
diff --git a/pages/[[server]]/@[account]/index/media.vue b/pages/[[server]]/@[account]/index/media.vue
index 1ff955ac..0ca8089c 100644
--- a/pages/[[server]]/@[account]/index/media.vue
+++ b/pages/[[server]]/@[account]/index/media.vue
@@ -7,7 +7,7 @@ const handle = $(computedEager(() => params.account as string))
const account = await fetchAccountByHandle(handle)
-const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { onlyMedia: true, excludeReplies: false })
+const paginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ onlyMedia: true, excludeReplies: false })
if (account) {
useHydratedHead({
diff --git a/pages/[[server]]/@[account]/index/with_replies.vue b/pages/[[server]]/@[account]/index/with_replies.vue
index 189a8d5f..d28fd3b9 100644
--- a/pages/[[server]]/@[account]/index/with_replies.vue
+++ b/pages/[[server]]/@[account]/index/with_replies.vue
@@ -7,7 +7,7 @@ const handle = $(computedEager(() => params.account as string))
const account = await fetchAccountByHandle(handle)
-const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { excludeReplies: false })
+const paginator = useMastoClient().v1.accounts.$select(account.id).statuses.list({ excludeReplies: false })
if (account) {
useHydratedHead({
diff --git a/pages/[[server]]/explore/index.vue b/pages/[[server]]/explore/index.vue
index 56d825d0..af73137b 100644
--- a/pages/[[server]]/explore/index.vue
+++ b/pages/[[server]]/explore/index.vue
@@ -3,7 +3,7 @@ import { STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS } from '~~/constants'
const { t } = useI18n()
-const paginator = useMastoClient().v1.trends.listStatuses()
+const paginator = useMastoClient().v1.trends.statuses.list()
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false)
diff --git a/pages/[[server]]/explore/links.vue b/pages/[[server]]/explore/links.vue
index bafcfbc2..a955e4bb 100644
--- a/pages/[[server]]/explore/links.vue
+++ b/pages/[[server]]/explore/links.vue
@@ -3,7 +3,7 @@ import { STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS } from '~~/constants'
const { t } = useI18n()
-const paginator = useMastoClient().v1.trends.listLinks()
+const paginator = useMastoClient().v1.trends.links.list()
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false)
diff --git a/pages/[[server]]/explore/tags.vue b/pages/[[server]]/explore/tags.vue
index d21aeb2a..e5d2c661 100644
--- a/pages/[[server]]/explore/tags.vue
+++ b/pages/[[server]]/explore/tags.vue
@@ -4,7 +4,7 @@ import { STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS } from '~~/constants'
const { t } = useI18n()
const { client } = $(useMasto())
-const paginator = client.v1.trends.listTags({
+const paginator = client.v1.trends.tags.list({
limit: 20,
})
diff --git a/pages/[[server]]/list/[list]/index.vue b/pages/[[server]]/list/[list]/index.vue
index 05407553..4b1b9741 100644
--- a/pages/[[server]]/list/[list]/index.vue
+++ b/pages/[[server]]/list/[list]/index.vue
@@ -32,7 +32,7 @@ const tabs = $computed(() => [
)
const { client } = $(useMasto())
-const { data: listInfo, refresh } = $(await useAsyncData(() => client.v1.lists.fetch(list), { default: () => shallowRef() }))
+const { data: listInfo, refresh } = $(await useAsyncData(() => client.v1.lists.$select(list).fetch(), { default: () => shallowRef() }))
if (listInfo) {
useHydratedHead({
diff --git a/pages/[[server]]/list/[list]/index/accounts.vue b/pages/[[server]]/list/[list]/index/accounts.vue
index 5bf01f0f..9e478fa1 100644
--- a/pages/[[server]]/list/[list]/index/accounts.vue
+++ b/pages/[[server]]/list/[list]/index/accounts.vue
@@ -6,7 +6,7 @@ definePageMeta({
const params = useRoute().params
const listId = $(computedEager(() => params.list as string))
-const paginator = useMastoClient().v1.lists.listAccounts(listId)
+const paginator = useMastoClient().v1.lists.$select(listId).accounts.list()
diff --git a/pages/[[server]]/list/[list]/index/index.vue b/pages/[[server]]/list/[list]/index/index.vue
index 8b41b97f..44b6346d 100644
--- a/pages/[[server]]/list/[list]/index/index.vue
+++ b/pages/[[server]]/list/[list]/index/index.vue
@@ -8,8 +8,8 @@ const listId = $(computedEager(() => params.list as string))
const client = useMastoClient()
-const paginator = client.v1.timelines.listList(listId)
-const stream = useStreaming(client => client.v1.stream.streamListTimeline(listId))
+const paginator = client.v1.timelines.list.$select(listId).list()
+const stream = useStreaming(client => client.list.subscribe({ list: listId }))
diff --git a/pages/[[server]]/tags/[tag].vue b/pages/[[server]]/tags/[tag].vue
index 397a4181..c326589f 100644
--- a/pages/[[server]]/tags/[tag].vue
+++ b/pages/[[server]]/tags/[tag].vue
@@ -7,10 +7,10 @@ const params = useRoute().params
const tagName = $(computedEager(() => params.tag as string))
const { client } = $(useMasto())
-const { data: tag, refresh } = $(await useAsyncData(() => client.v1.tags.fetch(tagName), { default: () => shallowRef() }))
+const { data: tag, refresh } = $(await useAsyncData(() => client.v1.tags.$select(tagName).fetch(), { default: () => shallowRef() }))
-const paginator = client.v1.timelines.listHashtag(tagName)
-const stream = useStreaming(client => client.v1.stream.streamTagTimeline(tagName))
+const paginator = client.v1.timelines.tag.$select(tagName).list()
+const stream = useStreaming(client => client.hashtag.subscribe({ tag: tagName }))
if (tag) {
useHydratedHead({
diff --git a/pages/settings/profile/appearance.vue b/pages/settings/profile/appearance.vue
index 6538f7e0..4cda54d9 100644
--- a/pages/settings/profile/appearance.vue
+++ b/pages/settings/profile/appearance.vue
@@ -60,7 +60,7 @@ const { submit, submitting } = submitter(async ({ dirtyFields }) => {
if (!isCanSubmit.value)
return
- const res = await client.v1.accounts.updateCredentials(dirtyFields.value as mastodon.v1.UpdateCredentialsParams)
+ const res = await client.v1.accounts.updateCredentials(dirtyFields.value as mastodon.rest.v1.UpdateCredentialsParams)
.then(account => ({ account }))
.catch((error: Error) => ({ error }))
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6e22eff8..68b6afe4 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -168,8 +168,8 @@ importers:
specifier: ^10.0.0
version: 10.0.1
masto:
- specifier: ^5.11.3
- version: 5.11.3
+ specifier: ^6.5.2
+ version: 6.5.2
node-emoji:
specifier: ^2.1.3
version: 2.1.3
@@ -211,10 +211,10 @@ importers:
version: 5.0.1
tauri-plugin-log-api:
specifier: github:tauri-apps/tauri-plugin-log
- version: github.com/tauri-apps/tauri-plugin-log/91dd3fe9dcaa69bae62706e75702a0ce18ce9885
+ version: github.com/tauri-apps/tauri-plugin-log/19f5dcc0425e9127d2c591780e5047b83e77a7c2
tauri-plugin-store-api:
specifier: github:tauri-apps/tauri-plugin-store
- version: github.com/tauri-apps/tauri-plugin-store/3367248b2661abcb73d2a89f30df780c387fb57d
+ version: github.com/tauri-apps/tauri-plugin-store/7d2632996f290b0f18cc5f8a2b2791046400690e
theme-vitesse:
specifier: ^0.7.2
version: 0.7.2
@@ -248,6 +248,9 @@ importers:
workbox-window:
specifier: ^7.0.0
version: 7.0.0
+ ws:
+ specifier: ^8.15.1
+ version: 8.15.1
devDependencies:
'@antfu/eslint-config':
specifier: ^0.41.3
@@ -279,6 +282,9 @@ importers:
'@types/wicg-file-system-access':
specifier: ^2020.9.6
version: 2020.9.6
+ '@types/ws':
+ specifier: ^8.5.10
+ version: 8.5.10
'@unlazy/nuxt':
specifier: ^0.9.3
version: 0.9.3(rollup@2.79.1)
@@ -2699,18 +2705,6 @@ packages:
- encoding
- supports-color
- /@mastojs/ponyfills@1.0.4:
- resolution: {integrity: sha512-1NaIGmcU7OmyNzx0fk+cYeGTkdXlOJOSdetaC4pStVWsrhht2cdlYSAfe5NDW3FcUmcEm2vVceB9lcClN1RCxw==}
- dependencies:
- '@types/node': 18.16.19
- '@types/node-fetch': 2.6.4
- abort-controller: 3.0.0
- form-data: 4.0.0
- node-fetch: 2.6.12
- transitivePeerDependencies:
- - encoding
- dev: false
-
/@netlify/functions@2.4.0:
resolution: {integrity: sha512-dIqhdj5u4Lu/8qbYwtYpn8NfvIyPHbSTV2lAP4ocL+iwC9As06AXT0wa/xOpO2vRWJa0IMxdZaqCPnkyHlHiyg==}
engines: {node: '>=14.0.0'}
@@ -4172,8 +4166,8 @@ packages:
string.prototype.matchall: 4.0.8
dev: false
- /@tauri-apps/api@1.5.1:
- resolution: {integrity: sha512-6unsZDOdlXTmauU3NhWhn+Cx0rODV+rvNvTdvolE5Kls5ybA6cqndQENDt1+FS0tF7ozCP66jwWoH6a5h90BrA==}
+ /@tauri-apps/api@1.5.3:
+ resolution: {integrity: sha512-zxnDjHHKjOsrIzZm6nO5Xapb/BxqUq1tc7cGkFXsFkGTsSWgCPH1D8mm0XS9weJY2OaR73I3k3S+b7eSzJDfqA==}
engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'}
dev: false
@@ -4574,17 +4568,6 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: true
- /@types/node-fetch@2.6.4:
- resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==}
- dependencies:
- '@types/node': 20.8.6
- form-data: 3.0.1
- dev: false
-
- /@types/node@18.16.19:
- resolution: {integrity: sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==}
- dev: false
-
/@types/node@20.8.6:
resolution: {integrity: sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ==}
dependencies:
@@ -4650,6 +4633,12 @@ packages:
resolution: {integrity: sha512-6hogE75Hl2Ov/jgp8ZhDaGmIF/q3J07GtXf8nCJCwKTHq7971po5+DId7grft09zG7plBwpF6ZU0yx9Du4/e1A==}
dev: true
+ /@types/ws@8.5.10:
+ resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
+ dependencies:
+ '@types/node': 20.8.6
+ dev: true
+
/@typescript-eslint/eslint-plugin@6.7.0(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)(typescript@5.1.6):
resolution: {integrity: sha512-gUqtknHm0TDs1LhY12K2NA3Rmlmp88jK9Tx8vGZMfHeNMLE3GH2e9TRub+y+SOjuYgtOmok+wt1AyDPZqxbNag==}
engines: {node: ^16.0.0 || >=18.0.0}
@@ -6220,13 +6209,6 @@ packages:
/abbrev@1.1.1:
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
- /abort-controller@3.0.0:
- resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
- engines: {node: '>=6.5'}
- dependencies:
- event-target-shim: 5.0.1
- dev: false
-
/acorn-import-assertions@1.9.0(acorn@8.11.2):
resolution: {integrity: sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==}
peerDependencies:
@@ -8276,13 +8258,13 @@ packages:
resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
engines: {node: '>= 0.6'}
- /event-target-shim@5.0.1:
- resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
- engines: {node: '>=6'}
- dev: false
-
/eventemitter3@5.0.1:
resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==}
+ dev: true
+
+ /events-to-async@2.0.1:
+ resolution: {integrity: sha512-RtnLYrMbXp4JkZIoZu+3VTqV21bNVBlJBZ4NmtwvMNqSE3qouhxv2gvLE4JJDaQc54ioPkrX74V6x+hp/hqjkQ==}
+ dev: false
/events@3.3.0:
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
@@ -8476,15 +8458,6 @@ packages:
cross-spawn: 7.0.3
signal-exit: 4.1.0
- /form-data@3.0.1:
- resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==}
- engines: {node: '>= 6'}
- dependencies:
- asynckit: 0.4.0
- combined-stream: 1.0.8
- mime-types: 2.1.35
- dev: false
-
/form-data@4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
engines: {node: '>= 6'}
@@ -9511,12 +9484,12 @@ packages:
engines: {node: '>=0.10.0'}
dev: false
- /isomorphic-ws@5.0.0(ws@8.14.2):
+ /isomorphic-ws@5.0.0(ws@8.15.1):
resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==}
peerDependencies:
ws: '*'
dependencies:
- ws: 8.14.2
+ ws: 8.15.1
dev: false
/jackspeak@2.2.1:
@@ -10015,19 +9988,16 @@ packages:
resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==}
dev: true
- /masto@5.11.3:
- resolution: {integrity: sha512-GtSnrqm5fHPaaU0iwag4LCmvpp82rDng6yOZinmOJHHlUfo6Gnq5QY6x3lJCxCnsPIXpTu1yaX42bWrSQyoQPA==}
+ /masto@6.5.2:
+ resolution: {integrity: sha512-JfnG7MSQmhszWnLsvdBuxXc2tcVUyCvlTxnSH/5S+In4dU1tvc1wGhFR87kO+YW8gfDsDw9CHh+AD/z+DbTTfQ==}
dependencies:
- '@mastojs/ponyfills': 1.0.4
change-case: 4.1.2
- eventemitter3: 5.0.1
- isomorphic-ws: 5.0.0(ws@8.14.2)
- qs: 6.11.2
- semver: 7.5.4
- ws: 8.14.2
+ events-to-async: 2.0.1
+ isomorphic-ws: 5.0.0(ws@8.15.1)
+ ts-custom-error: 3.3.1
+ ws: 8.15.1
transitivePeerDependencies:
- bufferutil
- - encoding
- utf-8-validate
dev: false
@@ -12310,13 +12280,6 @@ packages:
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
engines: {node: '>=6'}
- /qs@6.11.2:
- resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==}
- engines: {node: '>=0.6'}
- dependencies:
- side-channel: 1.0.4
- dev: false
-
/queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
@@ -13231,7 +13194,7 @@ packages:
hasBin: true
peerDependencies:
'@nuxt/kit': ^3.0.0
- '@nuxt/schema': 3.8.2
+ '@nuxt/schema': ^3.0.0
peerDependenciesMeta:
'@nuxt/kit':
optional: true
@@ -13681,6 +13644,11 @@ packages:
typescript: 5.1.6
dev: true
+ /ts-custom-error@3.3.1:
+ resolution: {integrity: sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==}
+ engines: {node: '>=14.0.0'}
+ dev: false
+
/tslib@1.14.1:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true
@@ -15354,6 +15322,19 @@ packages:
utf-8-validate:
optional: true
+ /ws@8.15.1:
+ resolution: {integrity: sha512-W5OZiCjXEmk0yZ66ZN82beM5Sz7l7coYxpRkzS+p9PP+ToQry8szKh+61eNktr7EA9DOwvFGhfC605jDHbP6QQ==}
+ engines: {node: '>=10.0.0'}
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: '>=5.0.2'
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ dev: false
+
/xml-name-validator@4.0.0:
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
engines: {node: '>=12'}
@@ -15453,18 +15434,18 @@ packages:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
dev: true
- github.com/tauri-apps/tauri-plugin-log/91dd3fe9dcaa69bae62706e75702a0ce18ce9885:
- resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-log/tar.gz/91dd3fe9dcaa69bae62706e75702a0ce18ce9885}
+ github.com/tauri-apps/tauri-plugin-log/19f5dcc0425e9127d2c591780e5047b83e77a7c2:
+ resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-log/tar.gz/19f5dcc0425e9127d2c591780e5047b83e77a7c2}
name: tauri-plugin-log-api
version: 0.0.0
dependencies:
- '@tauri-apps/api': 1.5.1
+ '@tauri-apps/api': 1.5.3
dev: false
- github.com/tauri-apps/tauri-plugin-store/3367248b2661abcb73d2a89f30df780c387fb57d:
- resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-store/tar.gz/3367248b2661abcb73d2a89f30df780c387fb57d}
+ github.com/tauri-apps/tauri-plugin-store/7d2632996f290b0f18cc5f8a2b2791046400690e:
+ resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-store/tar.gz/7d2632996f290b0f18cc5f8a2b2791046400690e}
name: tauri-plugin-store-api
version: 0.0.0
dependencies:
- '@tauri-apps/api': 1.5.1
+ '@tauri-apps/api': 1.5.3
dev: false
diff --git a/tests/setup.ts b/tests/setup.ts
new file mode 100644
index 00000000..ca2ef56d
--- /dev/null
+++ b/tests/setup.ts
@@ -0,0 +1,8 @@
+// We have TypeError: AbortSignal.timeout is not a function when running tests against masto.js v6
+if (!AbortSignal.timeout) {
+ AbortSignal.timeout = (ms) => {
+ const controller = new AbortController()
+ setTimeout(() => controller.abort(new DOMException('TimeoutError')), ms)
+ return controller.signal
+ }
+}
diff --git a/types/index.ts b/types/index.ts
index 70f26a56..e46811e3 100644
--- a/types/index.ts
+++ b/types/index.ts
@@ -47,7 +47,7 @@ export type TranslateFn = ReturnType['t']
export interface Draft {
editingStatus?: mastodon.v1.Status
initialText?: string
- params: MarkNonNullable>, 'status' | 'language' | 'sensitive' | 'spoilerText' | 'visibility'> & { poll: Mutable }
+ params: MarkNonNullable>, 'status' | 'language' | 'sensitive' | 'spoilerText' | 'visibility'> & { poll: Mutable }
attachments: mastodon.v1.MediaAttachment[]
lastUpdated: number
mentions?: string[]
diff --git a/vitest.config.ts b/vitest.config.ts
index a8c8cffa..8e99a03b 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -4,4 +4,9 @@ export default defineVitestConfig({
define: {
'process.test': 'true',
},
+ test: {
+ setupFiles: [
+ '/tests/setup.ts',
+ ],
+ },
})