Posty for Pixelfed: What Fresh Hell...
The Oliphant @oliphant@writer.oliphant.social
Years ago, I had a job: to build a centralized SaaS (software-as-a-service) app that would replace the one-off copy-and-paste sites we used for our customers, kind of like a WordPress install, but with an Access database instead. đ± Unfortunately, the SaaS app failed. Ultimately, they decided they preferred the way they'd been doing itâwith all the copy and paste and Access databases included. But the SaaS app succeeded in one critical way, it turns out, as I insisted we needed to build an export tool. We needed to free the customer's data in such a way that they could take it with them if they wanted, or use it to handle their own in-house reporting. So let's say I know a thing or two about building an export. These exports I built put stuff into a downloadable Sqlite database. And when my boss insisted on it.... I made MS Access an available option, too. Years after I left the company, a former coworker there told me that the export I built was the single most important thing I did, because it allowed them to seamlessly move customers off the platform and migrate data, using a common data structure, into the one-off sites they'd been building before I got there.
Sure, the project had failed, but I'd already created the means to let people take their data with them, so it wasn't a painful migration to a new system. We didn't hold their data over their head. We didn't give them a useless data export, either. There wasn't any data that was missing. They had it all, and could leave us at any time with their data in hand. It felt like giving ourselves a vote of confidence: we're so sure you'll like the app that we'll make it easy for you to leave at any time with the most important partâyour dataâintact.
You probably wonder why I'm bringing this up, but I guess lately I've been becoming aware of the state of data exports across the fediverse, and I've gotta say... there are issues.
But first, a pat on the headBefore I get into the issues, let's talk about who does it right.
WriteFreely. They do it right. You can export all your entire blog and then import that same file into another WriteFreely instance.
Imagine that.
So I wonder why we can't do it in other systems?
I won't belabor the point, but this is the right way to build a data export: consuming your own dogfood via an import tool that will immediately identify any issues or missing data or structure you might have forgotten to include in the export itself.
Most important in creating an export is this: You can't do anything with data you don't have. If it's not in the export, it might as well not exist... because it doesn't. And if you create an export that is never used by anyone, or is itself less useful because it doesn't contain the data you need, you'll likely never know if you got it right. People will download useless (or less useful) exports, unaware of how wrong it is, because they have no way to consume it. More on that when I get to Pixelfed.
The definition of a good export or archiveTo review, a proper export must be at least three things:
- Exports all relevant data. An export is basically a backup. Broken or missing relationships, incomplete or missing data, these make an export significantly less useful and constitute a rather shitty backup.
- Completely offline. An export should be a standalone thing. You shouldn't ever require the internet to reconstruct missing data since you might not be aware of this, but the internet is a transient place and what's here today is gone tomorrow, and that shit is more or less by design. If you don't have all the assets and data in the export itself, you don't have an export. You have... a ledger, maybe? A referential index or directory of data which itself points to other resources, but by nature that means it becomes increasingly less useful over time and eventually may be completely useless because you can't reconstruct that data at all once the sources are offline.
- Designed with import in mind. If you export data, you should consider how it will be imported. This does not require you to build an importer, per se, (although ideally you should) but you should at least consider how someone might import it, if the data is useful enough as is that it makes such a thing feasible.
Let's start with Mastodon, which might as well be the gold standard. My main beef with Mastodon's export was simply that they built only the export, and relied on others to build the import tool for it. Find the github project you like, and use that. So we have numerous archive viewers, even static site generators for it that came along before Posty even existed.
But we had to do that. Mastodon didn't bother building an importer. And I realize it's a hard problem to solve, backfilling old ActivityPub posts without sending out a barrage of notifications and uploading all that data could be a security issue on a Mastodon server, or a storage concern, but what if it's YOUR server? Shouldn't you be able to do that?
It doesn't do someone much good to have a 'locked box' of data, expecting someone to Google to figure out what the hell they can do with it. Even now, I'm sure three years from now someone will be like, âWhat? Posty exists? Why didn't someone tell me!â despite my attempts to promote it. Because the ability to import, and links to how to do something with your data export, aren't located anywhere in Mastodon. It's not contextual.
But you know what? For all my whining, at least all the data is there. If you want the profile data, bookmarks, likes, header image, avatar, bio, all your bio links, which instance you may have moved to, aliases, all your posts, all your images for your posts, all the videos and audio, all of itâ
You get everything. You get the reply structure, so anyone who does it correctly can reconstruct a thread from the data provided.
I didn't appreciate the completeness of the data properly at the time.
Then, I checked out the Pixelfed export.
The Pixelfed export filesQuite frankly, the Pixelfed export seems to have been created without any intention that someone would ever actually use it to import data into a new system. I'm not really sure how anyone is supposed to use it. I'm not even sure if there are any Pixelfed archive viewers or migration tools that use these exports, but they are going to have to be live viewers that require the old instance to still be running to work properly, because of the way it was implemented.
I don't mean to be harsh, this isn't a dig for the sake of it, it's just stating a few facts about the issues with the export that will be easier for me to reference here than to constantly explain elsewhere.
Let's break down some of these issues:
- The export itself is technically multiple files. You don't download a zip file like you do with Mastodon. You download individual
.jsonfiles for your account, outbox, likes, bookmarks, etc, but for the purpose of Posty we only need the account.json and the outbox.json. The main issue here is that users might just download a single file, the outbox, probably, and think they have all their data in that one file. But if you want your profile or your avatar or 'moved to' details, you need the account.json, too. - Unfortunately, because of this, there is literally NO image data contained in your export. Unless you consider âimage dataâ to be âa URL to where your assets are currently hosted.â I don't. Consider point number two above: Completely offline. If your data export is full of URLs to images instead of image data itself, your export/archive requires internet access to work properly to reconstruct your missing data. This means, if you export that outbox.json thinking all your posts are in it, you're half-right. Your posts are there, but none of your assets areâonly links to them. That means if your old Pixelfed instance goes down, you just lost all your images and your archive is basically useless. The one advantage of this kind of an export is that the files are very, very small. A fraction of the size of a Mastodon export, but that's because Mastodon actually gives you all your data, including your images.
- One reason I'm pretty sure no one has ever tried to actually do anything with a Pixelfed archive is this issue. Beyond the age of the issue itself and the lack of any real progress,
no one seems to have noticed that the reply structure is not retained. This means all your replies look like top-level posts, becauseNote: Fixed the reply issue and 500 post limitation in the latest (Jan 5) export format.inReplyTois not populated. (I did add a comment about that, along with creating a bug report for it.) - Hashtag collections aren't populated the same as Mastodon. In a Mastodon export, it includes a hashtag collection for each post, which I use to create the hashtag index pages (example: https://posty.1sland.social/archive/kaleb@social.coop/tags.html). Still, I think I may be able to eventually work around this. I hesitate to blame Pixelfed here: I'm not sure if this is truly a Pixelfed issue, or something that Mastodon implements differently on its own.
- Since they aren't included, I have to download the images, but you can't programmatically download all the images, sometimes, depending on object storage configuration or other âmystery settingsâ on the Pixelfed server, that block some asset downloads but not others, which forced me to build a manual download page for any of these missing assets.
It seems, perhaps, the export only includes a max of 500 posts??? More missing data, it seems.(Note: This is now fixed in the newer Pixelfed export format)
By far the biggest issue (beyond the 'inReplyTo' bug, which is just broken) is the missing imagesâtied with the arbitrary limit of 500 posts in the export.
It is this, more than any other thing, that offends me.
People are expecting an export. Of all their data. They aren't all going to be savvy enough to drag that .json file into a web browser and examine the structure and notice that's missing. But if they did, they'd quickly realize they don't have dataUrls for the images (that could have worked!) but instead URIs to the image itself, pointing to a server that may no longer exist!
Really, the worst part is that if your old Pixelfed server is down, your archive is basically useless. This is an image-based federated Instagram, after all, and your archive doesn't have any of your images.
SolutionsTo create a functional offline export with all the data, that could then be imported into Posty, I basically needed to take all the data that was missing from the Pixelfed archive, and reconstruct it into a Mastodon archive. Making the Mastodon archive a 'common format' made things a lot easier, as I'd already built a Mastodon importer.
And, importantly, I wouldn't have to rewrite any of the rendering code, I'd just need to coerce or default missing keys into the new structure.
The first and only real win was the account.json file. This is nearly identical to the actor.json included in the Mastodon export, and after stubbing in a few missing keys, I was almost able to save it verbatim.
Though I still needed to download the avatar image, because even in this file the link to it is a URL, the image itself isn't included in the export.
The outbox.json is not the same as Mastodon, either, but I just needed to add the top level 'Create' wrapper for that.
By far the lion's share of the work, I soon realized, would be retrieving all those missing images. How to do that, exactly?
There are of course performance issues needing to download images from someone else's server, and I made liberal use of threading to fire off multiple requests asynchronously to try to speed that up a bit, but it's kind of frustrating because in such a scenario you're dependent on the vagaries of the internet.
That's the ultimate reason why depending on the internet to reconstruct missing data sucks. Maybe the whole source server is down, temporarily or otherwise. Maybe the owner has configured object storage in such a way that certain assets are blocked from direct download, while still rendering just fine in a standard image tag.
In the case of the latter, this actually happened.
Here is one such image that I posted on pixelfed.social, which will not allow CORS and I cannot seem to download programmatically.
So I ended up trapping errors downloading images and redirecting the user to a manual download option, where each missing asset is displayed and links externally to itself in a new window, so you can do a 'Save as' and download the asset and re-upload it on that page yourself.
Hey, it works, and we do what we must.
But once that's done, you hit 'Continue' and you're on a page that gives you the option to download that Pixelfed archive as a Mastodon archive instead.
Once you do that, you're into âregular Postyâ mode and everything else works the same as it does in the Mastodon version, for the most part.
ConclusionIf you have a Pixelfed archive that's been collecting dust, I don't consider Posty optional. It's required to convert that into a Mastodon archive, as soon as possible, before your old Pixelfed instance goes offline, so you have your media included. The Mastodon archive also has the advantage of being used with any compliant Mastodon archive viewer, not just Posty.
Whether you generate a static HTML site from the resulting archive or not is completely optional, but downloading your Pixelfed archive as a Mastodon archive really is not if you want your archive to be forever useful and fulfill the three principles of good data exports above.
UpdateI'm not sure if I should take credit for this, but suddenly this happened.... [Archive]
Pixelfed Data Export
a full backup of your account with a self contained html preview
Available later today, where supported âš
â pixelfed (@pixelfed) 1/4/2025, 4:53:06 AM
This apparently never actually came to fruition, but if it did, just having the media assets available as part of the export would be a huge improvement over the current flow.
There was also this blog post, now deleted:
Thanks to @oliphant for bringing the poor state of Pixelfed exports to my attention!
I just shipped a massive refactor that supports you to export your statuses in a better format no matter how large your account is.
For example, my @dansup@pixelfed.social statuses export is about 6.1M of json!
â dansup (@dansup@mastodon.social) 1/5/2025, 5:31:08 PM
The new pixelfed-statuses.json format has essentially replaced outbox.json.
I've updated Posty for the Pixelfed changes, namely to accept pixelfed-statuses.json in lieu of outbox.json. Everything else works the same.
The replies problem is now fixed, and reply threads are properly reported. I believe the 500 status restriction has also been lifted.
We do not, as of yet, have an update that includes a downloadable archive of the image assets. And there's still no way for this export to be used to transfer from one Pixelfed instance to another.
Not sure what happened to that.