morethanwords/tweb/master • a5c7327 • 1 files, +42/-19 Fix video streaming edge cases in service wor

Telegram github commits and releases

Telegram github commits and releases

@tgappsupdates

Broadcast from the most important Telegram clients' repositories

4 538 підписників
Відкрити в Telegram
morethanwords/tweb/mastera5c73271 files, +42/-19
Fix video streaming edge cases in service worker

- Fall back to the worker on any cache read error (incl. a bare cache
timeout that rejects with undefined) instead of throwing TypeError on
error.type and killing the range request
- Preload the file's last chunk at start (moov/bounds) instead of chunk 0
- Treat PRELOAD_SIZE as a read-ahead window from the current position
rather than an absolute end offset (read-ahead was dead past 20MB)
- Align the preload window start to the chunk grid so preloaded offsets
stay valid MTProto offsets
- Gate the second range part on overflow > 0 (a byte count was used as a
boolean, so a negative value forced a wasteful extra chunk fetch)
- Clamp limit to a server-valid minimum (4KB) to avoid LIMIT_INVALID on
tiny ranges; make SMALLEST_CHUNK_LIMIT a valid 4KB and use it
- Don't resurrect a destroyed stream from toggleStreamInUse(false); clamp
inUse at 0 to stop zombie streams leaking in the map
- Re-arm the idle debounce instead of destroying a stream still bound to
a live <video>
- Swallow rejections from best-effort cache writes and fire-and-forget
preloads to avoid unhandled rejections
- Use Math.clz32 in alignLimit to drop the Math.log FP rounding; remove
the unused Response-Time header

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

morethanwords/tweb/master99de4a82 files, +30/-4
Fix rich-text paste/serialization of newlines around blockquotes

Three related fixes in the contenteditable rich-text path:

- getRichValueWithCaret paste reconciliation: the re-insertion pass used a
drifting offset threshold (`offset > plainTextLength - lineIndex + 1`) that
was only correct for one line index, shifting/losing entities on multi-line
formatted pastes (e.g. a second line in bold). Use the splice index directly
and adjust entity length, not just offset, in both removal and insertion.

- Paste handler: strip messageEntityLinebreak before insertRichTextAsHTML.
wrapDraftText renders line breaks from the text itself; passing explicit
linebreak entities made wrapRichText slice the one before a blockquote,
dropping a \n on e.g. `text\n\nquote`. Stripping them aligns paste with the
edit/draft path (verified: no extra blank line, model preserves both \n).

- getRichElementValue: a multiline blockquote built from block children
(<br>/<div>, what Enter produces) lost its last character outside the quote,
because the entity length is only grown by text nodes while block-generated
\n bypass it. Track the last real-content offset and re-span the blockquote
up to it, excluding trailing block line breaks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

#webk
Відкрити пост в Telegram