Fix: update to work with authentificated media feature of synapse (thumbnails are not displaying, not saved into `thumbnails` directory)
Only stickers are saved, thumbnails are not saved to the "thumbnails" directory which results in 404 error
Yes I tried mstickereditor set-widget but it does not work — it simply resets the stickers widget to default and when I click "add stickers" it displays "Failed to load extension" What am I doing wrong? widgeturl is stickerpicker url right? it's on subpath
I do see thumbnails referenced in thumbnail_url in my local_thumbnails media storage on server, so they are actually saved correctly However stickerpicker's widget expects thumbnails to be in "thumbnails" subdirectory in the "web" folder
Looks like you made a type in set-widget command
It writes stype in the event content instead of type
https://github.com/LuckyTurtleDev/mstickereditor/blob/c84aa147ef72e1c05a74daf6346f04140b26496b/mstickerlib/src/matrix/stickerpicker.rs#L15
Which causes this error in integrations webview: Failed to get sticker picker: TypeError: Cannot read properties of undefined (reading 'type')
But that's unrelated to this issue, just was wondering how your set-widget command is different from this guide
Ok looks like it's related to this:
As of March 2025, maunium-stickerpicker works around Matrix's authenticated media requirements by hosting thumbnails of stickers next to the sticker pack metadata. To update old packs, you can run sticker-download-thumbnails path/to/pack.json, which will download all the media using your access token and store thumbnails in the thumbnails directory next to the pack JSON. The thumbnails should then be served along with the JSON files (if using GitHub pages, just commit the images).
I confirmed this by running sticker-download-thumbnails. So the order of commands is as following:
- build mstickereditor and add its bin from local .cargo directory to $PATH, create config file for mstickereditor
- cd into the stickerpicker directory
source .venv/bin/activatecd web/packsmstickereditor import t.me/addstickers/my-stickerpackmstickereditor create-indexsticker-download-thumbnails ./my-stickerpack.json
Also apparently if you use delegation you are still supposed to write your actual matrix domain and not the part in username when asked for "Homeserver URL"
Would be nice if you make this project store thumbnails this way too! Especially if you can make it put scaled version of the image (32x32 px) because currently pulled thumbnails from these packs are in max res, 512x512 which really slows down downloading
maunium's sticker-download-thumbnails script unfortunanely does not work with animated gifs and transparent images, I'm wondering if it'd be easier to modify this project's code especially because thumbnail generator is already present, just not configured to write into current directory. I did sent a PR into their repository but now I'll look what I can do there
For anyone coming here in future I fixed the thumbnails problem and added stickers resizing to 64x64 in preview window and to 256x256 in the dialogue. I also made all previews playable by using sticker converted data in thumbnail, not telegram's provided sticker thumbnail. I'm not a rust developer so I won't make a PR but as a dirty quick fix you can use my git commits patch files. Keep in mind that for 0001-Resize-stickers-before-upload-to-.-thumbnails-direct.patch you will need to run cargo add photon-rs in mstickerlib directory
0001-Fix-set-widget-command.patch 0001-Resize-stickers-before-upload-to-.-thumbnails-direct.patch
Also you need to modify stickerpicker/web/src/index.js file: Modify line 380 by replacing img src with:
<img src=${makeThumbnailURL(pack.stickers[0].info?.thumbnail_url || pack.stickers[0].url)} alt=${pack.stickers[0].body} class="visible" />
@VityaSchel Thanks for your patch, it works for me