- Rust 100%
|
|
||
|---|---|---|
| src | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| detectable.json | ||
| detectable_fixes.json | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
rpcd
discord rpc daemon. rust port of arrpc-bun.
receives rich presence updates from local applications via discord ipc and a websocket transport, then re-broadcasts them to a bridge that a real discord client can connect to. also scans running processes against discord's detectable database to surface running games.
status
linux only.
windows ipc transport is not implemented.
macos has not been tested since the rewrite.
install
build from source with a recent rust toolchain:
cargo build --release
./target/release/rpcd
usage
rpcd [options]
flags and env vars are documented in rpcd --help.
short version:
rpcdruns in the foreground.rpcd --update-databaserefreshes the detectable game database from discord and merges local fixes.rpcd --list-databaseinspects the loaded database.rpcd --list-detectedshows what the process scanner is currently surfacing.
environment
see rpcd --help for the full list. common ones:
RPCD_DEBUG=1enables debug logging.RUST_LOGis also respected.RPCD_NO_PROCESS_SCANNING=1disables the /proc scanner.RPCD_DATA_DIR=/pathoverrides wheredetectable.jsonanddetectable_fixes.jsonare read and written.RPCD_DETECTABLE_FIXES_URL=<url>overrides the upstream fixes source used by--update-database.
bridge wire format
the bridge listens on RPCD_BRIDGE_PORT (default 1337) and broadcasts json messages to every connected client. two shapes:
activity events (untagged):
{ "activity": { ... }, "pid": 1234, "socketId": "..." }
bridge commands (tagged with a cmd field):
{ "cmd": "INVITE_BROWSER", "data": { "code": "..." } }
{ "cmd": "GUILD_TEMPLATE_BROWSER", "data": { "code": "..." } }
{ "cmd": "GIFT_CODE_BROWSER", "data": { "code": "..." } }
{ "cmd": "DEEP_LINK", "data": { ... opaque ... } }
{ "cmd": "OPEN_EXTERNAL_LINK", "data": { "url": "..." } }
{ "cmd": "OPEN_MESSAGE", "data": { ... opaque ... } }
{ "cmd": "NAVIGATE_TO_CONNECTIONS", "data": {} }
{ "cmd": "SEND_ACTIVITY_JOIN_INVITE", "data": { "user_id": "..." } }
{ "cmd": "CLOSE_ACTIVITY_JOIN_REQUEST", "data": { "user_id": "..." } }
a bridge mod (the javascript injected into discord) should detect by checking for a cmd field; if present, dispatch the matching internal action; otherwise treat as an activity update.
license
bsd 3-clause. see the license file.