I am also ‘Andrew’, the admin of this server. I’ll try to remember to only use this account for posting stuff.

  • 0 Posts
  • 87 Comments
Joined 8 months ago
cake
Cake day: February 17th, 2025

help-circle

  • It’s straight-forward enough to do in back-end code, to just reject a query if parameters are missing, but I don’t think there’s a way to define a schema that then gets used to auto-generate the documentation and validate the requests. If the request isn’t validated, then the back-end never sees it.

    For something like https://freamon.github.io/piefed-api/#/Misc/get_api_alpha_search, the docs show that ‘q’ and ‘type_’ are required, and everything else is optional. The schema definition looks like:

    /api/alpha/search:
        get:
          parameters:
            - in: query
              name: q
              schema:
                type: string
              required: true
            - in: query
              name: type_
              schema:
                type: string
                enum:
                  - Communities
                  - Posts
                  - Users
                  - Url
              required: true
            - in: query
              name: limit
              schema:
                type: integer
              required: false
    

    required is a simple boolean for each individual field - you can say every field is required, or no fields are required, but I haven’t come across a way to say that at least one field is required.


  • PieFed has a similar API endpoint. It used to be scoped, but was changed at the request of app developers. It’s how people browse sites by ‘New Comments’, and - for a GET request - it’s not really possible to document and validate that an endpoint needs to have at least one of something (i.e. that none of ‘post_id’ or ‘user_id’ or ‘community_id’ or ‘user_id’ are individually required, but there needs to be one of them).

    It’s unlikely that these crawlers will discover PieFed’s API, but I guess it’s no surprise that they’ve moved on from basic HTML crawling to probing APIs. In the meantime, I’ve added some basic protection to the back-end for anonymous, unscoped requests to PieFed’s endpoint.



  • For this particular case, it’s more an instance of the software not interacting (in the sense of not changing things they don’t understand).

    If Lemmy doesn’t implement flairs, then community updates from them won’t over-write flairs set on PieFed’s copy of those comms. Also, when a PieFed user sends a comment to a Lemmy community, it will just attach an ‘Announce’ header to it and send it out to all followers. It would be against their own spec to change the content of anything they’re Announcing, so followers who receive the comment and happen to be on PieFed instances will interpret it fully, whereas Lemmy will just ignore any fields in the JSON that it doesn’t have a use for.





  • I’ll just remove the ‘freamon’ one when the auto-generated one is up to date.

    The manually-generated one had 5 missing routes, which I’ve since added.

    The auto-generated one at crust has about 48 missing routes. It’s the right approach, and I’ll help out with it when I can, but - for now at least - it makes no sense to redirect people to it (either automatically or via a comment).


    Some thoughts for @[email protected]

    /site/instance_chooser probably doesn’t need to be a route. It’s just the data format returned by /site/instance_chooser_search. As a route, it’s returning the instance info for the site you’re querying, so if you want to keep it as a route, it should probably be called /site/instance_info or something.

    In the query for /site/instance_chooser_search, nsfw and newbie are both booleans. With the rest of the API, these are sent as ‘true’ or ‘false’, but they are ‘yes’ and ‘no’ for this route. The newbie query should probably be newbie_friendly In the response, monthsmonitored should probably be months_monitored

    There’s no way to exclude communities for the response to /topic/list and /feed/list: If you don’t put ‘include_communities’ in the query, it’s defaults to True, but if you put ‘include_communities=false’ in the query it ends up being True also (because the word ‘include_communities’ is in the data).



  • I’ve no doubt that Lemmy’s particular auto-completion feature is very useful, but I still don’t think it’s what OP was referring to. The top-right frame says “I can find the exact unfederated remote comm” … the key word being ‘unfederated’.

    On a lemmy instance that’s already connected with something like ‘yepowertrippinbastards’, starting to type it in a comment will indeed fill out the rest. Image from lemmy.world:

    But if a lemmy instance hasn’t already connected with the community, it doesn’t have the info to autocomplete anything. Image from a dev Lemmy instance:

    This is in contrast to PieFed, which for one particular screen, can autocomplete community names based on info from lemmyverse rather than its own database, so it doesn’t need to have federated with anything yet.

    There’s pros and cons for each approach obvs, and I’m not super-invested in Lemmy vs. PieFed discussions right now, but I felt a strange urge to try to explain some week-old meme (and dick about with some new screen recording software). If you’re right and I’m wrong, then that’s okay too.




  • It’s a tricky problem.

    If a Lemmy or PieFed [edit: or NodeBB] user Mentions you, it’s because they’re paging you and want to bring a comment to your attention.

    If an MBIN or NodeBB Mastodon user Mentions you, it either because they’re paging you, or because they’re replying to a post or comment chain that you’re involved in (it’s been really noticeable when a NodeBB user has put my name in the post body as an explicit Mention, and then all the replies to the post from NodeBB / Mastodon / MBIN users have then also included it as an implicit Mention).

    The code for Mentions was written before the Notifications table was improved, so it’s feasible that it can now try to accommodate implicit Mentions, but it’ll never be perfect (because how does an MBIN user explicitly page another user that’s going to get implicitly Mentioned anyway?).

    It’s a bit like dealing with a emails from someone who always hits ‘Reply All’ - you’re always being CC’d in, and sometimes it’s relevant, and sometimes it’s not.

    Edited to fix misinfo about NodeBB.



  • I watched Jurassic World: Rebirth the other day (it’s alright). It’s such an odd franchise - one that seems to have lost faith in its own premise. There’s this meta assumption that audiences are bored with dinosaurs (I’m not), and that the solution to this imagined problem is to mutate them (it really isn’t, it’s invariably just silly).

    I also don’t care that dinos couldn’t really survive in the modern climate - that’s what the whole ‘suspension of disbelief’ thing is for.