this post was submitted on 01 Jul 2023
57 points (100.0% liked)

Lemmy Plugins and Userscripts

2177 readers
1 users here now

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

Thanks!

founded 2 years ago
MODERATORS
 

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
you are viewing a single comment's thread
view the rest of the comments
[โ€“] FlagonOfMe@sh.itjust.works 3 points 2 years ago* (last edited 2 years ago) (1 children)

EDIT: Oh, it seems a server lookup is required because post URLs don't have the community name in them and post numbers are unique on each instance. I wonder why Lemmy was programmed that way.

Let's say we have this post in the Android community:

https://lemmy.world/post/863026

It could have been this or something similar:

https://lemmy.world/c/Android/863026

And then a copy on sh.itjust.works could have been:

sh.itjust.works/c/Android@lemmy.world/863026/

No lookup needed. Instead, the copy on sh.itjustworks is:

https://sh.itjust.works/post/604989

It's a different post number entirely, local to sh.itjust.works. Seems like a poor way to do the URL scheme. imo.

At any rate, my confusion comes from never noticing this before because I mostly use Jerboa with no URLs shown.


It's not clear exactly what this does. What is a "corresponding page" on your home instance?

If a link on the web points to otherlemmy.com/c/fun, what will it rewrite it to? mylemmy.com/c/fun@otherlemmy.com? That would be cool. Then I could comment and such. None of the screenshots actually show this, and none of the text explains what it actually does.

But that's can't be what it does because why would that require any communication to the Lemmy servers? All the information is in the URL itself combined with the knowledge of my home instance and a list of instances. So, I guess I need a better explanation.

[โ€“] Azzu@lemm.ee 2 points 2 years ago

It's only posts that it does that for. Community/user URLs are changed instantly because they need no communication.