Clarify the note about not having seen a lot of real-world use.
Add a test that's a little less of a joke
Add a very basic, rudimentary test.
The Fediverse has a problem! If you create an account on one server, sometimes later you want to go to a different server. Maybe the one you started on is shutting down, maybe it's on a bunch of blocklists, maybe you just don't like the vibes. Whatever; you've got your reasons. They're valid.
Well, everyone says, that's fine; Mastodon implemented Move so you can go to a new server. But there's a catch; none of your post history will move with you! You get to keep your follow and follower lists, but all your great content is left behind.
Bummer!
NOTE: This probably has bugs! It hasn't seen a lot of real-world testing.
Well, assuming you're migrating from Mastodon to GotoSocial, and assuming you have access to the GotoSocial database, we can copy your posts over.
Well, OK, there is. This is not the same as moving your posts. All the other servers out there that know about your old posts will not magically discover that they have a new home. Plus your new posts can't magically replace old posts in existing threads scattered all over the 'verse. Viewing old post permalinks will not redirect you to the new ones either. Sorry about that.
Well, there's other stuff I just haven't gotten around to yet but could in theory once I get a chance to figure it out:
The only replies that will be copied are replies to your own account.
Let's assume you've already set up the new account and done the migration.
First download your Mastodon archive. Unzip it and you'll find a
file called outbox.json
inside. That's the good stuff.
Next, install Lua, (it's almost certainly in your package manager; any version should work but 5.4 is maybe best?) then point the script at the outbox file, your base instance URL, and the username:
$ lua fennel --convert mgs.fnl outbox.json https://my.instance.org myaccount
That will give you a bunch of SQL to create the posts! Give it a look over and make sure it actually makes sense. Don't just trust me! Look around; I mean, you may have noticed this repository's tests are pretty rudimentary.
If you think it looks good, you can run the SQL by piping it to sqlite
:
$ lua fennel --convert mgs.fnl outbox.json https://my.instance.org myaccount | sqlite3 sqlite.db
It's the same command as before, but sending the output to the database.
That should do the trick???
[This is where I would put in a clever reference but I've only played like the first five minutes of Metal Gear Solid and all I remember is there's ... a radio? and also there's the guy from Escape to New York?]
Oh no! You found a bug in the script? Yeah, that's not too surprising; I expect there are many. That's OK! You can get rid of all the posts created by the script:
$ lua fennel --delete mgs.fnl outbox.json | sqlite3 sqlite.db
Again you might want to run it without the pipe first to peek at the SQL before sending it straight to the DB, but this should reverse all the previous changes and get you back to where you started.
Copyright © 2024 Phil Hagelberg and contributors Released under the MIT/X11 license.