Make bubble timeline work

This commit is contained in:
Essem 2025-03-04 23:37:15 -06:00 committed by Ruben
commit 9ceb3f3e78
Signed by: sneexy
GPG key ID: 8ECFA045E63BC583
2 changed files with 28 additions and 2 deletions

View file

@ -267,6 +267,29 @@ const getStickers = async ({ store }) => {
}
}
const getBubbleDomains = async ({ store }) => {
try {
if (store.state.users.currentUser) {
const res = await window.fetch('/api/v1/instance/bubble_domains', {
headers: {
"Authorization": `Bearer ${store.state.users.currentUser.credentials}`
}
})
if (res.ok) {
const data = await res.json()
store.dispatch('setInstanceOption', { name: 'localBubbleInstances', value: data })
} else {
throw (res)
}
} else {
store.dispatch('setInstanceOption', { name: 'localBubbleInstances', value: [] })
}
} catch (e) {
console.warn('Could not load bubble domains')
console.warn(e)
}
}
const getAppSecret = async ({ store }) => {
const { state, commit } = store
const { oauth, instance } = state
@ -409,6 +432,7 @@ const afterStoreSetup = async ({ store, i18n }) => {
// Start fetching things that don't need to block the UI
getTOS({ store })
getStickers({ store })
getBubbleDomains({store})
const router = createRouter({
history: createWebHistory(),

View file

@ -53,7 +53,6 @@ const MASTODON_DENY_USER_URL = id => `/api/v1/follow_requests/${id}/reject`
const MASTODON_DIRECT_MESSAGES_TIMELINE_URL = '/api/v1/timelines/direct'
const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
const AKKOMA_BUBBLE_TIMELINE_URL = '/api/v1/timelines/bubble'
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
const MASTODON_STATUS_SOURCE_URL = id => `/api/v1/statuses/${id}/source`
@ -700,7 +699,7 @@ const fetchTimeline = ({
}) => {
const timelineUrls = {
public: MASTODON_PUBLIC_TIMELINE,
bubble: AKKOMA_BUBBLE_TIMELINE_URL,
bubble: MASTODON_PUBLIC_TIMELINE,
friends: MASTODON_USER_HOME_TIMELINE_URL,
dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL,
notifications: MASTODON_USER_NOTIFICATIONS_URL,
@ -751,6 +750,9 @@ const fetchTimeline = ({
if (timeline === 'public') {
params.push(['local', true])
}
if (timeline === 'bubble') {
params.push(['bubble', true])
}
if (timeline === 'public' || timeline === 'publicAndExternal') {
params.push(['only_media', false])
}