No description
  • Python 78.7%
  • HTML 17.4%
  • CSS 2.6%
  • JavaScript 1.2%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
zevaryx 5a42f65982
All checks were successful
CI / precommit (pull_request) Successful in 33s
CI / test (3.13) (pull_request) Successful in 12m14s
CI / test (3.12) (pull_request) Successful in 12m20s
CI / test (3.15) (pull_request) Successful in 19m55s
CI / test (3.14) (pull_request) Successful in 20m2s
CI / image (pull_request) Has been skipped
CI / precommit (push) Successful in 27s
CI / test (3.12) (push) Successful in 9m2s
CI / test (3.15) (push) Successful in 8m45s
CI / test (3.13) (push) Successful in 14m35s
CI / test (3.14) (push) Successful in 14m31s
CI / image (push) Successful in 25s
chore: bump version to 3.2.1 and pin jarvis-core 3.2.1 (0c864d7)
2026-11-17 19:16:46 +00:00
.forgejo/workflows build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
docs docs: proxy setting required in Docker, Mongo auth and Redis password, filter and role rules, Redis naming 2026-11-17 11:54:18 +00:00
tests fix(webui): safer notice lookup, re-announced statuses, 429 heading, and a static top bar up to 1000px 2026-11-17 11:48:29 +00:00
webui fix(webui): safer notice lookup, re-announced statuses, 429 heading, and a static top bar up to 1000px 2026-11-17 11:48:29 +00:00
.dockerignore build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
.flake8 build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
.gitattributes chore: normalise line endings to LF 2026-11-03 10:23:48 -07:00
.gitignore build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
.pre-commit-config.yaml build: leave vendored files alone in pre-commit 2026-11-03 07:54:50 -07:00
compose.example.yaml docs: proxy setting required in Docker, Mongo auth and Redis password, filter and role rules, Redis naming 2026-11-17 11:54:18 +00:00
Dockerfile build(docker): numeric USER 2026-11-17 05:46:10 +00:00
LICENSE build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
PRIVACY.md feat: see and cancel scheduled announcements on the website 2026-11-06 20:30:08 -07:00
pyproject.toml chore: bump version to 3.2.1 and pin jarvis-core 3.2.1 (0c864d7) 2026-11-17 19:16:46 +00:00
README.md docs: proxy setting required in Docker, Mongo auth and Redis password, filter and role rules, Redis naming 2026-11-17 11:54:18 +00:00
run.py build: add project skeleton, Dockerfile, compose example and CI 2026-11-03 07:42:49 -07:00
sample.env docs: proxy setting required in Docker, Mongo auth and Redis password, filter and role rules, Redis naming 2026-11-17 11:54:18 +00:00
TERMS.md docs: add the plan, readme, privacy policy and terms 2026-11-03 07:42:49 -07:00
uv.lock chore: bump version to 3.2.1 and pin jarvis-core 3.2.1 (0c864d7) 2026-11-17 19:16:46 +00:00

JARVIS web UI

The dashboard for jarvis-bot: sign in with Discord, manage your reminders and data, and manage the servers you look after. It runs alongside the bot and jarvis-tasks against the same MongoDB.

The design and roadmap are in docs/PLAN.md.

Versions

jarvis-bot, jarvis-tasks, jarvis-core and jarvis-webui share a version number: 3.x of each work with 3.x of the others.

What it does today

Public Landing page with the invite link, features, privacy policy and terms (rendered from PRIVACY.md / TERMS.md)
Sign in Discord OAuth2 (identify guilds); the access token is dropped right after sign-in
You Servers you share with the bot; set, edit and delete reminders (DM delivery) and your default timezone; appeal a ban where the server allows it; download or delete your data
Server managers Settings (log channels, reports, verified roles, invites, mass-mention, notifications, ignored channels, lockdown exclusions) with a download of the whole configuration as JSON, escalation rules, saved reasons, moderator activity (who took which actions), and an audit trail of what was changed on the website
Moderators Member search and a page per member; action log; Cases (open, note, close, reopen, download as CSV); Appeals (read; deciding needs Ban Members; approving unbans through the bot); warn, kick, mute, unmute, ban and unban from Actions, carried out by the bot; the server's own Statistics; the list of saved reasons; scheduled Announcements (see what is waiting or was posted, and cancel; created in Discord with /announce, needs Manage Messages)

