So, I’ve rewritten the search / search boxes in Tesseract to skip the search and directly resolve activity pub URLs for users, posts, comments, and communities. I’m loving this as it makes things so much faster and easier.
To make that work, and reduce false positives/negatives, I have to do some pre-flight checks on the URL that’s submitted to the search.
Currently, it checks if the domain is to a known federated instance and looks for specific paths in the URL. If it detects the URL is an AP_ID URL, it will only resolve the object and redirect you to it (skipping the lengthy search step). For false negatives, it will pass it to the regular search but still try a federated lookup along with the search.
For Lemmy and Piefed, those are:
/u/for users/c/for communities/post/for posts/comment/for comments.
For Mbin, I think it’s the same except it uses /m/ for communities (they call them “magazines” I believe).
I think mastoon uses /user or maybe /username/ in the AP identifiers?
Any of you who are more familiar with Fediverse platforms that aren’t Lemmy/Piefed, can you let me know what the AP_IDs look like for users, posts, comments, and, if applicable, communities?
moseschrute@lemmy.world 6 months ago
I maintain my own Lemmy client (Blorp), and this sounds like a cool idea. How do you get your known list of federated instances?
I currently have my own threadiverse crawler I wrote, but I disgusted any Lemmy/PieFed instance with <20 monthly active users. That brings the list down to about 63 Lemmy instances and 7 PieFed. I wonder if that list is extensive enough to implement the resolve object mechanism you mentioned.
admiralpatrick@lemmy.world 6 months ago
At startup, it calls
/api/v3/federated_instancesand stores the result to a lookup variable. Then I’ve got a couple of helper functions that accept either an instance ID or a domain name which looks them up from the lookup variable.moseschrute@lemmy.world 6 months ago
Ahh that makes sense. I guess you couldn’t search anything your instance doesn’t federate with anyway.