• Elvith Ma'for@feddit.org
    link
    fedilink
    arrow-up
    3
    ·
    3 months ago

    In short: Export your profile on the old instance as a file (in the Web UI in your settings IIRC) and import it on the same place on your new instance.

    Germany had a popular instance - feddit.de - that went downhill when the admin went on a vacation and seemingly never returned. The web UI was broken, but the API was still up. Many wanted to switch to another instance, but didn’t know how to transfer their joined communities.

    I made a small tool on GitHub Pages that allows you to export your account, settings, communities,… on one instance and uploads them to another instance. It also features a step that checks all your communities if there are local versions on the new instance and allows you to follow them optionally.

    I haven’t updated the code in ages, but it should still work in theory. The downside is, that it’s only in German…

    Code: https://github.com/elvith-de/lemmy-migration

    Tool hosted on GitHub Pages: https://elvith-de.github.io/lemmy-migration/

      • Elvith Ma'for@feddit.org
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        Well, the official way is manual - open your settings on the old instance and export them. Do the same in your account on your new instance and import them.

        One thing to note: you can only migrate your saved posts/comments/…, your followed communities, your settings and profile text and such. Your posts and comments themselves, the amount of up- and downvotes you received will stay on your old instance and you’ll start fresh on the new instance on this regard.

        Lemmy - as many websites - has two parts. The first is “the website” (or “webapp” or “frontend”) that runs in your browser and displays the content. But the heart is the second part in the background. That “the backend” (or API) where you can request data from Lemmy in a machine readable format and where you can send data (e.g. to create posts, comments,…).

        Since Lemmy allows you to use it with many different apps and alternative frontends, the backend allows you to query it from basically anywhere. For some features you need to be logged in, but any app can login on your behalf if it knows your password (and 2FA code if applicable).

        That’s what that little project does. You tell it your old and new instance, give it your credentials for each of them and it will automate the export and import of settings. And since the settings are in a machine readable format and it can use the search on the new instance, it can offer you to check what communities you follow and if there are some local communities on your new instance with the same name and allows you to follow them, too.

        The only thing to keep in mind is, that while the code is just a little bit of HTML, CSS and JS and could run directly from your local PC after a download, the way the Lemmy API works forces you to load the tool from

        a) a real domain name instead of just your filesystem and b) you need to load it with TLS encrypted (HTTPS)

        Both are solved by the GitHub Pages deployment, but no one is stopping you from putting it on your Webspace, Server, …

        That’s also the same way all the alternative user interfaces for Lemmy work - e.g. Tesseract which you could host on say tesseract.example.com while still accessing your instance.

        Example: My instance uses the default Lemmy user interface on https://feddit.org/ but I can also use Tesseract by visiting https://t.feddit.org/. Or you can use it with Photon: https://p.feddit.org/. Or Alexandrite: https://a.feddit.org/. Or Next: https://next.feddit.org/. Or…

          • Elvith Ma'for@feddit.org
            link
            fedilink
            arrow-up
            2
            ·
            2 months ago

            It’s main purpose was to help out, when the biggest German instance died. So naturally I choose German. I don’t know how easy it be to offer several languages, but I might translate it to English and test it, when I have time

              • Elvith Ma'for@feddit.org
                link
                fedilink
                arrow-up
                3
                ·
                2 months ago

                The downside is, that I’m no JS or frontend dev. So this was just “some scripting” without framework. The problem is not the translation itself, but that there’s no internationalisation support in the code.

                I know dogshit about JS frameworks, so it’s just a little state machine in vanilla JS duct taped with some hardcode HTML and some random material design CSS and a CSS class that allows me to set everything but the current step to invisible, lol.

                And since everything is there in one place, hardcoded in the HTML (just visible: none), it’s trivial to translate. But hard to offer several languages unless you duplicate the HTML.

                But… I’m currently moving several things from GitHub to Codeberg, so I might just do an English version there?

                • Flagstaff@programming.dev
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  2 months ago

                  Oh, okay, yeah, I had no idea of the architecture. And ditching GitHub is always a good move, for as long as it’s owned by its current owner! See you on Codeberg.

                  • Elvith Ma'for@feddit.org
                    link
                    fedilink
                    arrow-up
                    1
                    ·
                    2 months ago

                    HTML is simple, especially if you learned to program when XML was the latest shit. And for the CSS… That’s just the material design lite template.

                    The only CSS, that I made myself is this one here: https://github.com/elvith-de/lemmy-migration/blob/main/docs/css/custom.css

                    The first statement does all the heavy lifting for the state machine (read: make things invisible). The snack-bar statements are basically from a material design tutorial and community-icon is a stripped down version of how Lemmy renders community icons. The table statement were trial and error trying to get it right.

                    But CSS nowadays is way better than in the past. Especially if you compare it to its first days.