#4239 create cgit lua filter for libravatar
Closed: Fixed None Opened 10 years ago by kevin.

The new version of cgit (0.10) has a way to run lua filter scripts really well.

They provide a example script to email-filter that shows gravatars.

This script won't work for us because it needs luacrypto which is not packaged. Also, we prefer libravatar for all our avatar needs.

So, write a lua script that can be used by cgit as a email-filter that shows libravatar avatars.

The upstream script can be seen at:
http://git.zx2c4.com/cgit/tree/filters/email-gravatar.lua

Any script we come up with for libravatar could be contibuted upstream as well.


We'll still need to compute an md5 hash in order to use libravatar. Either another package will need to be used, or we'll need to package luacrypto.

lua-md5 is packaged... I would think that would be the one to move to.

This will maybe do it, maybe. Can we try it?
libravatar.lua

I think this will work.

Sadly doesn't seem to. ;(

Doesn't error, just doesn't output anything...

There appears to also be a python version of the script. It might be easier to adapt that one rather than the LUA one, as it appears to be causing issues. https://github.com/zx2c4/cgit/blob/8ae1d8b8fd0b097b10716d0d2d8acaadbd7a46f7/filters/email-gravatar.py

There doesn't appear to be anything wrong with the version submitted by ralph (I mocked out the html method and ran the code and it outputted the html correctly).

ported upstream gravatar python plugin to python2 and libravatar
email-libravatar.py

I ported the python plugin to python2 (upstream's is python3 only) and to libravatar from gravatar.

Upstream warns that it will be slow, though. Perhaps we try it out and see just how slow?

The python2 one above does work and doesn't seem all that slow, so we can just go with that.

I can't seem to get the lua one working at all, even though I agree it seems fine from a command line/test env. It has to be something with cgit's lua interface not working right in rhel6. ;(

Got the lua one working. It was config error on my part with cgit. ;(

Used a script kernel.org uses that includes a larger image on hover. ;)

Everything is rolled out and working now. ;) thanks for the help everyone.

Login to comment on this ticket.

Metadata