cross-posted from: https://lemmy.ca/post/778315

Introducing the Lemmy Instance Assistant (browser extension)


Hey everyone :)

I started using Lemmy during the blackout, and I was finding it annoying to subscribe to new communities that I came across. I wanted to be able to quickly open a link on my home instance instead of copy/pasting the code, searching for it, and then subscribing. I looked around for an extension and didn’t see any * , so I started working on my first browser extension!

Firefox version is live, the Chrome version is still going through the review/approval stage. I’m working on getting it on other browsers as well.

https://addons.mozilla.org/addon/lemmy-instance-assistant

This extension will let you set your home instance (https://lemmy.ca for me), and then it will insert a button onto community pages on other Lemmy instances (see screenshots on extension page). I tried to mimic the existing design for the button, and I included some popular instances so you can quickly copy and paste when selecting your home instance.

Give it a try and let me know what you think!

Why doesn’t it redirect automatically?

Initially I tried to make it redirect, similar to ‘Old Reddit Redirect’. This is still possible, but it might be a little dangerous to have it set up that way. Since there is no way to predict what URL a Lemmy site will have, we can’t restrict the extension to specific domains. This means that the extension MAY run on other sites, depending on how it is detecting the Lemmy site. A button popping up is less harmful than being redirected unexpectedly.

Future plans:

GitHub link: https://github.com/cynber/lemmy-instance-assistant

  • As mentioned above, we can’t specify which domains the extension should run on since that’s not something we can predict. I’d like to improve the specificity of which pages the button will appear on, to minimize unexpected behaviour. As this is my first extension, I’d appreciate help with this while I learn it myself!
  • Right now the button does not appear if you are already viewing a community in a different instance, even if that is not YOUR instance (ex. You are looking at lemmy.world/c/[email protected], while your home instance is lemmy.ca). This limitation comes from the method I used to distinguish between the community page and your home instance page. I’m planning to change it to use the URL itself instead of card elements.
  • It would be nice to be able to jump to a specific post. Currently, it appears that Lemmy post URLs do not include a slug for the community/instance, making it challenging to implement something like this. I plan on exploring this some more (relevant thread: https://github.com/LemmyNet/lemmy/issues/875)
  • I want to add a button next to other Lemmy links in the post body / comments. However, I’m still trying to figure out the best way to do this and which links it should appear next to.

Other thoughts:

Some of the third party Reddit tools that I used the most were the browser extensions. Reddit Enhancement Suite made it a LOT easier to start using Reddit, and other extensions like Old Reddit Redirect (the inspiration for my extension) fixed other annoyances. While there are a lot of areas where Lemmy can improve, I think it makes more sense to implement certain enhancements through browser extensions and separate tools. That is to say, I’m happy to let this be pushed into Lemmy’s code, but right now I feel like it makes more sense as a separate extension.

(*) Also when I started building my extension, I didn’t see any similar ones listed. A few other ones have now popped up, and it looks like a lot of them were forked from this project. So if you don’t like mine, there are others that you can try :) Similarly, I’m happy to collaborate if you want to help / integrate my extension into a bigger project!

  • wccrawford@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I had found another extension, but when I enabled it for all sites, it make my browser slower, so I removed it again. It also sometimes failed to detect the community link. I ended up using a bookmarklet instead. That way, it doesn’t have to parse the page, and it can never fail to parse the page… It just rewrites the URL.

    • CynberOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      I was using a bookmarklet at first too!

      Maybe I’ll add that as an option, along with sticking the redirect button in the extension itself.

      If you try this one, please let me know if there are similar performance issues. I made mine from scratch instead of forking the other project, so it might not. It also might have different issues entirely.

  • cecilkorik
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I was literally about to ask if there was something like this! And if there wasn’t I was going to try banging my own head against some code in the hopes something resembling an addon might come out.

    Thanks for saving me the head injury! I’ll try it out and let you know if I encounter any issues or have any other feedback.

    • cecilkorik
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      So far it’s working great. Only issue I’ve run into is that if the community you want to look at isn’t loaded yet on Lemmy.ca it gets a 404 (and no amount of waiting or reloading seems to make it work), in that case you have to manually search the community first, and then it loads instantly. Unfortunate, and this seems more like an issue with Lemmy than with the addon, so hopefully that gets fixed eventually because that will make cross-instance browsing almost entirely seamless. It’s already a huge step in the right direction though, thanks so much!

      • CynberOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        thanks!

        Someone mentioned potentially detecting the 404 and redirecting to the search page with a little message. I’m going to see what I can do, I might just add a button in the extension popup to take you to the search page if I can’t figure out the 404 detection

    • CynberOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      thank you! Let me know if there are any issues / annoyances that you uncover and I’ll try to fix them. I’ve got a list of things people have mentioned wanting to try :)