From 7c15ebbb3615dee14b68b5bab4aafaea60c36894 Mon Sep 17 00:00:00 2001 From: Luke Policinski Date: Mon, 28 Sep 2026 15:42:25 -0400 Subject: [PATCH 1/4] bug: 2000-character chat cap and chat send errors The api now refuses a website chat message over 2000 characters and tells the sender why with chat:error. The chat box refuses an over-length message up front, keeps the text, and counts down over the last 200 characters. chat:error codes become a toast; not_allowed and unknown codes read as a failed send. ChatMessage compares sender steam ids as strings, since new messages carry a string steam_id and older history can carry a number. --- components/chat/ChatInput.vue | 29 +++++++- components/chat/ChatMessage.vue | 7 +- constants/chat.ts | 3 + i18n/locales/ar_SA.json | 2 + i18n/locales/da_DK.json | 2 + i18n/locales/de_DE.json | 2 + i18n/locales/en.json | 2 + i18n/locales/es_ES.json | 2 + i18n/locales/fr_FR.json | 2 + i18n/locales/it_IT.json | 2 + i18n/locales/ja_JP.json | 2 + i18n/locales/ko_KR.json | 2 + i18n/locales/pl_PL.json | 2 + i18n/locales/pt_BR.json | 2 + i18n/locales/ru_RU.json | 2 + i18n/locales/sv_SE.json | 2 + i18n/locales/tr_TR.json | 2 + i18n/locales/uk_UA.json | 2 + i18n/locales/zh_Hans.json | 2 + i18n/locales/zh_Hant.json | 2 + tests/components/ChatInput.spec.ts | 109 +++++++++++++++++++++++++++++ tests/utilities/chatErrors.spec.ts | 44 ++++++++++++ tests/web-sockets/Socket.spec.ts | 36 ++++++++++ utilities/chatErrors.ts | 37 ++++++++++ web-sockets/Socket.ts | 4 ++ 25 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 constants/chat.ts create mode 100644 tests/components/ChatInput.spec.ts create mode 100644 tests/utilities/chatErrors.spec.ts create mode 100644 tests/web-sockets/Socket.spec.ts create mode 100644 utilities/chatErrors.ts diff --git a/components/chat/ChatInput.vue b/components/chat/ChatInput.vue index 984906fb4..a2d97b380 100644 --- a/components/chat/ChatInput.vue +++ b/components/chat/ChatInput.vue @@ -127,6 +127,17 @@ const fieldName = `chat-message-${Math.random().toString(36).slice(2, 10)}`; ]" @keydown.enter="onEnter" /> + + {{ remainingCharacters }} +