ord
ord copied to clipboard
Repair Inscription Previews in Discord
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.
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.
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.
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.
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.