Package io.github.mastodonContentMover


package io.github.mastodonContentMover
Saves statuses from a user account on a Mastodon instance to an XML-based archive on the local filesystem, and posts them as new statuses from that archive to a user account on a Mastodon instance, to preserve and migrate content in posted statuses when users migrate between Mastodon instances.

The tool is run from Mover, which connects to the specified Mastodon instance using Authenticator and then saves Post objects to or posts them from a PostArchive. Media attachments for Post objects are held in MediaFile objects.

Access credentials are stored by Authenticator using UserCredentialStore and ClientCredentialStore, which in turn uses ClientCredentialSet to hold client key/secret pairs. OAuth authentication managed within Authenticator is aided by OAuthListener.

XML persistance uses JAXB, with the text of users' statuses saved in a format that can be inspected and edited outside of the tool, using a basic text editor, after saving and before posting. Media files and associated metadata saved from a Mastodon instance can also be adjusted if needed. For example, the version of a video or image downloaded from a Mastodon instance could be replaced with a higher-resolution or quality version within the archive, before reposting, to ensure there is no loss due to encoding settings on the previous instance. Saved statuses are organised together with their associated media in folders according to their creation date and time.

User and client credentials are also saved in XML format, and can be inspected and edited if needed. Please ensure you run the tool from a working directory that is secure (not on a public computer) in order to keep your access token private, or delete userCredentials.xml from the data directory after use. Failure to do this may allow others to access your Mastodon account.

  • Classes
    Class
    Description
    Handles the process of authenticating a connection with a Mastodon instance, using an OAuth callback facilitated by OAuthListener — a minimal HTTP server that runs briefly on the local machine to receive a call from the browser on that machine to the localhost.
    Holds in an XML-persistable object a client-key and client-secret pair that grants application-level API credentials for the tool with a Mastodon instance.
    Holds in an XML-persistable object the application-level API credentials for the tool with respective Mastodon instances, using ClientCredentialSet objects to store individual client-key and client-secret pairs.
    Holds in an XML-persistable object the metadata associated with a media file attached to a Post object.
    Bootstraps application, parses command-line parameters, determines which function was requested by the user, and then performs that function.
    Operates a minimal HTTP server on the local machine for the duration of OAuth authorization of the tool by a Mastodon instance, passing the callback code collected via an OAuth callback (from a browser on that machine) to the instantiated Authenticator singletone object.
    Holds in an XML-persistable object all the data associated with a Mastodon status, using MediaFile objects to store metadata associated with media files.
    Manages a collection of Post objects associated with an archive of Mastodon statuses, including loading them from file on startup, maintaining indexes on them, and handling date/time processing related to the internal archiveId used as the main reference for all Post objects.
    Holds in an XML-persistable object the user-level API access tokens for user accounts on respective Mastodon instances.