Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/dummybridge/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BEEPER_USERNAME=your_username_or_mxid
BEEPER_PASSWORD=your_password

# Optional bridge-manager-compatible settings.
# BEEPER_BASE_DOMAIN=beeper.com
# DUMMYBRIDGE_BRIDGE_NAME=dummybridge
# DUMMYBRIDGE_URL=https://bridge.example
DUMMYBRIDGE_SENDER_LOCALPART=dummybridgebot

# Optional live actions after startup.
# DUMMYBRIDGE_CREATE_ROOM=1
# DUMMYBRIDGE_PORTAL_ROOM_ID=!existing:example
# DUMMYBRIDGE_BACKFILL_ON_START=1
1 change: 1 addition & 0 deletions examples/dummybridge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pickle-bridge
62 changes: 62 additions & 0 deletions examples/dummybridge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Pickle DummyBridge

This is a minimal TypeScript bridge built on `@beeper/pickle-bridge`.

It demonstrates the bridge shape needed to:

- register a bridge connector
- start Pickle with the same WASM Matrix client
- initialize an appservice registration
- load a user login
- create or register a portal room
- create or register a management room and handle `dummy ...` commands
- backfill historical events
- receive Matrix messages and echo them back through appservice ghost users
- fetch/register Beeper appservice credentials from the Matrix login

Source lives in `src/*.ts`; the runnable files are built into `dist`.

## Smoke test

```sh
pnpm --filter @beeper/pickle-example-dummybridge smoke
```

The smoke test uses a fake Matrix client, so it does not need a homeserver.

## Live run

Copy `.env.example` to `.env`, then fill in `BEEPER_USERNAME` and `BEEPER_PASSWORD`:

```sh
pnpm --filter @beeper/pickle-example-dummybridge start
```

`loginWithPassword()` returns a standard Pickle Matrix account and defaults to Beeper unless a homeserver is provided. `createBeeperBridge()` takes that account, fetches/registers the Beeper appservice through the bridge-manager-compatible Hungryserv endpoints, uses the default file-backed state package, and starts the bridge runtime with the computed appservice registration.

To create a portal at startup:

```sh
DUMMYBRIDGE_CREATE_ROOM=1 pnpm --filter @beeper/pickle-example-dummybridge start
```

To attach to an existing portal room instead:

```sh
DUMMYBRIDGE_PORTAL_ROOM_ID='!room:example' pnpm --filter @beeper/pickle-example-dummybridge start
```

To create a management room for commands:

```sh
DUMMYBRIDGE_CREATE_MANAGEMENT_ROOM=1 DUMMYBRIDGE_INVITE_USER='@you:example' pnpm --filter @beeper/pickle-example-dummybridge start
```

Or attach to an existing management room:

```sh
DUMMYBRIDGE_MANAGEMENT_ROOM_ID='!room:example' pnpm --filter @beeper/pickle-example-dummybridge start
```

Send `dummy help` in that room to list commands such as `create-room`, `message`,
`messages`, `ghost`, `kick-me`, `file`, `media`, `cat`, and `avatar`.
24 changes: 24 additions & 0 deletions examples/dummybridge/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@beeper/pickle-example-dummybridge",
"private": true,
"type": "module",
"scripts": {
"build": "tsdown",
"smoke": "pnpm build && node dist/test/smoke.mjs",
"start": "pnpm build && node dist/src/index.mjs",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@beeper/pickle": "workspace:*",
"@beeper/pickle-bridge": "workspace:*",
"@beeper/pickle-state-file": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.0.0",
"tsdown": "^0.21.10",
"typescript": "^5.7.2"
},
"engines": {
"node": ">=20"
}
}
Loading
Loading