cross-posted from: https://lemm.ee/post/530162

Please report issues with this version either here or at the issue tracker.

Changelog v1.2.0

  • Add rewrite support for posts/comments
  • Try to not rewrite federation links

Description

Lemmy Universal Link Switcher, or LULs for short, scans all links on all websites, and if any link points to a Lemmy instance that is not your main/home instance, it rewrites the link so that it instead points to your main instance. Currently only works for community/user links.

Also works on Firefox Android with the Tampermonkey extension!

Features

  • Rewrite links to Lemmy posts/comments to point to your home instance. Only after hovering over them, because getting home posts/comments links require communicating with the Lemmy servers, and we don’t want to spam the servers.

  • Instantly rewrite all links of communities or users to Lemmy/kbin on all websites everywhere to your new instance! The rewritten links will have an icon next to it, and hovering/touching the icon will show you the original link, allowing you to go there if you want to.

  • If you are already on a page that has a corresponding page on your home instance, a link will automatically be added to the page header.

Home Instance Setup

Simply visit the Lemmy instance you want to set as your home while the script is active. You will be asked if you want to set this instance to your home instance:

If you initially set your home instance wrong or just want to change it, no worries - simply go to your settings on your new home instance and press the button for it!

Coming soon

  • Rewrite kbin post/comment links
  • Better rewriting support for kbin community/user urls (e.g. sort options are currently ignored)
  • Nicer tooltip styling (fit into page theme)
  • Signify that “Show at home” button is loading for posts/comments
  • Nitrousoxide@beehaw.org
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Why are you trying to maintain an instance list? Just ask the user to input their instance URL. It will simplify the code and make it extensible to self-hosted instances and you don’t have to try to list every lemmy instance in existance.

  • Waltzy@lemdit.com
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Noob here! Why would you want to? This Is the first federated service I’ve used!

    • Azzu@lemm.eeOP
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 year ago

      You’re currently on lemdit.com and view the whole Lemmy fediverse from there. But I’m on lemm.ee. So let’s say I want to share you a cool thing I made, so I link you to a post I have saved on my end: https://lemm.ee/post/530506

      This link (https://lemm.ee/post/530506) is actually the link to this post right here, but viewed by me from my instance. If you click on it without this extension, you will leave lemdit.com and go to lemm.ee, and thus not be logged in anymore and also you can’t comment/save/anything that needs login anymore.

      So that’s where this script comes in. I post you the link https://lemm.ee/post/530506, and my script automatically changes that to https://lemdit.com/post/23135.

      So now even though we were on separate instances and I posted you a link to my instance, you can view it from your instance and immediately comment/save it/etc.

      This should be added to Lemmy itself, and it probably will eventually. But! What if you find a Lemmy link on DuckDuckGo/Google? Then you need something like a user script or browser addon, because Lemmy obviously can’t add code to DuckDuckGo/Google pages.

  • ndguardian@lemmy.studio
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I was just thinking that needs to become a feature. More technically minded folks could easily update the link on their own to plug into their Lemmy instance to subscribe, but for new users that could prove cumbersome.

    I wonder if the functionality could be brought directly into clients.

    • Azzu@lemm.eeOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      On native clients definitely, but this rewrites links on all websites everywhere. So idk, if you open an external link like a website article, it mostly opens in your browser. The client most often does not have control over your browser so can’t rewrite links. This script can and does.

      • ndguardian@lemmy.studio
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Ah, that’s a good point. I was thinking specifically within Lemmy apps, and not so much across the board.

  • trachemys@iusearchlinux.fyi
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    Your script is missing my instance @iusearchlinux.fyi. There are a couple dozen of us there. I can just edit the file of course.

    • Azzu@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Just updated the script and your instance is in it now. I will add a feature later to add your own instances easily though as well.