GithubHelp home page GithubHelp logo

modmail-dev / logviewer Goto Github PK

View Code? Open in Web Editor NEW
86.0 4.0 1.3K 444 KB

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.

License: GNU General Public License v3.0

Python 36.29% CSS 30.65% HTML 32.23% Dockerfile 0.70% Shell 0.07% Procfile 0.05%
discord discord-api discord-bot discord-modmail modmail modmail-bot python python3

logviewer's Issues

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

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.

Website not safe?

I have loved the bot and logviewer until I tested the bot and went to go check the logs on the website but then it showed up as not being safe. I just hope it didn't steal my information
Screen Shot 2021-08-27 at 10 17 15 PM

[SUGGESTION] A logviewer for various modmail bots

I have found a free logviewer host that is quite simple and easy to use. The only inconvenience is that you can only host one app in its free version. This is https://www.fl0.com/ in case you want to do some research about this host.

I don't know how easy it would be to do this, an example of what could be done is that the environment variables are:
"client_id"="mongo_uri"
and the url
https://host.app/logs/client_id/thread_id

This suggestion would be appreciated by those of us who host several modmail clients and moderation of Discord servers.

I get this error in terminal

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/sanic/app.py", line 937, in handle_request
response = await response
File "app.py", line 53, in index
return render_template("index")
File "app.py", line 33, in render_template
kwargs["session"] = request["session"]
TypeError: 'Request' object is not subscriptable

Oauth whitelist ignores roles when using multiple servers

We have a split server system for our ModMail bot, one for the users and one for the staff.

I ran the oauth whitelist command to add our Ticket Team role access, however when attempting to access the logs, it still gave an unauthorized message until I individually added each user.

Add password protection

Hi, can you please add config option to set PASSWORD in .env, when you want to show log you need to enter that password from .env. This would be to protect showing logs to unwanted people if you are not patreon to have oauth.

Suggestion: Marked NSFW modmail threads should be marked as NSFW on the logs

Is your feature request related to a problem? Please describe.
Not really. I like to review what the support team has answered when I was not active, and sometimes when I open the ticket logs I see things I cannot unsee now.

Describe the solution you'd like
If a modmail thread is marked as NSFW while it's open, the log sent to the log channel should indicate there's NSFW on that thread log.

Who will this benefit
I guess everyone who has access to the logs can benefit as they will know if there's something not safe in the ticket before opening it.

Log viewer hosted on Heroku suddenly doesn't start.

This is what gets output to the Heroku logs:

2020-10-06T20:23:01.819134+00:00 heroku[worker.1]: State changed from crashed to starting
2020-10-06T20:23:05.573131+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2020-10-06T20:23:06.173901+00:00 heroku[worker.1]: State changed from starting to up
2020-10-06T20:23:08.311811+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[117] - INFO: -------------------------
2020-10-06T20:23:08.311999+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[125] - INFO: Logging level: INFO
2020-10-06T20:23:08.312118+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[127] - INFO: Log file: /app/temp/NzM2NzE0NDkyODAwNTMyNTMx.log
2020-10-06T20:23:08.312476+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[91] - INFO: -------------------------
2020-10-06T20:23:08.312723+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[92] - INFO: ┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬
2020-10-06T20:23:08.312921+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[93] - INFO: ││││ │ │││││├─┤││
2020-10-06T20:23:08.313110+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[94] - INFO: ┴ ┴└─┘─┴┘┴ ┴┴ ┴┴┴─┘
2020-10-06T20:23:08.313297+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[95] - INFO: v3.5.0
2020-10-06T20:23:08.313489+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[96] - INFO: Authors: kyb3r, fourjr, Taaku18
2020-10-06T20:23:08.313665+00:00 app[worker.1]: 10/06/20 20:23:08 __main__[97] - INFO: -------------------------
2020-10-06T20:23:08.984641+00:00 app[worker.1]: 10/06/20 20:23:08 core.clients[156] - WARNING: You're using the old config MONGO_URI, consider switching to the new CONNECTION_URI config.
2020-10-06T20:23:11.023211+00:00 app[worker.1]: 10/06/20 20:23:11 cogs.utility[606] - INFO: -------------------------
2020-10-06T20:23:11.023769+00:00 app[worker.1]: 10/06/20 20:23:11 cogs.utility[617] - INFO: No activity has been set.
2020-10-06T20:23:11.024026+00:00 app[worker.1]: 10/06/20 20:23:11 cogs.utility[622] - INFO: No status has been set.
2020-10-06T20:23:11.024308+00:00 app[worker.1]: 10/06/20 20:23:11 __main__[388] - ERROR: Logging out due to invalid GUILD_ID.
2020-10-06T20:23:11.132953+00:00 app[worker.1]: 10/06/20 20:23:11 cogs.plugins[143] - ERROR: Error when loading plugin officialpiyush/modmail-plugins/giveaway@master. Plugin removed from config.
2020-10-06T20:23:11.132954+00:00 app[worker.1]: Traceback (most recent call last):
2020-10-06T20:23:11.132954+00:00 app[worker.1]:   File "/app/cogs/plugins.py", line 136, in initial_load_plugins
2020-10-06T20:23:11.132955+00:00 app[worker.1]:     await self.download_plugin(plugin)
2020-10-06T20:23:11.132955+00:00 app[worker.1]:   File "/app/cogs/plugins.py", line 166, in download_plugin
2020-10-06T20:23:11.132955+00:00 app[worker.1]:     async with self.bot.session.get(plugin.url, headers=headers) as resp:
2020-10-06T20:23:11.132956+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
2020-10-06T20:23:11.132956+00:00 app[worker.1]:     self._resp = await self._coro
2020-10-06T20:23:11.132956+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
2020-10-06T20:23:11.132957+00:00 app[worker.1]:     timeout=real_timeout
2020-10-06T20:23:11.132958+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
2020-10-06T20:23:11.132958+00:00 app[worker.1]:     proto = await self._create_connection(req, traces, timeout)
2020-10-06T20:23:11.132958+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
2020-10-06T20:23:11.132958+00:00 app[worker.1]:     req, traces, timeout)
2020-10-06T20:23:11.132959+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
2020-10-06T20:23:11.132959+00:00 app[worker.1]:     req=req, client_error=client_error)
2020-10-06T20:23:11.132959+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
2020-10-06T20:23:11.132960+00:00 app[worker.1]:     return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
2020-10-06T20:23:11.132960+00:00 app[worker.1]:   File "uvloop/loop.pyx", line 2019, in create_connection
2020-10-06T20:23:11.132960+00:00 app[worker.1]:   File "uvloop/loop.pyx", line 2014, in uvloop.loop.Loop.create_connection
2020-10-06T20:23:11.132960+00:00 app[worker.1]: concurrent.futures._base.CancelledError
2020-10-06T20:23:11.134899+00:00 app[worker.1]: 10/06/20 20:23:11 __main__[178] - ERROR:  - Shutting down bot - 
2020-10-06T20:23:11.605072+00:00 heroku[worker.1]: Process exited with status 0
2020-10-06T20:23:11.633285+00:00 heroku[worker.1]: State changed from up to crashed

