A drop in alternative frontend for your modmail-dev/modmail bot instance with built-in Discord authentication, advanced features and better mobile support.
Built from scratch using Javalin, JTE, Bootstrap 5, and Unpoly.
Demo Site running the latest commit from Master
Modmail-Viewer is currently a beta. You should always read update notes before applying updates as there may be breaking changes between major versions, and ensure you are running an up to date version to have the latest fixes and support.
Report any bugs you encounter via github issues at this repository (not modmail or logviewer).
Use GitHub discussions for feature requests or to ask questions. If you'd rather not ask on github, you can join the Discord server instead and ask there. Please prefer not to directly DM me as it's not discoverable for other people that need help and I will likely not notice it for a while.
- Discord OAuth2 authentication based on your modmail roles. See the wiki page on permissions.
- Browsable paginated logs sorted by most recent message and filtered by status.
- Mobile friendly design.
- Full message Discord Markdown formatting (Including spoilers, custom emojis, and timestamps).
- Customizable Branding
- Dark/Light Themes
- Log text search
- HTTPS support
- NSFW warnings
- Image spoiler support
- Stats dashboard
- Internationalization
- If you want internationalization and are interested in providing translations, please contact me and/or open an issue/discussion on GitHub.
- Basic API
- Snippet editor (will likely require a bot plugin)
- Persistent Notes editor
- Configurable log sorting
You should place your modmail-viewer instance behind Cloudflare or some other reverse proxy (such as Caddy) to provide automatic https OR provide the required keys/certs to the application yourself if you plan on using authentication.
Running the application with Docker is the fastest and best supported way to run modmail-viewer. Additionally, you can easily run it using any 3rd party service that supports running docker containers.
To quickly test modmail-viewer, you can use this docker run command. Make sure to substitute the environment variables for what is applicable to you.
docker run --name modmail-viewer -p 80:80 \
--env "MODMAIL_VIEWER_MONGODB_URI=mongodb://mongo:27017" \
--env "MODMAIL_VIEWER_URL=http://127.0.0.1" \
--env "MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_ID=1234" \
--env "MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_SECRET=abcd" \
-d ghcr.io/khakers/modmail-viewer:latest
For long term ease of use, it's highly recommended that you use docker compose. An example docker compose for running only modmail-logviewer.
Note See docker-compose.yml for a compose file that can run modmail, modmail-viewer, and mongodb.
version: "3.7"
services:
viewer:
image: ghcr.io/khakers/modmail-viewer:latest
env_file:
- .env
ports:
- "80:80"
# uncomment if using SSL
#- "443:443"
environment:
- "MODMAIL_VIEWER_MONGODB_URI=mongodb://mongo:27017"
- "MODMAIL_VIEWER_URL=http://127.0.0.1"
Should be located next to your docker-compose.yml, contains secrets.
Note You'll need to create a Discord application (or use the one you created for modmail) and retrieve your OAuth2 client ID and Client secret from the OAuth2 section of the developer dashboard Additionally, you must add a redirect URI to your Discord applications OAuth2 Redirects. This depends on how you access your site but will look something like "https://"modmail.example.com/callback"
MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_ID=123456789
MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_SECRET=67234rtg3b2otgfhbn3298t7h
MODMAIL_VIEWER_SECRETKEY=secret
Before getting started, you'll need:
- A JDK/JRE 17 installation
Download the latest release from GitHub and unzip/tar the modmail-viewer archive
Run the webserver via the included scripts bin/modmail-viewer
on linux, and bin/modmail-viewer.bat
on windows.
It's recommended to either set up a reverse proxy (such as Cloudflare or Caddy) in front of your modmail-logviewer instance, or enable SSL and provide your own certificate and private key. You can generate one for your domain automatically with Certbot.
To run the webserver in the background, it's recommended you use a service manager such as Systemd.
See the wiki page on permissions.
Environment Variable | Description |
---|---|
MODMAIL_VIEWER_URL | The URL your modmail viewer instance is reachable at (i.e http://127.0.0.1) |
MODMAIL_VIEWER_MONGODB_URI | URI for the MongoDB instance |
MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_ID | Your Discord Application ID. Can be skipped if authentication is disabled. |
MODMAIL_VIEWER_DISCORD_OAUTH_CLIENT_SECRET | Your Discord OAuth2 client secret |
MODMAIL_VIEWER_DISCORD_GUILD_ID | The ID of your discord Guild. This should be whatever guild has relevant discord Roles, as it checks the users roles in the provided guild |
MODMAIL_VIEWER_SECRETKEY | A randomly generated secret key used for signing auth tokens. ANYONE WITH THIS KEY CAN FORGE AUTHENTICATION TOKENS and impersonate any user. Should be at least 32 characters. If you don't provide one, sessions will not persist across restarts. |
MODMAIL_VIEWER_DEV | Enables development features. Do not enable in production. Requires a JDK. |
MODMAIL_VIEWER_AUTH_ENABLED | Set to false to completely disable authentication. May break some features. |
MODMAIL_VIEWER_SSL | Enables SSL and HTTP/2 when connected via https. |
MODMAIL_VIEWER_HTTPS_ONLY | Disables the http port and redirects all connections to https. Enabled by default if SSL is enabled. Does not function on localhost. |
MODMAIL_VIEWER_SSL_CERT | Path to the SSL certificate pem file. Does not hot reload. |
MODMAIL_VIEWER_SSL_KEY | Path to the SSL certificate private key pem file. Does not hot reload. |
MODMAIL_VIEWER_HTTP_PORT | Port HTTP traffic will be served at. Defaults to 80 |
MODMAIL_VIEWER_HTTPS_PORT | Port HTTPS traffic will be served at. Defaults to 443 |
MODMAIL_VIEWER_SNI | Set SNI to be enabled/disabled. Requires SSL to be enabled |
MODMAI_VIEWER_INSECURE | Disable setting cookies as secure. Only do this if your site is only accessible via http |
MODMAIL_VIEWER_BRANDING | Text to display in the navbar title. Will display "Modmail-Viewer" by default |
MODMAIL_VIEWER_LOG_LEVEL | Set the application log level (INFO, DEBUG, ERROR, TRACE) |
MODMAIL_VIEWER_ANALYTICS | Allows you to add the html for your analytics solution. This is inserted at the end of the head (and should thus likely be marked as defer for performance reasons) |
MODMAIL_VIEWER_ANALYTICS_BASE64 | Same as the above, but expects it's value to be base64 encoded. This is exists in the off chance that you run into character encoding issues using the standard variable. Will only work if standard option is provited |
This project uses graphics from Twemoji licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/