Dough Git

repository

clove/allInOne

public

All in 1 local site for proxy management

clone git clone https://git.doughmination.gay/clove/allInOne.git

README.md

Plural System

The System website, API, live WebSocket and Discord bot run in one Rust process. The default address is http://127.0.0.1:3000. Bun builds the Svelte frontend. At runtime, Rust serves the resulting files from web/dist.

Run locally

Install Rust (with Cargo), Bun, and Bash. From the project directory:

  1. Run ./start. On a fresh checkout it creates .env from the example.
  2. Set ADMIN_PASSWORD in .env. You can set SYSTEM_NAME before first launch and change the default ADMIN_USERNAME of admin.
  3. Run ./start again. It builds missing artifacts, then starts the app. Open http://127.0.0.1:3000/user/login and sign in.

Use ./start --build after updating the source. Set BIND_ADDR for a different listen address. For a public instance, put an HTTPS reverse proxy in front of the app and forward WebSocket upgrades. Profiles, fronting history, and system status are public to anyone who can reach the site.

Discord bot

Set DISCORD_TOKEN and OWNER_ID for your own Discord bot and Discord user. Enable the Message Content intent and give the bot appropriate permissions, including Manage Webhooks. Leave DISCORD_TOKEN empty for website-only mode.

Use p$help in Discord to see the commands. Set COMMAND_PREFIX in .env and restart to change the prefix. For example, with COMMAND_PREFIX='!', use !help. A prefix must be non-empty and contain no whitespace or backticks.

Set PUBLIC_URL to your site's origin, such as https://system.example, to include profile links in Discord member cards. ImageMagick 7 (magick on PATH) enables merged avatars and locally uploaded webhook avatars. The bot profile and default webhook avatar use the site favicon. Member avatars still take precedence for proxied messages.

The owner can set a local password for another account on the User Manager page.

Storage

  • data/system.jp holds the system, switch history, relationships, tags, statuses, pride, users and local sessions.
  • data/members/<MEMBER-ID>.jp holds one member profile per JPCL file. The filename and the profile's id must match.
  • data/settings.jp holds the bot's guild settings. An existing proxyBot JPCL settings file can be copied into this path.
  • data/media/ holds uploaded image files.

Back up the whole data/ directory. On first startup after upgrading, embedded member profiles are moved out of system.jp. Stop the app before editing files by hand, then restart to load your changes. Use one running instance per data directory.

Import an existing System

Export the four source tables to a local JSON file using the existing System checkout. Set D1_DATABASE to the source database name. Select --local for the local D1 instance or --remote for the Cloudflare instance you intend to read.

bunx wrangler d1 execute "$D1_DATABASE" --local --json \
  --command "SELECT * FROM systems; SELECT * FROM members; SELECT * FROM switches; SELECT * FROM kv WHERE key IN ('users', 'member_tags', 'member_pride', 'member_status', 'member_relationships', 'mental_state');" \
  > /tmp/system-d1.json

From this repository, configure .env with your existing owner username and run the importer before first launch:

./start --build --import-d1 /tmp/system-d1.json

The importer creates data/system.jp and individual member files. It requires a new destination. It reads both legacy JSON and JPCL values. Imported accounts keep their owner and admin privileges and need local credentials. Media URL fields keep their existing values. Re-upload images from the owner interface to serve them from local storage.

API

The API keeps its /api/plural prefix and supports JPCL, JSON and YAML reads. Use Accept: application/jpcl for JPCL responses and Content-Type: application/jpcl to submit a JPCL document. The WebSocket at /api/plural/ws accepts the jpcl subprotocol or sends JSON events by default.

Sign in with POST /api/plural/auth/login using a username and password, then send the returned access_token in the Authorization: Bearer header. The API reference is available after sign-in at /user/docs.

For runit, run the service under your chosen service account. Set PROXY_APP_DIR to the checkout when installing the launcher elsewhere and PROXY_LOG_DIR to choose the log directory.