An open API service indexing awesome lists of open source software.

https://github.com/yusukebe/minidon

Minimal implementation of ActivityPub using Cloudflare Workers and D1
https://github.com/yusukebe/minidon

Last synced: about 1 year ago
JSON representation

Minimal implementation of ActivityPub using Cloudflare Workers and D1

Awesome Lists containing this project

README

          

# 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](https://user-images.githubusercontent.com/10682/216822004-603b867e-203e-48bf-bf13-efa41830eab8.gif)

## 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.