This is a first draft of support for backfilling and paginating timelines so that viewing tweetstootsposts skeets in Ivory is a more comfortable experience.
Requests to the home timeline with a min_id specified (and no max_id or since_id) are treated as "I want the latest posts", and it tries to fetch as many as possible and deliver them in one request, using the same logic that I wrote for BirdBridge (https://github.com/Treeki/BirdBridge/blob/main/main.ts#L129-L207).
I also generate a Link header to make Ivory happy - this gets rid of the issue where it's perpetually stuck in a loading state and won't allow you to manually refresh or show the amount of unread posts.
What's still missing:
Support for this same system on other timelines - it should work for custom timelines, for users' own timelines, and probably also for notifications
The ability to go back in time: it serves a rel="next" link with a max_id field which in theory should work, but Skybridge won't use it yet
Using the 'next' links is tricky because Bluesky requires cursors.
In theory you could ignore max_id and just supply the cursor as a non-standard parameter in the rel="next" link, but I haven't tested if this will work with Ivory.
I know that rel="prev" links definitely need to follow the standard format for Ivory to work correctly (as it will try to generate its own in certain cases, based off its newest known post ID) but I don't think they do the same for rel="prev". It's probably worth a try at least!
Tried this and it works, so that technique seems viable - I can now scroll further down in the timeline!
This is a first draft of support for backfilling and paginating timelines so that viewing
tweetstootspostsskeets in Ivory is a more comfortable experience.Requests to the home timeline with a
min_id
specified (and nomax_id
orsince_id
) are treated as "I want the latest posts", and it tries to fetch as many as possible and deliver them in one request, using the same logic that I wrote for BirdBridge (https://github.com/Treeki/BirdBridge/blob/main/main.ts#L129-L207).I also generate a Link header to make Ivory happy - this gets rid of the issue where it's perpetually stuck in a loading state and won't allow you to manually refresh or show the amount of unread posts.
What's still missing:
The ability to go back in time: it serves arel="next"
link with amax_id
field which in theory should work, but Skybridge won't use it yetUsing the 'next' links is tricky because Bluesky requires cursors.In theory you could ignoremax_id
and just supply the cursor as a non-standard parameter in therel="next"
link, but I haven't tested if this will work with Ivory.I know thatrel="prev"
links definitely need to follow the standard format for Ivory to work correctly (as it will try to generate its own in certain cases, based off its newest known post ID) but I don't think they do the same forrel="prev"
. It's probably worth a try at least!Tried this and it works, so that technique seems viable - I can now scroll further down in the timeline!