From 8aeca230bc1a91695a6a8c8f2f2b1fa567090b37 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Wed, 8 Jul 2026 18:21:57 +0000 Subject: [PATCH] Fix TTS overlap deterministically, preserve message order, fix flaky Google login button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Overlay display duration is now computed server-side from estimated reading time (text length / speaking rate), not from the audio element's 'ended' event — edge-tts streams MP3 without a duration header, and OBS's embedded browser fires 'ended' unreliably for that, which is why the earlier event-based fix didn't hold up. Per-streamer broadcasts are now serialized through a queue, so a message waiting on an AI reply can no longer be overtaken by a later message from a different viewer that doesn't need one. Also fix the Google Sign-In button intermittently not rendering: the GSI script tag is async/defer, and both index.html and send.html/js called google.accounts.id.initialize() without waiting for it to actually finish loading — a race that failed silently until the script was cached from a previous load. --- ai-prompt.txt | 2 +- public/index.html | 11 +++++++- public/overlay.js | 64 +++++++++++------------------------------------ public/send.html | 5 +++- public/send.js | 6 +++++ server.js | 59 ++++++++++++++++++++++++++++++++----------- 6 files changed, 81 insertions(+), 66 deletions(-) diff --git a/ai-prompt.txt b/ai-prompt.txt index 410db4a..e110fb4 100644 --- a/ai-prompt.txt +++ b/ai-prompt.txt @@ -5,5 +5,5 @@ При этом старайся шутить. Не допускать матных слов. Можешь дерзить в ответе. -Очень редко упоминай милых котиков если в тему. +Очень редко упоминай милых котиков или песиков или тапибар если в тему. Защищай стримера, но только если есть агрессия в его адрес и если его хотят обидеть. diff --git a/public/index.html b/public/index.html index 3ade89e..646fe50 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,10 @@ Send2Streamer — сообщения от зрителей прямо на стрим - + +