Generate link previews as an image
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
previewer
LICENSE
NOTES.md
Procfile
README.md
app.json
app.py
requirements.txt
runtime.txt

README.md

Previewer

Previewer is a quick hack around Mattermost’s inability to show previews for links other than images and YouTube videos. It’s like a proxy for your links: it acts as an image for Mattermost but will redirect any “normal” user to the original link.

Deploy

Run

Previewer requires Python 3.x. Install its dependencies:

pip install -r requirements.txt

Then run the app:

gunicorn app:app

Check gunicorn’s options for ports and more. There’s also Procfile and runtime.txt files for quick deployment on Heroku & friends (I use Flynn).

Usage

You have to build URLs by hand for now. Prepend <your previewer hostname> to your URL, and append /p.png at its end. Be careful that if your original URLs has parameter you need to put the /p.png before them.

Examples

In the examples below we assume you deployed your instance at http://p.example.com:

  • https://www.google.com -> http://p.example.com/https://www.google.com/p.png
  • https://www.youtube.com/watch?v=Sagg08DrO5U -> http://p.example.com/https://www.youtube.com/watch/p.png?v=Sagg08DrO5U
  • https://news.ycombinator.com/item?id=14068363 -> http://p.example.com/https://news.ycombinator.com/item/p.png?id=14068363

How it works.

See my blog post.