Update for the move from Passenger to Puma
Upgrade rack and sinatra
Update for Sourcehut
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.
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.
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.
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.
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.
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.
This application is available as open source under the terms of the MIT License.
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 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.