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/technology@lemmy.ml, 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!

    • CynberOP
      link
      fedilink
      English
      211 months ago

      This would be a great change, and I’d much rather some of this be handled by the site!

      Although I don’t think this improvement would account for links to a community from outside Lemmy. People might arrive on a community from Google, a Reddit post, etc., and I don’t think there is a way to deal with that without an extension.

      In the meantime, I’ll keep working on a button next to internal links (like the kbin extension). Maybe it will help some users while this change is still being implemented. Else it will just be nice experience for me :)

  • ibk
    link
    fedilink
    English
    311 months ago

    Really cool, I’ll give it a try. Would it be possible to make it so that it automatically redirects you instead of having to manually switch?

  • CynberOP
    link
    fedilink
    English
    311 months ago

    I’m still working on finding relevant communities to post this in. I have some ideas for how to improve this extension further but getting some people trying it would help me narrow down other issues that I’ve missed.

    So if anyone knows of other relevant communities, then please do share! I’d like to share this around a bit without creating spam

  • @anteaters@feddit.de
    link
    fedilink
    English
    211 months ago

    This is great work. While the core devs are busy keeping lemmy from exploding and fixing bugs related to that it’s a good idea to improve usability with user scripts like this. I’m sure there are many of us who used RES before and miss those functions dearly. And Your button script is a great improvement for a very common issue even I encounter.

    A small improvement I’d like to suggest: detect if the lemmy instance is actually federated with my home instance (or one of them). Though I’m not sure how that can acutally be implemented but by manually adding my home instances to the addon so it can check the federated and blocked instances.

    Keep up the great work!

    • CynberOP
      link
      fedilink
      English
      211 months ago

      That would be cool, I’ll look into it. I think there’s an allowlist/blocklist for each instance but I’m not sure if there’s an easy way for me to access that info reliably. I’m going to play around with the 404 detection, so that might be another way to go about it.

      • @anteaters@feddit.de
        link
        fedilink
        English
        111 months ago

        It looks like every lemmy instance provides a list of connected and blocked instances under the same /instances url e.g. https://lemmy.ca/instances

        Though it might also be available via an API? Haven’t looked into that.

  • @Sleeping@programming.dev
    link
    fedilink
    English
    111 months ago

    I gave it a shot and while it is a really cool idea, sometimes it loads, and sometimes it doesn’t, and I have to refresh multiple times for it to appear.

    • CynberOP
      link
      fedilink
      English
      311 months ago

      Looks like that’s the first thing I’ll have to fix :)

      I think it has to do with how it detects that this is a Lemmy site, sometimes the extension loads faster than the page and it can’t confirm that this is a Lemmy site.

    • CynberOP
      link
      fedilink
      English
      111 months ago

      The reloading issue is one that I am working on, I think it has to do with when the contents of the sidebar load vs. when the extension runs. I’m planning to just include the button in the extension itself to get around that issue.

      The link is a little weird though. Did you set lemmy.world as your home instance in the extension? You wouldn’t need to change it afterwards, and you don’t need to enter the instance you are using (don’t enter lemmy.ca, it should work on any lemmy community/instance without you changing anything