~srushe/babbas

A Ruby IndieWeb Media Endpoint, for Micropub
feec2c96 — Stephen Rushe 5 months ago
Update for the move from Passenger to Puma
d720f4c7 — Stephen Rushe 5 months ago
Upgrade rack and sinatra
983647b1 — Stephen Rushe 4 years ago
Update for Sourcehut

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~srushe/babbas
read/write
git@git.sr.ht:~srushe/babbas

You can also use your local clone with git send-email.

#Babbas - A Ruby IndieWeb Media Endpoint, for Micropub

Babbas is a Media endpoint for use with an IndieWeb Micropub endpoint. It is written in Ruby, as a Sinatra application, and supports IndieAuth authorisation, as well as being content-addressable.

#Requirements

  • Ruby - the latest version (or one version back).

#Installation

Babbas is currently used as the Media endpoint for my personal website (https://deeden.co.uk/) and, as such, is configured to work for me. It should work for someone else if properly configured (via .env). For my purposes I run Babbas through Puma on a Dreamhost VPS.

#Configuration

#Environment variables

Use of the application requires a number of environment variables to be specified, while others are optional. It does support dotenv if that floats your boat.

#Required
Variable Format Purpose
ENDPOINT_URL URL The domain you want to serve media from. For example, I serve the files from https://media.deeden.co.uk
ENDPOINT_BASE Directory path The base directory for where your media will be stored.
DATA_DIRECTORY Directory path A more specific directory (within ENDPOINT_BASE) for where your media will be stored.
TOKEN_ENDPOINT URL The token endpoint used to verify any IndieAuth token
DOMAIN URL The domain any IndieAuth token will be verified to be valid for
PORT Number The port number to run the server on
LOG_FILE File path The path to where logs should be written
#ENDPOINT_BASE vs DATA_DIRECTORY

What is the difference between ENDPOINT_BASE and DATA_DIRECTORY, you ask?

Let's say that you want to store your media in the /www/media/ directory, and have your media links served from the root of a site, such as https://example.com/. In that case you would set the following values (similar to what I use)...

Variable Value
ENDPOINT_URL https://example.com/
ENDPOINT_BASE /www/media
DATA_DIRECTORY None/Unset

However maybe you'd prefer to serve your media from a different path, such as https://example.com/photos/. In this case you could configure it as follows...

Variable Value
ENDPOINT_URL https://example.com/
ENDPOINT_BASE /www/media
DATA_DIRECTORY photos

This results in photos being included correctly included in both the path used to save the file, and the url used to refer to the file.

#Token Verification environment variables

Babbas uses the IndieAuth::TokenVerification ruby gem to verify an IndieAuth access token against a token endpoint, and the TOKEN_ENDPOINT and DOMAIN environment variables are required by that gem.

TOKEN_ENDPOINT specifies the token endpoint to be used to validate the access token. Failure to specify TOKEN_ENDPOINT will result in a IndieAuth::TokenVerification::MissingTokenEndpointError error being raised.

DOMAIN specifies the domain we expect to see in the response from the validated token. It should match that specified when the token was first generated (presumably your website URL). Failure to specify DOMAIN will result in a IndieAuth::TokenVerification::MissingDomainError error being raised.

#Contributing

While Babbas is written with a view to "self-dogfooding" I'm still happy for other people to use and contribute to the project. Bug reports can be added at https://code.deeden.co.uk/babbas/issues, while patches are welcome at https://code.deeden.co.uk/babbas/patches.

#License

This application is available as open source under the terms of the MIT License.

#Code of Conduct

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

#Babbas?

Babbas, a genie from Yonderland

Babbas is a genie from the TV series Yonderland. He is tasked with looking after a video message for one of the lead characters, hence his use as the name for my media endpoint.