| Everyone in a server | Tags: browse, search, create, and edit your own (or anyone's with Manage Messages) | | Message managers | Keyword Filters with a regex tester; Automation: autopurge, autoreact, role-ping protection, pinboards | | Channel managers | Tools: purge (with filters), lock and unlock, lockdown (typed confirmation, never automatic), post role menus | | Role managers | Roles: rolegiver groups (pick-one, required role, up to 15 roles) with posted menus kept up to date by the bot; temporary roles (read-only) |

Slow pages (member pages, action log, cases, audit trail, statistics) answer at once with a "Loading data..." placeholder and fill in when their data is ready; see webui/lazy.py. They need JavaScript.

Actions are queued in MongoDB (web_requests) and the bot carries them out within a couple of seconds, so the web UI needs the matching bot version running. Not built yet: giving temporary roles from the website, and deleting a pinboard (use /pinboard delete). See the phases in the plan. Raid and spam alerts are configured as a setting (alerts) and are posted by the bot.

Run it

The full walk-through, with reverse-proxy examples and a checklist, is in docs/DEPLOY.md. The short version:

The webui service is already in the compose.yaml of jarvis-bot, next to bot, tasks, MongoDB and Redis, and uses the same .env. If your compose file does not have it, copy it from compose.example.yaml. The example expects the cache and mongo services and the backend network from that file.

  1. In the Discord developer portal, open the bot's application, go to OAuth2 and add <WEBUI_PUBLIC_URL>/callback as a redirect. Copy the client secret.

  2. Put these in .env (see sample.env):

    Variable
    WEBUI_CLIENT_ID The application ID of the bot. Use the dev bot's in the dev deployment and the prod bot's in prod
    WEBUI_CLIENT_SECRET The OAuth2 client secret
    TOKEN The bot token (lookups only)
    WEBUI_PUBLIC_URL Where users reach the site, e.g. https://jarvis.example.com
    WEBUI_INVITE_PERMISSIONS Optional. Leave blank and the invite link uses the application's Default Install Settings from the developer portal; set an integer to override
    WEBUI_OFFLINE Optional. true shows "Systems Offline, Waiting for Initialization" (HTTP 503) on every page except /healthz, without touching MongoDB or Discord
    WEBUI_SESSION_DAYS Optional, default 7
    WEBUI_ADMIN_IDS Optional. Comma-separated Discord user IDs of whoever runs this instance. They get the Admin pages (/admin) in read-only form: overview, servers, queue, data health, users, logs, statistics and the audit trail. Everyone else gets a 404 there. Empty (the default) turns the pages off
    WEBUI_ADMIN_WRITE_IDS Optional. IDs of operators who may also change things from the Admin pages (maintenance mode, feature switches, leaving or blocking servers, erasing a person's data, cleaning up duplicate settings). They can look too, so they need not be in WEBUI_ADMIN_IDS. Keep this list short
    WEBUI_EXPECTED_COPIES Optional, default 0. How many copies of the website you run (for example 3 under Swarm). The admin pages raise an alert when fewer are reporting, and for any copy that has gone quiet. 0 only watches copies that are still listed
    WEBUI_ADMIN_SESSION_HOURS Optional, default 12. The Admin pages ask for a fresh sign-in through Discord once a session is older than this
    WEBUI_STATS_DATABASE Optional. The database holding the bot's statistics (Stat, StaticStat). By default the same database as the bot (MONGO_DATABASE, else jarvis_dev or jarvis), which is where the bot writes them. Only the 2.x bot used a separate statipy database
    WEBUI_SOURCE_URL Optional. Where the footer's "Source code" link goes (default: this repository)
    WEBUI_FORWARDED_ALLOW_IPS Optional, default 127.0.0.1. Set this when the site runs in Docker behind a reverse proxy. It is the reverse proxy's address (comma-separated, or a CIDR range): only requests from there may set X-Forwarded-For and X-Forwarded-Proto. In Docker the proxy reaches the container from the network's gateway or the proxy container's address, not 127.0.0.1. Left at the default, the site ignores those headers, so client IP addresses and https detection are wrong. Set it to the proxy's address (for example 172.18.0.1 or 172.18.0.0/16). Never * unless nothing but the proxy can reach the port
    WEBUI_HOST, WEBUI_PORT Optional, default 0.0.0.0 and 8080. Where the site listens inside its container. The compose file publishes 8080, so leave them
    LOG_LEVEL Optional, default INFO
    MONGO_*, ENVIRONMENT Same as the bot (ENVIRONMENT=develop uses jarvis_dev). With the compose stack's MongoDB, set MONGO_USERNAME, MONGO_PASSWORD and MONGO_AUTH_SOURCE=admin; the compose file creates that account when its data volume is first made
    REDIS_HOST, REDIS_USERNAME, REDIS_PASSWORD Optional in the code, same as the bot. The compose file's Redis needs REDIS_PASSWORD and is at redis://cache. Rate limits (member search, filter tester) are shared through it, so every instance counts together and restarts do not reset them. Without it they are kept in each instance's memory. If it is down, requests are allowed rather than blocked

    Run one instance per bot (dev and prod), each with its own client ID, secret, token, URL and database.

  3. docker compose up -d webui. It listens on port 8080, published on 127.0.0.1 only; put a TLS-terminating reverse proxy in front of it. /healthz answers ok.

The container runs as user ID 10001 with a read-only root filesystem, no extra capabilities and no-new-privileges, and needs no writable disk. It waits for MongoDB and Redis to be healthy, and the image checks /healthz itself. Use the same JARVIS_VERSION as the bot and tasks.

Word filter rules

The Filters page and the bot's /filter command follow the same rules, because a pattern is a regular expression that runs on every message. A filter is a list of patterns, one per line, up to 3000 characters. A server can have at most 100 patterns across all its filters.

A pattern is refused if it:

  • is longer than 200 characters;
  • repeats something more than 100 times with {n}, {n,}, {,m} or {n,m};
  • nests repeated groups more than 2 deep, such as ((a+)+)+;
  • multiplies repeats inside repeats past 1000 in all, such as ((a{10}){10}){10};
  • uses fuzzy matching, such as {e<=1};
  • uses an inline flag other than i, m and s, such as (?x);
  • contains a comment, (?#...);
  • is not a valid regular expression.

Each pattern is also test-compiled in a separate, limited process. One that takes too long or too much memory to compile is refused, even if it passes the rules above. The reason is shown next to the field. To fix it, make the pattern simpler: a smaller repeat, or fewer nested groups.

Roles

On the Roles page, and wherever you choose a role the bot will hand out, a role is refused if it:

  • carries a dangerous permission (Administrator, Manage Server, Manage Roles, Manage Channels, Manage Messages, Kick Members, Ban Members, Moderate Members, Mention Everyone, and the others in the bot's DANGEROUS_PERMISSIONS);
  • is managed by an integration;
  • is at or above the bot's highest role;
  • is at or above your own highest role (unless you own the server).

You need the Manage Roles permission to choose such roles (administrators and the server owner pass). Moderation actions follow the role hierarchy: you can only act on members whose highest role is below yours.

Develop

uv sync
cp sample.env .env   # fill it in
uv run python run.py

Tests use a real MongoDB and a fake Discord:

JARVIS_TEST_MONGO_URI=mongodb://localhost:27017 uv run pytest

Every collection in the test database is dropped, so give it a database of its own (JARVIS_TEST_MONGO_DB).

Layout

Path
webui/app.py Application factory, security headers, error pages
webui/auth.py Sign in and out
webui/deps.py, webui/perms.py Sessions, CSRF, and working out what someone may do in a server
webui/discord.py Small Discord REST client with caching
webui/routes/ Pages
webui/templates/, webui/static/ The HUD theme (htmx and fonts are vendored; nothing loads from third parties)