Earu / EasyChat

A modular Garry's Mod chat addon for both users and developers. (EOL 2025)
https://steamcommunity.com/sharedfiles/filedetails/?id=1182471500
GNU General Public License v3.0
90 stars 31 forks source link

URLs in chat #75

Closed KyleNaCl closed 3 years ago

KyleNaCl commented 3 years ago

For some reason, sending links in chat as a random chance of crashing people's games.

Would there be a way to implement a convar to disable image embed'ing entirely? instead of forcing the convar of people's games to disable clientside?

I currently force this to be false to fix, but when you guys update the file again, i have to re-patch it https://github.com/Earu/EasyChat/blob/de9c17a4421322cb15fcd53bef2af7eedf7f3ae3/lua/easychat/easychat.lua#L1540

Earu commented 3 years ago

Hey! I’m fairly sure there are convars for this, If you go in settings, chathud, and look for image there should be a setting to disable it.

if you have them it’d be cool to see a crash dump where a client crashed from this problem, so I can try and see what I can do to patch it. Thanks!

EDIT: Does it happen when the image displays or when someone clicks it? EDIT 2: Are you on the main branch or on the x64? EDIT 3: I can't seem to reproduce the problem at all, I spammed a bunch of images in the chat on both the normal branch and the x64 one. Tried opening images as well no luck.

KyleNaCl commented 3 years ago

I seen a clientside convar for images, but the issue is that's auto-enabled for everyone. I was asking about a sync'ed serversided convar to disabled the embed entirely regardless of the client's settngs

Looking thru my crash dumps, it seems to not create a dump. The game just closes.

I think the reason you can't reproduce it is, this only happens when a link is sent thru our relay chat from discord. The relay addon just uses chat.AddText() when a message is received.

Earu commented 3 years ago

Is the relay code public? So that I can look into it further?

About the convar, the general policy for easychat is to let users choose what they want over servers locking players into something specific. If you really need the convar to be turned off for everyone though there is an easy solution without having to touch the repo at all.

You could create a folder in your addons folder and then under folder/lua/autorun/easychat/modules/client you could have this code:

hook.Add("ECPostLoadModules", "img_fixer", function()
  local cvar = GetConVar("easychat_tag_image")
  if not cvar then return end
  cvar:SetBool(false)
end)
return "image crash fixer"
KyleNaCl commented 3 years ago

The Relay is from gmodstore.com, its called "Trixter's Discord Integration"

Here is the exact function used within the addon for the chat.AddText from the addon, its just a simple net.Receive

if CLIENT then
    function Discord:Chat(...)
        chat.AddText(Color(114, 137, 255), '[Discord] ', Color(255, 255, 255), ...)
    end

    net.Receive('Discord_Chat', function(len, ply)
        Discord:Chat(net.ReadString())
    end)
end

And I didn't even think of making a custom module within easyChat, thank you

Earu commented 3 years ago

BTW does posting the same image crash you or is it random?

KyleNaCl commented 3 years ago

It's completely random, and only happens to some players. My first thought is that it could be from the image being too high quality and causes some kind of memory overflow.

Earu commented 3 years ago

As it stands there's not much I can do to check whether an image will cause the game to crash or not. I suspect it has to do with the material renderer trying to render chromium/awesomium and having issues with it. Since I can't seem to reproduce this issue reliably I can't really debug it either. I suggest you open an issue for this on the Garry's Mod repo. https://github.com/Facepunch/garrysmod-issues