refactor: upgrade masto 5 (#867)
This commit is contained in:
parent
39034c5777
commit
5c8f75b9b7
108 changed files with 438 additions and 445 deletions
|
@ -20,7 +20,7 @@ const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
|||
const masto = useMasto()
|
||||
const { data: context, pending: pendingContext, refresh: refreshContext } = useAsyncData(
|
||||
`context:${id}`,
|
||||
async () => masto.statuses.fetchContext(id),
|
||||
async () => masto.v1.statuses.fetchContext(id),
|
||||
{ watch: [isMastoInitialised], immediate: isMastoInitialised.value },
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const handle = $(computedEager(() => params.account as string))
|
|||
definePageMeta({ name: 'account-followers' })
|
||||
|
||||
const account = await fetchAccountByHandle(handle)
|
||||
const paginator = account ? useMasto().accounts.iterateFollowers(account.id, {}) : null
|
||||
const paginator = account ? useMasto().v1.accounts.listFollowers(account.id, {}) : null
|
||||
|
||||
if (account) {
|
||||
useHeadFixed({
|
||||
|
|
|
@ -6,7 +6,7 @@ const handle = $(computedEager(() => params.account as string))
|
|||
definePageMeta({ name: 'account-following' })
|
||||
|
||||
const account = await fetchAccountByHandle(handle)
|
||||
const paginator = account ? useMasto().accounts.iterateFollowing(account.id, {}) : null
|
||||
const paginator = account ? useMasto().v1.accounts.listFollowing(account.id, {}) : null
|
||||
|
||||
if (account) {
|
||||
useHeadFixed({
|
||||
|
|
|
@ -8,7 +8,7 @@ const { t } = useI18n()
|
|||
|
||||
const account = await fetchAccountByHandle(handle)
|
||||
|
||||
const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: true })
|
||||
const paginator = useMasto().v1.accounts.listStatuses(account.id, { excludeReplies: true })
|
||||
|
||||
if (account) {
|
||||
useHeadFixed({
|
||||
|
|
|
@ -7,7 +7,7 @@ const handle = $(computedEager(() => params.account as string))
|
|||
|
||||
const account = await fetchAccountByHandle(handle)
|
||||
|
||||
const paginator = useMasto().accounts.iterateStatuses(account.id, { onlyMedia: true, excludeReplies: false })
|
||||
const paginator = useMasto().v1.accounts.listStatuses(account.id, { onlyMedia: true, excludeReplies: false })
|
||||
|
||||
if (account) {
|
||||
useHeadFixed({
|
||||
|
|
|
@ -7,7 +7,7 @@ const handle = $(computedEager(() => params.account as string))
|
|||
|
||||
const account = await fetchAccountByHandle(handle)
|
||||
|
||||
const paginator = useMasto().accounts.iterateStatuses(account.id, { excludeReplies: false })
|
||||
const paginator = useMasto().v1.accounts.listStatuses(account.id, { excludeReplies: false })
|
||||
|
||||
if (account) {
|
||||
useHeadFixed({
|
||||
|
|
|
@ -3,7 +3,7 @@ import { STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS } from '~~/constants'
|
|||
|
||||
const { t } = useI18n()
|
||||
|
||||
const paginator = useMasto().trends.iterateStatuses()
|
||||
const paginator = useMasto().v1.trends.listStatuses()
|
||||
|
||||
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS } from '~~/constants'
|
|||
|
||||
const { t } = useI18n()
|
||||
|
||||
const paginator = useMasto().trends.links
|
||||
const paginator = useMasto().v1.trends.listLinks()
|
||||
|
||||
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const { t } = useI18n()
|
|||
|
||||
const masto = useMasto()
|
||||
const { data, pending, error } = useLazyAsyncData(
|
||||
() => masto.trends.fetchTags({ limit: 20 }),
|
||||
async () => masto.v1.trends.listTags({ limit: 20 }),
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const { t } = useI18n()
|
|||
// limit: 20 is the default configuration of the official client
|
||||
const masto = useMasto()
|
||||
const { data, pending, error } = useLazyAsyncData(
|
||||
() => masto.suggestions.fetchAll({ limit: 20 }),
|
||||
async () => masto.v2.suggestions.list({ limit: 20 }),
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ const params = useRoute().params
|
|||
const tagName = $(computedEager(() => params.tag as string))
|
||||
|
||||
const masto = useMasto()
|
||||
const { data: tag, refresh } = $(await useAsyncData(() => masto.tags.fetch(tagName), { watch: [isMastoInitialised], immediate: isMastoInitialised.value }))
|
||||
const { data: tag, refresh } = $(await useAsyncData(() => masto.v1.tags.fetch(tagName), { watch: [isMastoInitialised], immediate: isMastoInitialised.value }))
|
||||
|
||||
const paginator = masto.timelines.iterateHashtag(tagName)
|
||||
const stream = masto.stream.streamTagTimeline(tagName)
|
||||
const paginator = masto.v1.timelines.listHashtag(tagName)
|
||||
const stream = masto.v1.stream.streamTagTimeline(tagName)
|
||||
onBeforeUnmount(() => stream.then(s => s.disconnect()))
|
||||
|
||||
if (tag) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import type { StatusVisibility } from 'masto'
|
||||
import type { mastodon } from 'masto'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
@ -10,7 +10,7 @@ onMounted(async () => {
|
|||
status: route.query.text as string,
|
||||
sensitive: route.query.sensitive === 'true' || route.query.sensitive === null,
|
||||
spoilerText: route.query.spoiler_text as string,
|
||||
visibility: route.query.visibility as StatusVisibility,
|
||||
visibility: route.query.visibility as mastodon.v1.StatusVisibility,
|
||||
language: route.query.language as string,
|
||||
}), true)
|
||||
// TODO: need a better idea 👀
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts" setup>
|
||||
import type { UpdateCredentialsParams } from 'masto'
|
||||
import type { mastodon } from 'masto'
|
||||
import { useForm } from 'slimeform'
|
||||
import { parse } from 'ultrahtml'
|
||||
|
||||
|
@ -63,7 +63,7 @@ const { submit, submitting } = submitter(async ({ dirtyFields }) => {
|
|||
if (!isCanSubmit.value)
|
||||
return
|
||||
|
||||
const res = await useMasto().accounts.updateCredentials(dirtyFields.value as UpdateCredentialsParams)
|
||||
const res = await useMasto().v1.accounts.updateCredentials(dirtyFields.value as mastodon.v1.UpdateCredentialsParams)
|
||||
.then(account => ({ account }))
|
||||
.catch((error: Error) => ({ error }))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue