A PureScript web frontend for the Aviary protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Emi Simpson 96808a5648
Split CSS out into its own file
4 months ago
dist Split CSS out into its own file 4 months ago
src Improve the rendering of errors on thumbnails & rendered images 4 months ago
test Began work on a PureScript Aviary implementation 5 months ago
.editorconfig Add editor config 5 months ago
.gitignore Began work on a PureScript Aviary implementation 5 months ago
README.md Split CSS out into its own file 4 months ago
format.proto Predict the correct size of full images 4 months ago
packages.dhall Made a whole bunch of changes 5 months ago
spago.dhall Partially sequentialize code for loading adjacent images on focus 4 months ago


Aviary Web (PureScript)

Welcome to Aviary. This is the decode-only web frontend for viewing E2E encrypted galleries on the web. This follows a protocol shared by aviary-cli, which is (as of writing) the only way to create galleries.

This project is still pre-release. It works, but the protocol and the application are both bound to go through heavy changes, and may be missing key features. The most glaring of these, at time of writing, is the lack of documentation.


This project is built with PureScript, and uses PureScript's package manager spago, which you'll need to have installed. Visit purescript.org for information on how to do this.


For development builds, you can use the spago bundle-app command to generate the index.js file. You may then proceed to the Setup section to set up a webserver to work with.


For production builds, it is necessary to take several steps to reduce the file size. You'll need to install a couple extra tools:

# Build the code
spago build

# Replace function(a) { b } with a => b
lebab --replace output/ --transform arrow,arrow-return

# Bundle the code into a single .js file, and minify
spago bundle-app --minify

# Perform some final optimizations
uglifyjs --compress --mangle --toplevel -- index.js > aviary.min.js

Aside: If you know a way to bring the file size down further, please open an issue!

You may now proceed to the Setup section.


Aviary works with a [0x0]-compatible server as a backend. To set up a quick server for development, follow these steps:


  • Python3 with pip
  • git
  • A C++ compiler (e.g. gcc) & libc/python development headers
# Download 0x0
git clone https://git.0x0.st/mia/0x0
cd 0x0

# Set up the environment and install deps
python3 -m venv venv --prompt 0x0
source venv/bin/activate || source venv/bin/activate.fish
pip install wheel
pip install -r requirements.txt
pip install gunicorn

# Perform some configuration
mkdir instance
echo "
# Use a local sqlite3 database to store information
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'

# Encrypted files really throw off mime guessers, which can cause some
# encrypted images to get rejected for having ELF headers (e.g. looking like
# executables).  We don't want this, so we disable MIME filtering

# Images are rarely larger than 16 MB
MAX_CONTENT_LENGTH = 16 * 1024 * 1024
" > instance/config.py

# Setup the database
FLASK_APP=fhost flask db upgrade
mv database.db instance/

# Use the aviary index.html page as the 404 page
# CHANGE THE /path/to/aviary/index.html TO POINT TO index.html IN THIS REPO
ln -fs /path/to/aviary/dist/www/index.html templates/404.html

# Run the server
gunicorn fhost:app

You'll also need to serve the aviary.min.js file generated during the building step at /aviary.min.js, and the aviary.css file in :dist/www/ at /aviary.css. This can be done using an external webserver. A sample Caddyfile exists in :dist/. To use this, run the following command from the dist/ directory after filling in the /path/to/0x0 with the directory your instance of 0x0 is running in.

caddy run