Fediseer / FediseerGUI

GUI for fediseer.com
MIT License
13 stars 7 forks source link

Mastodon Synchronization does not seem to use pagination #122

Closed cultpony closed 1 year ago

cultpony commented 1 year ago

When I got to the sync page to bring the censures into my Mastodon instance, it seems only the first page of blocks is processed, meaning that most blocks aren't even shown as missing on Fediseer and that Fediseer is unable to see the blocks it creates.

In the network panel it also seems like a single request is made, which ends up only returning the first results.

RikudouSage commented 1 year ago

Ah, I didn't know there was pagination. Will look into it!

cultpony commented 1 year ago

If it helps, Mastodon does try to help by returning a Link header; it contains the list of URLs to call like this;

Link: <https://mastodon.instance/api/v1/admin/domain_blocks?max_id=210>; rel="next", <https://mastodon.instance/api/v1/admin/domain_blocks?max_id=310>; rel="prev"

Without parameters, rel=prev can be ignored, so simply recursing down the URL provided via rel=next should eventually yield an empty response (aka no more content) with Link now no longer containing a rel=next URL, only a rel=prev.

Link: <https://mastodon.instance/api/v1/admin/domain_blocks?max_id=100>; rel="prev"

If the response contains no Link header, there is no pagination needed.