mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description Hi, This PR adds support for displaying gzipped Lottie files, such as `.tgs` (Telegram sticker) files. Demo video: <img width="640" height="694" alt="demo" src="https://github.com/user-attachments/assets/0941b014-8031-4a78-85ff-c62c90afb877" /> ## How it works Gzipped files begin with a fixed byte sequence (`1f 8b`), which distinguishes them from standard image formats (PNG, WebP, JPG). The implementation detects this signature in the file header and automatically decompresses gzipped content before parsing it as Lottie JSON. If parsing succeeds, the decompressed animation is passed to the Lottie player. To test this feature, download and unzip [AnimatedSticker.tgs.zip](https://github.com/user-attachments/files/30024283/AnimatedSticker.tgs.zip), then send it as `m.image` or `m.sticker`. ## What I have tested - [x] Works as `m.image`, `m.sticker`, and inline emoji on Chrome - [x] Works as `m.image` and `m.sticker` on Safari - [x] Functions correctly in sticker and emoji picker on both browsers ## Next steps - [ ] Fix inline Lottie emoji width on Safari - [ ] Respect `autoplayStickers` setting when rendering stickers (set `autoplay={false}` in DotLottieReact) - [ ] Respect `autoplayEmojis` setting when rendering emojis (set `autoplay={false}` in DotLottieReact) --- #### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings ### AI disclosure: - [x] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->