Our current SDR online list: https://sdr-list.xyz/

Chatbox crash again....

Started by Bas ON5HB, Mar 13, 2025, 08:11 AM

Previous topic - Next topic

Bas ON5HB

We have to do something about the chatbox as some people put special characters in it and it crashes.

It does write the special characters, but can't read them.

We had this before.

Looks to me the problem is @HTML for messages? As they are able to put smileys in their chatmessage.
It is written in the chat-file, as I saw them. However, it makes the spectrumserver crash with a websocket error.

Seems to me we need to check the imput of users before it goes to the chatbox and file, as once written the spectrumserver crash and won't restart until the smileys are removed from the chatbox-file.
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Phil - NY4Q

I modded the sendMessage() function in App.svelte to what is below and it seems to be working. After further testing, I will add it to the App.svelte.

function sendMessage() {
    newMessage = newMessage.replace(/[^\x00-\x7F]/g, ""); // Strips non-ASCII
    if (newMessage.trim() && username.trim()) {
      const messageObject = {
        cmd: "chat",
        message: newMessage.trim(),
        username: username,
      };
      socket.send(JSON.stringify(messageObject));
      newMessage = "";
      scrollToBottom();
    }
  }

Bas ON5HB

Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Andy R3MAV

Quote from: Phil - NY4Q on Mar 14, 2025, 12:41 PMI modded the sendMessage() function in App.svelte
Phil, didn't these changes disable the ability to write not only in Latin? I try to write messages in Cyrillic and nothing is sent to the chat.
It's very disappointing. I want to use the chat, but it doesn't work.

Bas ON5HB

You can't strip non-ASCII, if you do non ACSII won't be accepted.

Are you sure the chatbox is crashing? As I modified the spectrum-server and since my server didn't crash.

I found that the buffer messages make it crash.

Maybe you have the same problem and it's NOT the chatbox, as I had weird crashes...some looked like the chatbox.

https://www.phantomsdr.fun/index.php?topic=182.msg1060#msg1060
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Bas ON5HB

Well my chatbox crashed again because some morron used smileys again.

Lets try the fix.

Starting to hate the chatbox in total :'(
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Bas ON5HB

#6
Quote from: Phil - NY4Q on Mar 14, 2025, 12:41 PMI modded the sendMessage() function in App.svelte to what is below and it seems to be working. After further testing, I will add it to the App.svelte.

function sendMessage() {
    newMessage = newMessage.replace(/[^\x00-\x7F]/g, ""); // Strips non-ASCII
    if (newMessage.trim() && username.trim()) {
      const messageObject = {
        cmd: "chat",
        message: newMessage.trim(),
        username: username,
      };
      socket.send(JSON.stringify(messageObject));
      newMessage = "";
      scrollToBottom();
    }
  }


It seems to remove too much, so I changed the filter to UNICODE. Testing at the moment:

newMessage = newMessage.replace(/[\u{33F0}-\u{FFFF}]/gu, ""); // Strips new version ON5HB - Unicode
As several people complained they can't use German characters. Hopefully Unicode solves this.

https://en.wikipedia.org/wiki/List_of_Unicode_characters

Hopefully no more weird stuff but all unicode accepted.
Best regards,

Bas ON5HB

Ps. the Community Edition can be found here: https://github.com/ny4qphil/PhantomSDR-Plus

Phil - NY4Q

Bas' new technique for the chatbox is now added to the current git App.svelte.

Powered by EzPortal