ord icon indicating copy to clipboard operation
ord copied to clipboard

Repair Inscription Previews in Discord

Open batcavekid opened this issue 2 years ago • 4 comments

Previously, posting links in Discord would preview the image or raw content.

Now it seems to show only the Ordinals logo as a placeholder.

Seen various filetypes, including png, which previously worked.

batcavekid avatar Feb 08 '23 10:02 batcavekid

We changed that because it was too difficult to support all the different content types in preview. Maybe we can get that to work again.

raphjaph avatar Feb 08 '23 22:02 raphjaph

Taking screenshots would be a great option, and works for all content types. @huumn (creator of Stacker News) do you have advice on this? SN social media previews always so fresh ✨ Taking screenshots requires a headless browser, which can get heavy, so we should keep build time, binary size, dependency count, in mind. The site is so simple though that a pure-rust renderer may be an option. Although many of the previews do use JS.

casey avatar Feb 08 '23 23:02 casey

You could inspect mime type and return the inscription as a preview in cases where it makes sense and fall back to something generic.

For SN I do run a headless chrome browser (puppeteer). It's very heavy/memory intensive. I have a global rate limit per server and have an expiring cache of screenshots in block storage. If there isn't a recent screenshot in the cache, I screenshot the page on the spot and stream it back as a png.

huumn avatar Feb 08 '23 23:02 huumn

You could inspect mime type and return the inscription as a preview in cases where it makes sense and fall back to something generic.

This sounds perfect.

batcavekid avatar Feb 08 '23 23:02 batcavekid