I hadn't changed anything since I initially set it up and it was working. However, nowadays, the bot.py worker is asking me for the bot's token (in a separate instance not in this log), which I find weird... anyway, I put the TOKEN in as a config var and this showed up. I can't quite figure out what the error is. Thanks in advance! TBF, it kinda looks like this is the worker for the bot and not the logs...

Onerror handler for lazy loading images repeats with no delay or cap

While experiencing some local network issues I discovered a potential issue with the lazy-loading feature for avatars within modmail logs.

                 onerror="this.src='{{ log_entry.recipient.default_avatar_url }}'"

Doesn't have a retry limit or retry cap, so despite the network requests failing with "ERR_NOT_REACHABLE" It continued to retry for the default avatar with millisecond delay times, counting up requests in the thousands/second, multiplied by the number of avatars present within the log.

You can reproduce the issue by blocking access to cdn.discordapp.com and loading a modmail log with the browser network panel open.

                 onerror="this.src='{{ log_entry.recipient.default_avatar_url }}';this.onerror=null"

Would reduce it to a single attempt to load the default avatar before failing and leaving the space with a broken image.

NSFW Thread Warning

If a thread was marked as NSFW, when opening in the logviewer, make it display a warning to potential viewers.

Outdated

When it gets to the add an application stage, idk what do do.

Add a "Copy messageLink"

Add a "Copy messageLink" button inside the modmail logs for each message, for if a report to discord has to be made so a messagelink always can be found/retrieved.

having issue with running the logviewer

Hello I am having issues trying to run the bot and I think it's because it want to use Python 3.9 but we are now on Python3.11 by default.

I was wondering cause the Modmail bot is working fine and I see that it has been updated but not this logviewer... is there a possibility to update it ?

Getting DM Channel ID & DM Message Jumplinks

Is your feature request related to a problem? Please describe.
Some modmail DM messages need to be reported to Discord Trust and Safety. To make a report, we require jump links to the message(s) specifically as references so the T&S team can verify anything they need to.

There doesn't appear to be a simple way to get the jump link for a specific message, or at least the DM channel ID in order to build a jump link by hand.

There is the ability to eval it with some work, but that's reliant on enabling it and having the correct perms to be able to use it, which makes it not a suitable solution.

Describe the solution you'd like
I'd like to have a ?jumplink <message_id> command, and optionally, the DM channel ID to be displayed in the initial thread embed footer.

You could possibly also make the channel ID and jumplinks available in the logviewer.

Describe alternatives you've considered
Eval is the only alternative I could think of, which I've outlined in the description.

Who will this benefit
I do think it could benefit a large portion of users, enabling easy jumplink generation for reports. I suspect a lot of people are either relying on eval, or perhaps choose to disregard reporting because of the hurdle of getting the necessary info.

Deleted Message Indicator in Logs

Once a log is closed if a message was deleted (not wiped) it would have a symbol to indicate it was deleted, maybe if hovered over, it would show who deleted it. (Transferred from modmail#253 Please view that issue for the full conversation.)

suggestion add time/date format

right now it only show post msg x weeks ago

let us change the time format to date/years at our choosing and then weeks.
add following date format
MM/DD/YY
DD/MM/YY
YY/MM/DD
Month D, Yr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.