about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cgitrc.5.txt15
-rw-r--r--filter.c3
-rw-r--r--filters/email-gravatar.lua2
-rwxr-xr-xfilters/email-gravatar.py2
-rw-r--r--ui-commit.c4
-rw-r--r--ui-log.c2
-rw-r--r--ui-refs.c6
-rw-r--r--ui-tag.c2
8 files changed, 21 insertions, 15 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index b7dc5a4..6a926aa 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt
@@ -121,9 +121,9 @@ email-filter::
121 Specifies a command which will be invoked to format names and email 121 Specifies a command which will be invoked to format names and email
122 address of committers, authors, and taggers, as represented in various 122 address of committers, authors, and taggers, as represented in various
123 places throughout the cgit interface. This command will receive an 123 places throughout the cgit interface. This command will receive an
124 email address as its only command line argument, and the text to 124 email address and an origin page string as its command line arguments,
125 format on STDIN. It is to write the formatted text back out onto 125 and the text to format on STDIN. It is to write the formatted text back
126 STDOUT. Default value: none. See also: "FILTER API". 126 out onto STDOUT. Default value: none. See also: "FILTER API".
127 127
128embedded:: 128embedded::
129 Flag which, when set to "1", will make cgit generate a html fragment 129 Flag which, when set to "1", will make cgit generate a html fragment
@@ -620,10 +620,11 @@ commit filter::
620 expected on standard output. 620 expected on standard output.
621 621
622email filter:: 622email filter::
623 This filter is given a single parameter: the email address of the 623 This filter is given two parameters: the email address of the relevent
624 relevent user. The filter will then receive the text string to format 624 author and a string indicating the originating page. The filter will
625 on standard input and is expected to write to standard output the 625 then receive the text string to format on standard input and is
626 formatted text to be included in the page. 626 expected to write to standard output the formatted text to be included
627 in the page.
627 628
628source filter:: 629source filter::
629 This filter is given a single parameter: the filename of the source 630 This filter is given a single parameter: the filename of the source
diff --git a/filter.c b/filter.c index 08ce7a5..aa36026 100644 --- a/filter.c +++ b/filter.c
@@ -406,6 +406,9 @@ struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype)
406 406
407 switch (filtertype) { 407 switch (filtertype) {
408 case EMAIL: 408 case EMAIL:
409 argument_count = 2;
410 break;
411
409 case SOURCE: 412 case SOURCE:
410 case ABOUT: 413 case ABOUT:
411 argument_count = 1; 414 argument_count = 1;
diff --git a/filters/email-gravatar.lua b/filters/email-gravatar.lua index 8a53447..982e030 100644 --- a/filters/email-gravatar.lua +++ b/filters/email-gravatar.lua
@@ -9,7 +9,7 @@
9 9
10require("crypto") 10require("crypto")
11 11
12function filter_open(email) 12function filter_open(email, page)
13 buffer = "" 13 buffer = ""
14 md5 = crypto.digest("md5", email:sub(2, -2):lower()) 14 md5 = crypto.digest("md5", email:sub(2, -2):lower())
15end 15end
diff --git a/filters/email-gravatar.py b/filters/email-gravatar.py index 4445615..f90b87d 100755 --- a/filters/email-gravatar.py +++ b/filters/email-gravatar.py
@@ -27,6 +27,8 @@ if email[0] == '<':
27if email[-1] == '>': 27if email[-1] == '>':
28 email = email[0:-1] 28 email = email[0:-1]
29 29
30page = sys.argv[2]
31
30md5 = hashlib.md5(email.encode()).hexdigest() 32md5 = hashlib.md5(email.encode()).hexdigest()
31text = sys.stdin.read().strip() 33text = sys.stdin.read().strip()
32 34
diff --git a/ui-commit.c b/ui-commit.c index bd14ef0..c48bfe8 100644 --- a/ui-commit.c +++ b/ui-commit.c
@@ -44,7 +44,7 @@ void cgit_print_commit(char *hex, const char *prefix)
44 cgit_print_diff_ctrls(); 44 cgit_print_diff_ctrls();
45 html("<table summary='commit info' class='commit-info'>\n"); 45 html("<table summary='commit info' class='commit-info'>\n");
46 html("<tr><th>author</th><td>"); 46 html("<tr><th>author</th><td>");
47 cgit_open_filter(ctx.repo->email_filter, info->author_email); 47 cgit_open_filter(ctx.repo->email_filter, info->author_email, "commit");
48 html_txt(info->author); 48 html_txt(info->author);
49 if (!ctx.cfg.noplainemail) { 49 if (!ctx.cfg.noplainemail) {
50 html(" "); 50 html(" ");
@@ -55,7 +55,7 @@ void cgit_print_commit(char *hex, const char *prefix)
55 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); 55 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time);
56 html("</td></tr>\n"); 56 html("</td></tr>\n");
57 html("<tr><th>committer</th><td>"); 57 html("<tr><th>committer</th><td>");
58 cgit_open_filter(ctx.repo->email_filter, info->committer_email); 58 cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit");
59 html_txt(info->committer); 59 html_txt(info->committer);
60 if (!ctx.cfg.noplainemail) { 60 if (!ctx.cfg.noplainemail) {
61 html(" "); 61 html(" ");
diff --git a/ui-log.c b/ui-log.c index 957d887..499534c 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -168,7 +168,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
168 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); 168 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0);
169 show_commit_decorations(commit); 169 show_commit_decorations(commit);
170 html("</td><td>"); 170 html("</td><td>");
171 cgit_open_filter(ctx.repo->email_filter, info->author_email); 171 cgit_open_filter(ctx.repo->email_filter, info->author_email, "log");
172 html_txt(info->author); 172 html_txt(info->author);
173 cgit_close_filter(ctx.repo->email_filter); 173 cgit_close_filter(ctx.repo->email_filter);
174 174
diff --git a/ui-refs.c b/ui-refs.c index d125459..147b665 100644 --- a/ui-refs.c +++ b/ui-refs.c
@@ -77,7 +77,7 @@ static int print_branch(struct refinfo *ref)
77 if (ref->object->type == OBJ_COMMIT) { 77 if (ref->object->type == OBJ_COMMIT) {
78 cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0); 78 cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0);
79 html("</td><td>"); 79 html("</td><td>");
80 cgit_open_filter(ctx.repo->email_filter, info->author_email); 80 cgit_open_filter(ctx.repo->email_filter, info->author_email, "refs");
81 html_txt(info->author); 81 html_txt(info->author);
82 cgit_close_filter(ctx.repo->email_filter); 82 cgit_close_filter(ctx.repo->email_filter);
83 html("</td><td colspan='2'>"); 83 html("</td><td colspan='2'>");
@@ -157,12 +157,12 @@ static int print_tag(struct refinfo *ref)
157 html("</td><td>"); 157 html("</td><td>");
158 if (info) { 158 if (info) {
159 if (info->tagger) { 159 if (info->tagger) {
160 cgit_open_filter(ctx.repo->email_filter, info->tagger_email); 160 cgit_open_filter(ctx.repo->email_filter, info->tagger_email, "refs");
161 html_txt(info->tagger); 161 html_txt(info->tagger);
162 cgit_close_filter(ctx.repo->email_filter); 162 cgit_close_filter(ctx.repo->email_filter);
163 } 163 }
164 } else if (ref->object->type == OBJ_COMMIT) { 164 } else if (ref->object->type == OBJ_COMMIT) {
165 cgit_open_filter(ctx.repo->email_filter, ref->commit->author_email); 165 cgit_open_filter(ctx.repo->email_filter, ref->commit->author_email, "refs");
166 html_txt(ref->commit->author); 166 html_txt(ref->commit->author);
167 cgit_close_filter(ctx.repo->email_filter); 167 cgit_close_filter(ctx.repo->email_filter);
168 } 168 }
diff --git a/ui-tag.c b/ui-tag.c index adbdb90..c1d1738 100644 --- a/ui-tag.c +++ b/ui-tag.c
@@ -77,7 +77,7 @@ void cgit_print_tag(char *revname)
77 } 77 }
78 if (info->tagger) { 78 if (info->tagger) {
79 html("<tr><td>tagged by</td><td>"); 79 html("<tr><td>tagged by</td><td>");
80 cgit_open_filter(ctx.repo->email_filter, info->tagger_email); 80 cgit_open_filter(ctx.repo->email_filter, info->tagger_email, "tag");
81 html_txt(info->tagger); 81 html_txt(info->tagger);
82 if (info->tagger_email && !ctx.cfg.noplainemail) { 82 if (info->tagger_email && !ctx.cfg.noplainemail) {
83 html(" "); 83 html(" ");