Fix federated feed only showing remote posts

There's a mismatch parameter between Mastodon's and Pixelfed's APIs
This commit is contained in:
Lim Chee Aun 2024-06-05 18:23:09 +08:00
parent dea3507053
commit 1c01e1b0f4
2 changed files with 9 additions and 4 deletions

View file

@ -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;

View file

@ -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 = {};