List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/1] filter: add libravatar email-filter lua script
@ 2014-03-13 10:55 mail
  2014-03-13 10:58 ` Jason
  2014-03-14 15:37 ` kernel.org's libravatar " mricon
  0 siblings, 2 replies; 10+ messages in thread
From: mail @ 2014-03-13 10:55 UTC (permalink / raw)


---
 filters/email-libravatar.lua | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 filters/email-libravatar.lua

diff --git a/filters/email-libravatar.lua b/filters/email-libravatar.lua
new file mode 100644
index 0000000..a248be4
--- /dev/null
+++ b/filters/email-libravatar.lua
@@ -0,0 +1,26 @@
+-- This script may be used with the email-filter or repo.email-filter settings in cgitrc.
+-- It adds libravatar icons to author names. It is designed to be used with the lua:
+-- prefix in filters.
+--
+-- Requirements:
+-- 	luacrypto >= 0.3
+-- 	<http://mkottman.github.io/luacrypto/>
+--
+
+local crypto = require("crypto")
+
+function filter_open(email, page)
+	buffer = ""
+	md5 = crypto.digest("md5", email:sub(2, -2):lower())
+end
+
+function filter_close()
+	html("<img src='//cdn.libravatar.org/avatar/" .. md5 .. "?s=13&amp;d=retro' width='13' height='13' alt='Libravatar' /> " .. buffer)
+	return 0
+end
+
+function filter_write(str)
+	buffer = buffer .. str
+end
+
+
-- 
1.9.0



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/1] filter: add libravatar email-filter lua script
  2014-03-13 10:55 [PATCH 1/1] filter: add libravatar email-filter lua script mail
@ 2014-03-13 10:58 ` Jason
  2014-03-13 11:01   ` mail
  2014-03-14 15:37 ` kernel.org's libravatar " mricon
  1 sibling, 1 reply; 10+ messages in thread
From: Jason @ 2014-03-13 10:58 UTC (permalink / raw)


Cool! Merged to master.

What's the story with Libravatar? The FLOSS version? Do they bootstrap
from Gravatar or is it a totally different database?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/1] filter: add libravatar email-filter lua script
  2014-03-13 10:58 ` Jason
@ 2014-03-13 11:01   ` mail
  0 siblings, 0 replies; 10+ messages in thread
From: mail @ 2014-03-13 11:01 UTC (permalink / raw)


"Jason A. Donenfeld" <Jason at zx2c4.com> on Thu, 2014/03/13 04:58:
> Cool! Merged to master.

Cool, thanks!

> What's the story with Libravatar? The FLOSS version?

Yes, it is. Source code is available.

> Do they bootstrap
> from Gravatar or is it a totally different database?

It's a different database, though they send a 302 redirect to gravatar if no
libravatar icon is available.
-- 
Schoene Gruesse
Chris
                         O< ascii ribbon campaign
                   stop html mail - www.asciiribbon.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140313/6f6d9495/attachment.asc>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-13 10:55 [PATCH 1/1] filter: add libravatar email-filter lua script mail
  2014-03-13 10:58 ` Jason
@ 2014-03-14 15:37 ` mricon
  2014-03-19  9:01   ` Jason
  2014-03-22 17:06   ` cgit
  1 sibling, 2 replies; 10+ messages in thread
From: mricon @ 2014-03-14 15:37 UTC (permalink / raw)


Hi, all:

We upgraded to 0.10.1 on kernel.org with libravatar support:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/

As you'll notice, it's slightly different from the default gravatar
script, so here are our changes (using lua-md5 instead of luacrypto):

email-libravatar-korg.lua:
----
local md5 = require("md5")

function filter_open(email, page)
        buffer = ""
        hexdigest = md5.sumhexa(email:sub(2, -2):lower())
end

function filter_close()
        html("<span class='libravatar'><img class='inline'
src='//seccdn.libravatar.org/avatar/" .. hexdigest ..
"?s=13&amp;d=retro' /><img class='onhover'
src='//seccdn.libravatar.org/avatar/" .. hexdigest ..
"?s=128&amp;d=retro' /></span>" .. buffer)
        return 0
end

function filter_write(str)
        buffer = buffer .. str
end
----

The following css additions are required for the hover effect:

----
div#cgit span.libravatar img.onhover {
        display: none;
        border: 1px solid gray;
        padding: 0px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        border-radius: 4px;
        width: 128px;
        height: 128px;
}

div#cgit span.libravatar img.inline {
        -webkit-border-radius: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px;
        width: 13px;
        height: 13px;
        margin-right: 0.2em;
        opacity: 0.4;
}

div#cgit span.libravatar:hover > img.onhover {
        display: block;
        position: absolute;
        margin-left: 1.5em;
        background-color: #eeeeee;
        box-shadow: 5px 5px 3px #bbb;
}
----

Best,
-- 
Konstantin Ryabitsev
Senior Systems Administrator
Linux Foundation Collab Projects
Montr?al, Qu?bec

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 713 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140314/1910242e/attachment.asc>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-14 15:37 ` kernel.org's libravatar " mricon
@ 2014-03-19  9:01   ` Jason
  2014-03-20 14:21     ` list
  2014-03-22 17:06   ` cgit
  1 sibling, 1 reply; 10+ messages in thread
From: Jason @ 2014-03-19  9:01 UTC (permalink / raw)


Very slick! Thanks for sending this onward.

Promptly stolen for <git.zx2c4.com>. : )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140319/69ecffb8/attachment.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-19  9:01   ` Jason
@ 2014-03-20 14:21     ` list
  2014-03-20 17:15       ` Jason
  0 siblings, 1 reply; 10+ messages in thread
