Kansattica / msync

A store and forward command line Mastodon and Pleroma client that fits on a floppy disk.
Other
60 stars 5 forks source link

msync

A low bandwidth store and forward Mastodon API client

msync is a command line client for Mastodon (and anything else that implements the same API, including Pleroma) that works a little different. msync doesn't stay connected to the internet all the time and constantly pull new posts. Instead, it only connects when you use the msync sync command. Every other change is stored on your computer until then. You can queue up posts to send, boost, bookmark, and favorite when you're online, download posts, notifications, and bookmarks to look at offline, and do the same for as many accounts as you want.

msync currently supports queueing and sending posts, boosts, favorites, and bookmarks for any number of accounts, as well as downloading the home timeline, notifications, bookmarks, and arbitrary threads.

msync is for everyone, but it's really designed for:

Get msync

You can download the latest stable release of msync here or the Releases link to the right.

If you're feeling adventurous, you can order a floppy disk release.

Which release should I download?

I recommend downloading the .deb file if you're on a x64 Debian-like system that can install it. Otherwise, I recommend downloading the release for your system with install in the filename. This version will store user data in the appropriate place for your system. The versions without install store user data in the same directory as the executable. See the manual for more information.

If you're on OSX, the builds for 10.15 use std::filesystem APIs that are only available on OSX 10.15. Not that you can download these any more- GitHub Actions removed support for pre-11 versions of macOS, so you'll have to build yourself if you're on an older macOS.

If you would like to build msync yourself, read on. If you have a fairly recent version of CMake (3.12 or later), you can simply clone the repo, make a build directory, run CMake inside, and CMake will download and build msync and its dependencies automatically.

Arch Linux users can use the AUR packages msync and msync-git. These are maintained by someone else and I cannot test them, but I have no reason to believe they won't work.

Notes on libcurl

Building on Linux

On a new Debian-like system, the setup process looks something like this:

apt install cmake git gcc g++
git clone https://github.com/Kansattica/msync.git
cd msync
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DMSYNC_BUILD_TESTS=OFF -DMSYNC_USER_CONFIG=ON -DMSYNC_FILE_LOG=OFF 
cmake --build . --parallel

The full list of options that can be passed to CMake is here.

The last two steps will take a while, but when you're done, you should see a msync executable in your folder, and that's all you need!

Older Linux releases might require you to apt install libstdc++-8-dev or their equivalent to get the standard library features msync requires, such as std::filesystem. If that doesn't work, you may also need g++-8 and to run CC=gcc-8 CXX=g++-8 cmake [...] instead.

Building on macOS

The instructions for building on Linux should mostly work, though note that Apple only officially supports std::filesystem on Xcode 11.1 and Catalina/10.15 and up. msync does support pre-10.15 versions with Boost::filesystem, which you can install through Homebrew. I don't have a Mac to test on, but I do ensure that it builds and all unit tests pass.

I used to test on OSX 10.15, producing builds for both 10.14 with Boost::filesystem 1.72.0 and 10.15 with Apple's std::filesystem implementation. GitHub Actions stopped supporting earlier macOS versions, so I now build and test on macOS 11 and 12. I have no reason to believe that earlier versions won't still work, but I have no way to test that right now.

Building on Windows

On Windows, you'll want Visual Studio with the C++ development workload and CMake installed. After that, git clone https://github.com/Kansattica/msync.git, then open Visual Studio and go to File > Open > CMake... (some versions just have File > Open > Folder... instead, this will also work) and choose the msync repo you just downloaded. Visual Studio will take a while to download and configure everything, and then you should be able to pick x64-Release from the dropdown at the top, make sure the msync.exe target is selected, and build from there.

If you want something lighter weight, I suspect you can install the build tools for Visual Studio and build from the command line. I don't have as much experience with this, but you typically have to open the start menu, search for something called "developer command prompt", and then the CMake commands should be the same as the Linux commands up above.

Available builds

msync currently builds and all tests pass for the following compilers and environments:

Relevant CMake flags

Pass these during the first call to CMake (next to -DCMAKE_BUILD_TYPE=Release) to configure msync's behavior. Boolean options can either be set to ON or OFF like this: -DMSYNC_FILE_LOG=OFF

Command Type Default Description
MSYNC_BUILD_TESTS boolean ON If ON, download Catch2 and build two test executables, tests and net_tests, will also be built.
MSYNC_FILE_LOG boolean ON If ON, msync will create an msync.log file in the current directory whenever it runs with a record of what it did.
MSYNC_USER_CONFIG boolean OFF If ON, msync will store account information in the default location for your system. On Windows, this is something like C:\Users\username\AppData\Local. On Linux and OSX, this is the XDG_CONFIG_HOME environment variable, if set, and ~/.config otherwise. If this is OFF, msync will store information in the same directory as the executable.
MSYNC_DOWNLOAD_ZLIB boolean ON If ON AND you're on Windows, CMake will download a built copy of zlib and statically link it to curl for compression. No effect on other platforms.
USE_SYSTEM_CURL boolean ON If ON AND CMake can find libcurl on your system, msync will use that to perform network requests. If this is OFF OR CMake couldn't find libcurl, it will download, build, and statically link libcurl for you.
MSYNC_NLOHMANN_JSON_DIR string "" Look in this directory for Nlohmann JSON. If empty (the default), msync will download it automatically.
MSYNC_CLIPP_DIR string "" Look in this directory for Clipp. If empty (the default), msync will download it automatically.
MSYNC_WHEREAMI_DIR string "" Look in this directory for Whereami. If empty (the default), msync will download it automatically.
MSYNC_CPR_DIR string "" Look in this directory for CPR. If empty (the default), msync will download it automatically.
MSYNC_CATCH2_DIR string "" Look in this directory for Catch2. If empty (the default) and MSYNC_BUILD_TESTS is ON, msync will download it automatically.

If the MSYNC_*_DIR options don't work, please let me know with a GitHub issue- these are provided as conveniences for packaging and I don't have a good way to test them on their own.

Testing your build

To ensure that msync found and compiled its network dependencies correctly, run the CMake commands above without -DMSYNC_BUILD_TESTS=OFF (or, equivalently, -DMSYNC_BUILD_TESTS=ON). Then, run ./tests/net_tests. This will determine whether msync can correctly make authenticated HTTPS requests and will print warnings if it cannot request and recieve compressed responses.

Next steps

Once you have msync compiled, check out MANUAL.md for installation and usage information.

Features (that are implemented or coming soon)

Roadmap (things for later)

Build Dependencies

CMake will download all of these for you, except it'll use your system's libcurl if you have it and can't update your compiler or standard library. I recommend at least having an SSL/TLS library for CMake to find and dynamically link. You can verify that your setup works by building tests and running net_tests.

License

GPLv3 for now, also fascists fuck off.