An external website that allows moderators and administrators to view past Modmail threads. It provides a convenient way for moderators to track previous conversations and helps them to maintain a record of user interactions.

modmail-dev, updated 🕥 2023-03-19 13:16:20

Modmail Log Viewer

A simple webserver to view your selfhosted modmail logs.

Deploy to Heroku Support Donate on Patreon Made with Python 3.9 Coding Style Black AGPL License

What is this?

In order for you to view your self-hosted logs, you have to deploy this application. Before you deploy the application, create a config var named MONGO_URI and put your MongoDB connection URI from the previous section into the value slot. Take the URL of this app after you deploy it and input it as a config var LOG_URL in the Modmail bot app.

Updating

You can automatically update the logviewer in your Heroku account whenever changes are made to this repo.

To enable auto-updates, fork this repo and install the Pull app in your fork. Then go to the Deploy tab in your Heroku account, select GitHub and connect your fork. Turn on auto-deploy for the master branch.

Self-Hosting Setup

The method of hosting the logviewer depends on your server configurations.

Below are some general instructions to help you get started on a Linux machine.

Prerequisites

e.g. on Ubuntu: shell sudo apt install software-properties-common python3.9 python3-dev python3-pip

Deployment

Run the following shell commands: shell git clone https://github.com/kyb3r/logviewer cd logviewer python3 -m pip install pipenv pipenv install cp .env.example .env Edit the .env file (e.g. nano .env) and fill in your MongoDB connection URI.

You can also customize the bind IP and port in the .env file.

Then to start the app, run: shell pipenv run logviewer

You can verify the logviewer is working by navigating to http://<IP_OF_SERVER>:8000 (if you didn't change the bind IP / port) and should be greeted with the Logviewer main page.

To run the program in the background, you can use screen. Or you can use a service manager, such as systemd, which can also auto-restart the logviewer on failure and after system reboot.

Advanced

We recommend setting up Nginx reverse proxy to port forward external port 80 to your internal logviewer port and cache static web contents (tutorial).

To accept requests from a domain instead of your server IP, simply set an A/AAAA record from your DNS record manager that forwards your domain to your server IP.

Discord OAuth2

Protecting your logs with a login (Discord Oauth2 support) is a premium feature, only available to Patrons.

Contributing

If you can make improvements in the design and presentation of logs, please make a pull request with changes.

Issues

Add lint and tests workflow, change Dockerfile base image

opened on 2023-01-07 07:51:20 by raidensakura

Description of the changes

This PR adds GitHub Actions workflow to check for proper code linting using black, and build tests for Python 3.8, 3.9. and 3.10 to match Modmail's workflow respectively.

It also bumps python version on the Dockerfile to 3.10 to match Modmail's, and additionally change from slim to alpine to further reduce image size.

Image size is reduced by ~50MB based on my testing. image

Have the changes in this PR been tested?

Yes

Additional Notes

This PR is also able to be merged alongside my other PR which adds feature enhancements.

Add page to view log list and several fixes

opened on 2022-12-16 17:59:33 by raidensakura

Description of the changes

This PR adds a new interface with pagination support to view list of recent logs plus a few other fixes.

To customize the amount of logs displayed per page (default is 25), add PAGINATION variable in your env with the amount of logs you want. (I recommend nothing more than 50)

View Demo (Viewable after logging in)

The demo is based on the patreon version of logviewer, some fields are replaced with placeholders on the normal logviewer

image

  • Fix #32
  • Fix #46
  • Fix #60
  • Fix #6
  • Update CSS for new log list page and its features (Required for new feature)

To access new log list page, click on the "Logviewer" header on main page. Log list page can be viewed on url set by your LOG_URL_PREFIX env (Default /logs)

Have the changes in this PR been tested?

Yes

Personal to-do

  • [x] Add pagination (look into find() skip= kwarg)
  • [x] Add search feature
  • [x] Add open and closed log filter

Fix System Icons when closing a thread v2

opened on 2022-10-17 16:03:37 by iamEvanYT

Repost of https://github.com/kyb3r/logviewer/pull/64 Sorry I aren’t really familiar with GitHub’s branch/commit system.

[BUG]Internal message toggle doesn't check toggle state

opened on 2022-09-13 10:26:57 by sebkuip

In logviewer, the toggle for internal messages only calls a function, and doesn't check the state of the toggle. This can lead to situations where the state of showing internal messages and the toggle state are not correctly showing. This for instance happens when internal messages were on, you click on an image within the thread, then use your browser's "back" function to go back to the transcript. This causes internal messages to be off, but the toggle remains on.

System Icon borked by Cloudflare Hotlink Protection

opened on 2022-03-07 19:55:05 by Wolftallemo

Discord enabled hotlink protection some time back, the system icon will no longer load since the origin is not discord.com or discordapp.com

https://github.com/kyb3r/logviewer/blob/31a91bbd6ef1513a9b1839e6a521c8c4315e54c3/core/models.py#L34

Fonts get CORS'd and don't load

opened on 2021-05-02 20:14:03 by Scotsguy

Example:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://discordapp.com/assets/e8acd7d9bf6207f99350ca9f9e23b168.woff. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://discord.com’).

Caused by: https://github.com/kyb3r/logviewer/blob/c1e85443d36b2ebded48483b18efe34f5ae5ec0d/static/css/logstyle.css#L7

Modmail

Modmail is a Discord bot that enables server staff to communicate seamlessly with users via a shared inbox, streamlining message exchanges.

GitHub Repository

discord discord-api discord-bot discord-modmail modmail modmail-bot python python3