coffeebank / coffee-maubot

Matrix bot plugins for Maubot 🍢 Add link previews, choose, and other tools to your Matrix chat ☕
https://coffeebank.github.io/coffee-maubot
11 stars 5 forks source link

urlpreview: don't duplicate previews when message is edited #18

Open ajkessel opened 1 year ago

ajkessel commented 1 year ago

Currently, if a preview has been generated, and the user edits the message that triggered the preview, urlpreview sends the preview again. Ideally, urlpreview would never send the same preview multiple times (this would be useful even when a message is not edited -- for example, if someone responds to a message with the same link for some reason). An alternative would be to not generate previews on edited messages, or not generate previews unless the hyperlink in the message has been edited.

ajkessel commented 3 months ago

Here's a patch that keeps track of URLs that have already been previewed to the room in connection with a particular message, and skips re-generating the preview if already done. urlpreview-cache.patch