diff --git a/src/boot/after_store.js b/src/boot/after_store.js index b0559ebc..ac3cf863 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -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(), diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 5bb6452e..7bcf1db5 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -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]) }