feat: local and federated timelines

This commit is contained in:
mae taylor 2025-07-15 15:08:37 +01:00
parent 7db5ec7fae
commit c51a0b1e5d
Signed by: mae
GPG key ID: 3C80D76BA7A3B9BD
3 changed files with 64 additions and 11 deletions

View file

@ -243,11 +243,13 @@ export async function rejectFollowRequest(host, token, account_id) {
* @param {string} timeline - The name of the timeline to pull (default "home").
* @param {string} max_id - If provided, only shows posts after this ID.
*/
export async function getTimeline(host, token, timeline, max_id) {
export async function getTimeline(host, token, timeline, max_id, local_only, remote_only) {
let url = `https://${host}/api/v1/timelines/${timeline || "home"}`;
let params = new URLSearchParams();
if (max_id) params.append("max_id", max_id);
if (remote_only) params.append("remote", remote_only);
if (local_only) params.append("local", local_only);
const params_string = params.toString();
if (params_string) url += '?' + params_string;

View file

@ -11,7 +11,7 @@ const lang = Lang();
let loading = false;
export async function getTimeline(clean) {
export async function getTimeline(timelineType = "home", clean, localOnly = false, remoteOnly = false) {
if (loading) return; // no spamming!!
loading = true;
@ -22,9 +22,11 @@ export async function getTimeline(clean) {
const timeline_data = await api.getTimeline(
get(server).host,
get(app).token,
"home",
last_post
);
timelineType,
last_post,
localOnly,
remoteOnly
);
if (!timeline_data) {
console.error(lang.string('logs.timeline_fetch_failed'));