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

Technology

37723 readers
61 users here now

A nice place to discuss rumors, happenings, innovations, and challenges in the technology sphere. We also welcome discussions on the intersections of technology and society. If it’s technological news or discussion of technology, it probably belongs here.

Remember the overriding ethos on Beehaw: Be(e) Nice. Each user you encounter here is a person, and should be treated with kindness (even if they’re wrong, or use a Linux distro you don’t like). Personal attacks will not be tolerated.

Subcommunities on Beehaw:


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

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
top 37 comments
sorted by: hot top controversial new old
[–] Nitrousoxide 21 points 1 year ago (2 children)

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.

[–] Evkob@lemmy.ca 1 points 1 year ago

I agree, but it's pretty easy to just add your instance to the script yourself with whatever extension you use for userscripts.

[–] wildeaboutoskar 1 points 1 year ago

Yeah this sounds like it would be easier to futureproof

[–] ndguardian@lemmy.studio 10 points 1 year ago (3 children)

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.ee 5 points 1 year ago (1 children)

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 3 points 1 year ago

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

[–] cornbread@lemm.ee 1 points 1 year ago* (last edited 1 year ago)

It’s a huge issue for mobile web and app users. Definitely something that should be written into any app that is being developed for Lemmy.

[–] IncidentalIncidence@feddit.de 1 points 1 year ago

Maybe some sort of universal Lemmy cookie that you can set from the preferences in your home instance and points to the home instance -- when any Lemmy instance loads, it reads the cookie and if you have one marked as your Home instance, it redirects to the home instance as long as it federates with the home instance. If the cookie isn't found or the instance doesn't federate with your home instance, it shows it normally.

[–] Waltzy@lemdit.com 9 points 1 year ago (1 children)

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

[–] Azzu@lemm.ee 38 points 1 year ago* (last edited 1 year ago) (5 children)

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.

[–] Wesleysnoops@reddthat.com 5 points 1 year ago (1 children)

This is super clever but I wonder how this can be incorporated into Lemmys base functionality

[–] ninjan@lemmy.mildgrim.com 3 points 1 year ago

Pretty ingenious, makes using Lemmy a lot smoother! Thanks for your hardwork!

[–] wildeaboutoskar 2 points 1 year ago

Thanks for dumbing it down for us. One of the things I like about the fediverse is that people are making these things more accessible to those of us out of the loop previously. I've learned so much here already

[–] Waltzy@lemdit.com 2 points 1 year ago

Ah right! I didn't realise that switching instances would invalidate your Auth! This sounds very useful. I'm with you that the platform should probably just handle this!

[–] SaltySalamander@lemmy.fmhy.ml 1 points 1 year ago

Yea this needs to actually be baked into base Lemmy.

[–] trachemys@iusearchlinux.fyi 7 points 1 year ago (2 children)

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.ee 4 points 1 year ago

I will update the lists of instances within the file and make sure that yours is in there :)

[–] Azzu@lemm.ee 2 points 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.

[–] Max_UL@lemmy.pro 4 points 1 year ago

Wow that sounds useful, nice one!

[–] miniu 3 points 1 year ago

Thanks! I literally thought that I need something like this on the last post I browsed, scrolled down and here it is!

I mostly browse Lemmy through RSS, and most of the links I use are from non-home instances.

[–] anonymoose@lemmy.ca 3 points 1 year ago

Very useful, thanks!

[–] scarecrw@lemmy.one 3 points 1 year ago

So glad you put this together! I threw together my own as a temporary fix, but I don't actually know javascript so I've been waiting to see if someone would share a proper version. Thanks for the hard work on this!

[–] Entheon 1 points 1 year ago

Looks handy, here's hoping some of the new mobile apps can implement something like this as well. I'm having problems clocking links currently in Liftoff. Don't mind searching too badly but would like to have it done automatically!

[–] InternetPirate@lemmy.fmhy.ml 1 points 1 year ago (1 children)

I had installed Fediverse redirector 0.1.2 by KaKi87 two days ago. Is this the same or is it better?

[–] Azzu@lemm.ee 1 points 1 year ago

I don't know, you tell me. You have used the Fediverse redirector :D

[–] BlueEther@no.lastname.nz 1 points 1 year ago (1 children)

another minor bug, I'll often get logged out if coming into my home instance from an external one

[–] Azzu@lemm.ee 1 points 1 year ago

My script has nothing to do with logging in or out of Lemmy itself. So if you actually get logged out of Lemmy itself, that is an issue to take up with your instance admins. Or do you mean that you get a message that you need to visit your home instance to update the authentication?

[–] TheHalc@sopuli.xyz 1 points 1 year ago

I was just asking about yesterday how to do this. I'll have to try this out, thanks!

[–] BlueEther@no.lastname.nz 1 points 1 year ago (1 children)

Thanks for the good work @Azzu@lemm.ee

One issue, I managed to do this:

[–] Azzu@lemm.ee 2 points 1 year ago* (last edited 1 year ago) (1 children)

Thanks for the report, yes, I actually noticed that already, sorry about that! I'm a bit busy today so I will probably only get around to fixing it tomorrow. I hope it is not too much of a bother until then, if it is, you can disable the feature completely by searching the script for HOME ? addShowAtHomeButton() : false and replacing that whole thing with false.

[–] BlueEther@no.lastname.nz 1 points 1 year ago (1 children)

a hard refresh will fix, so not too much of an issue

[–] Azzu@lemm.ee 1 points 1 year ago (1 children)

Hello again... could you please try to tell me how you managed to have this happen? I can't seem to be able to get it broken right now :D

[–] BlueEther@no.lastname.nz 1 points 1 year ago (1 children)

I went to an non-home instance => Communities => Change sorting order (New/Hot/Active)

It looks like something in the last 2 days may have fixed it as I cant reproduce today

[–] Azzu@lemm.ee 1 points 1 year ago (1 children)

Yeah no I actually reproduced it and forgot to tell you :D I fixed it afterwards earlier today.

[–] BlueEther@no.lastname.nz 1 points 1 year ago

No probs, I should have put in a how to reproduce in the first post

[–] wildeaboutoskar 1 points 1 year ago

This looks great! I am new at this kind of thing- is it compatible with Duck Duck Go browser? Or do I need to get Firefox for Android instead?

load more comments
view more: next ›