szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.65k stars 163 forks source link

Add embedding for media #139

Closed enoxitus closed 1 year ago

enoxitus commented 1 year ago

It would be really cool if I could upload an image or video, post the link somewhere and have it embed it automatically e.g on discord. This works if I copy the link to the exact file, but then depending on the file name this can be a large URL.

Example:

To achieve this currently, it would look like:

Hopefully it's understandable what I meant!

szabodanika commented 1 year ago

This would really be useful as I myself use MicroBin over Discord a lot. The issue is that Discord uses a bot to visit the URL and takes the first image. Because there is no image displayed at https://url.com/monkey-dog-fox, it has nothing to show in the chat. What we could easily do is displaying image and video files on the pasta page instead of just making them downloadable, this would make MicroBin itself more user friendly, and it would help in use cases like this one as well.

szabodanika commented 1 year ago

Related: #58

flamion commented 1 year ago

I think it would be enough to set a few fields in the HTML header. There are fields that tell crawlers what to embed. A website for generating links that do something similar is stolen.shoes, if the link is pasted into discord or some other platform that looks for these fields it will embed the resource properly, but with stolen.shoes if the link is opened in the browser it will display something else (like the normal site). image

Example link