From: list @ 2014-03-20 14:21 UTC (permalink / raw)


"Jason A. Donenfeld" <Jason at zx2c4.com> on Wed, 2014/03/19 03:01:
> Very slick! Thanks for sending this onward.
> 
> Promptly stolen for <git.zx2c4.com>. : )

I would increase the opacity value a bit, but I do like it otherwise. :D
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140320/4e43cecd/attachment.asc>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-20 14:21     ` list
@ 2014-03-20 17:15       ` Jason
  2014-03-20 20:10         ` list
  0 siblings, 1 reply; 10+ messages in thread
From: Jason @ 2014-03-20 17:15 UTC (permalink / raw)


On Thu, Mar 20, 2014 at 8:21 AM, Christian Hesse <list at eworm.de> wrote:
> I would increase the opacity value a bit, but I do like it otherwise. :D

It's point four now. Make a suggestion and I'll change it to that. I
was having trouble deciding myself.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-20 17:15       ` Jason
@ 2014-03-20 20:10         ` list
  2014-03-21 18:47           ` Jason
  0 siblings, 1 reply; 10+ messages in thread
From: list @ 2014-03-20 20:10 UTC (permalink / raw)


"Jason A. Donenfeld" <Jason at zx2c4.com> on Thu, 2014/03/20 11:15:
> On Thu, Mar 20, 2014 at 8:21 AM, Christian Hesse <list at eworm.de> wrote:
> > I would increase the opacity value a bit, but I do like it otherwise. :D
> 
> It's point four now. Make a suggestion and I'll change it to that. I
> was having trouble deciding myself.

I would go with dot six or dot seven...
Anybody else with an opinion?
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140320/cf5a81ee/attachment-0001.asc>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-20 20:10         ` list
@ 2014-03-21 18:47           ` Jason
  0 siblings, 0 replies; 10+ messages in thread
From: Jason @ 2014-03-21 18:47 UTC (permalink / raw)


Dot six it is!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140321/2da9960d/attachment.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* kernel.org's libravatar lua script
  2014-03-14 15:37 ` kernel.org's libravatar " mricon
  2014-03-19  9:01   ` Jason
@ 2014-03-22 17:06   ` cgit
  1 sibling, 0 replies; 10+ messages in thread
From: cgit @ 2014-03-22 17:06 UTC (permalink / raw)


On Fri, 14 Mar 2014 at 16:37:56, Konstantin Ryabitsev wrote:
> Hi, all:
> 
> We upgraded to 0.10.1 on kernel.org with libravatar support:
> https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
> 
> As you'll notice, it's slightly different from the default gravatar
> script, so here are our changes (using lua-md5 instead of luacrypto):
> 

Nice. Note that this currently doesn't work when accessing the site via
HTTP [1, 2].

> email-libravatar-korg.lua:
> [...]

[1] http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
[2] http://git.zx2c4.com/cgit/


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-03-22 17:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 10:55 [PATCH 1/1] filter: add libravatar email-filter lua script mail
2014-03-13 10:58 ` Jason
2014-03-13 11:01   ` mail
2014-03-14 15:37 ` kernel.org's libravatar " mricon
2014-03-19  9:01   ` Jason
2014-03-20 14:21     ` list
2014-03-20 17:15       ` Jason
2014-03-20 20:10         ` list
2014-03-21 18:47           ` Jason
2014-03-22 17:06   ` cgit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).