Is there an easy way to open a Lemmy link from another instance?

I have an account on one server, but often browser from 9 other servers. Sometimes, I find a community I would like to follow. Is there an easy way to open that community from a different instance/server? I find searching for that community on my main server works, but is clumsy.

  • Andy@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    3 years ago

    I’m using the Firefox addon Redirector, and one of my rules there redirects community links using regex. I keep adding to the pattern as I encounter more instances. Currently it’s:

    Pattern: https://(lemdro\.id|lemmy\.run|beehaw\.org|lemmy\.ml|sh\.itjust\.works|lemmy\.fmhy\.ml|lemmy\.dbzer0\.com|lemmy\.world|sopuli\.xyz|lemmy\.kde\.social|lemmygrad\.ml|mander\.xyz|lemmy\.ca|zerobytes\.monster)/c/(.*)
    
    Redirect to: https://programming.dev/c/$2@$1
    
  • BeanCounter@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 years ago

    I have an account on one server, but often browser from 9 other servers.

    Do you literally open 9 tabs for each instances? If that’s the case, that’s kinda weird. You don’t have to. That’s the whole point of Lemmy.

    Link for a community in lemmy should be something like this: [Link Text](/c/communityName@instance.host). If you click that in whatever instance you’re in, you should be able to access the community in that instance.

    However, quite a lot of people just don’t care and copy/paste link for the community which is (understandable, but,) quite irritating. So after I read this post I just wrote this hacky Tampermonkey script to fix those links.

    // ==UserScript==
    // @name         Fix community link
    // @version      0.1
    // @match        https://[YOUR INSTANCE HERE]/post/*
    // @run-at       document-end
    // ==/UserScript==
    
    (function() {
        'use strict';
        const postLinks = document.getElementById("postContent").querySelectorAll("a:not(.community-link)");
        const comments = document.getElementsByClassName("comment-content");
    
        for (let aTag of postLinks) {
            const isCommunityLink = aTag.pathname.startsWith("/c/");
            aTag.href = isCommunityLink?aTag.pathname + "@" + aTag.host:aTag.href;
        };
        for (let comment of comments) {
            let commentLinks = comment.querySelectorAll("a:not(.community-link)");
            for (let aTag of commentLinks) {
                const isCommunityLink = aTag.pathname.startsWith("/c/");
                aTag.href = isCommunityLink?aTag.pathname + "@" + aTag.host:aTag.href;
            };
        };
    })();
    

    It’s very far from being pretty (I especially hate how isCommunityLink works) so let me know if there’s a better way I can do this!

  • Cynber@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    We actually have an extension for this, it’s one of the more popular extensions for Lemmy&Kbin, going by the counts on chrome/firefox stores:

    !instance_assistant@lemmy.ca

    It was originally made to solve this problem, but we’ve been adding other features as well. Right now you can redirect communities and posts, and redirect links by right clicking on them.

    Let me know if it works, and also where it doesn’t so that we can improve it :)