From 1c01e1b0f40637fbe806cdd115e8a28a407b7396 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 5 Jun 2024 18:23:09 +0800 Subject: [PATCH] Fix federated feed only showing remote posts There's a mismatch parameter between Mastodon's and Pixelfed's APIs --- src/pages/public.jsx | 12 ++++++++---- src/utils/supports.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages/public.jsx b/src/pages/public.jsx index 7b90f37f..c1d49216 100644 --- a/src/pages/public.jsx +++ b/src/pages/public.jsx @@ -10,6 +10,7 @@ import { api } from '../utils/api'; import { filteredItems } from '../utils/filters'; import states from '../utils/states'; import { saveStatus } from '../utils/states'; +import supports from '../utils/supports'; import useTitle from '../utils/useTitle'; const LIMIT = 20; @@ -30,11 +31,14 @@ function Public({ local, columnMode, ...props }) { const publicIterator = useRef(); async function fetchPublic(firstLoad) { if (firstLoad || !publicIterator.current) { - publicIterator.current = masto.v1.timelines.public.list({ + const opts = { limit: LIMIT, - local: isLocal, - remote: !isLocal, // Pixelfed - }); + local: isLocal || undefined, + }; + if (!isLocal && supports('@pixelfed/global-feed')) { + opts.remote = true; + } + publicIterator.current = masto.v1.timelines.public.list(opts); } const results = await publicIterator.current.next(); let { value } = results; diff --git a/src/utils/supports.js b/src/utils/supports.js index 95d613c1..adfd1e35 100644 --- a/src/utils/supports.js +++ b/src/utils/supports.js @@ -19,6 +19,7 @@ const platformFeatures = { '@mastodon/profile-private-note': notContainPixelfed, '@pixelfed/trending': containPixelfed, '@pixelfed/home-include-reblogs': containPixelfed, + '@pixelfed/global-feed': containPixelfed, }; const supportsCache = {};