Best way to add Discord webhook logs to vMenu codebase?

Greetings!

I wanted to get the opinion of other developers on an approach of adding Discord webhook logging to the vMenu resource. Considering the menu is mainly on the client side, how do we suppose we could add Discord webhook logging to this that would be safe?

Trying to add it in the safest way possible so it cannot be abused by the client, but am kind of at a loss. Maybe someone has a good idea :sweat_smile:

Best Regards,
Badger :badger:

1 Like

Hm pretty decent challenge this one. I feel there could be a couple approaches.

This is me throwing some ideas here. None of this is like me saying “you should or it’s better to do it this way”. I’m going to start off with one idea and if I come up with anymore ideas I will post it here.

With the menu being mainly client based I would definitely maybe work with maybe rate limiting a logger server event and it would rate each client individually? I know it would be a little extra work to handle rate limiting but it could definitely stop a client from spamming the logger cause they’d only be able to call it so many times within a certain time. Which you would probably catch the exploiter right away just from the initial few spam logs they send.

You could probably make a manager of some sort to handle that on your server.

Would also have the option to notify when a user has been rate limited which could also be a good way to catch someone exploiting your logger.

2 Likes

Hmm, not a bad idea… Maybe some sort of queue to send the Discord webhook messages, then can just find out who is abusing the logger as well. The only thing I don’t like about this approach is we give access to the webhook to the client by usage of a server-side event still… :grimacing:

1 Like

Building off @xander1998’s idea; personally, I’d go for a queue approach, working on the assumption you are not after time-critical logging (i.e. someone is using god mode right now), and just want historical logging.

The clients would fire events to the server anytime they did something you want to be logged.
On the server, you’d create a list that gets populated with events reported by the clients.
On adding entries to the list, you could include a timestamp to use in comparison against new events to check for duplicates, or just disregard duplicates based on event name or something, whatever you wanted to do.

On the server, you’d have a loop executing every X minutes (depends on how busy the server is I suppose; every 5 minutes is probably not a bad idea). Inside the loop you’d clone the list and then empty it out so no entries and missed. Then iterate over the cloned list and create a text list of events (aiming for something like this: https://embed-table.treefarmer.xyz/), then push that to your webhook.

My two cents.

1 Like

I have started with the queue implementation :smile: @ChristopherM @xander1998

I also figured it may be a good idea to limit the webhook messages being sent to a specific format set by the user, so it would be more difficult for people to send whatever they want to in the message. You can view the latest commit below :sweat_smile:

2 Likes

Awesome! Glad that something came out of this post!

I’ll check out your commit!

1 Like

How Do I get my hands on a working version of vmenu inclusing this code?

It is still being worked on

Did this ever get completed? Would love to have this!

1 Like

Still working on it. It stinks because once I make changes here and there, then I get merge conflicts since it’s such a contributed to project :sweat_smile:

completed yet??

Still being worked on. I will post here when it is completed.

Any Updates?