Skip to content

Minimal implementation of ActivityPub using Cloudflare Workers and D1

Notifications You must be signed in to change notification settings

yusukebe/minidon

Repository files navigation

Minidon

Minimal implementation of ActivityPub with Cloudflare Workers and D1.

What can we do?

  • Having only one actor
  • The actor is discovered via webfinger (so you can find the account from other instances)
  • Notifying followers of new posts (so new posts show up in their timeline)
  • Web interface to post messages

Screencast

output

Requirements

  • Node.js
  • Cloudflare Account

Installation

yarn install

Configuration

cp wrangler.sample.toml wrangler.toml

Fill the values:

  • preferredUsername - Your account name. eg. yusukebe
  • name - Your long name. eg. Yusuke Wada
  • BASIC_USERNAME - Basic auth username for login to Web UI
  • BASIC_PASSWORD - Basic auth password

Pick up the value of PRIVATE_KEY from the files generated by ssh-keygen:

ssh-keygen -b 4096 -m PKCS8 -t rsa -N '' -f id_rsa

You can also use the value as "Secret variables" in Cloudflare Workers.

Setup D1

wrangler d1 create minidon

database_id will be shown on your console. Copy it and paste into the value of database_id and preview_database_id in wrangler.toml.

Create tables:

wrangler d1 execute minidon --file minidon.sql

Development

yarn dev

Deploy

yarn deploy

Usage

@{name}@{minion.username.workers.dev} will be your account id. Paste it on such a Mastodon URL input, the account will be shown.

To post the message, access https://minion.username.workers.dev/ui.

Author

Yusuke Wada

License

MIT

And using a lot of code in Matchbox and inspired by Express ActivityPub Server.

Matchbox https://gitlab.com/acefed/matchbox Copyright (c) 2022 Acefed MIT License

Express ActivityPub Server https://github.com/dariusk/express-activitypub Copyright (c) 2018 Darius Kazemi. Licensed under the MIT license.

About

Minimal implementation of ActivityPub using Cloudflare Workers and D1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published