all repos — cgit @ 2f56e390f04fe6975b75e512c1436ef173e4aafe

a hyperfast web frontend for git written in c

Introduce noplainemail option to hide email adresses from spambots

Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Martin Szulecki opensuse@sukimashita.com
Fri, 07 Aug 2009 14:05:17 +0200
commit

2f56e390f04fe6975b75e512c1436ef173e4aafe

parent

286a905842dc0bec6d21a614ec4a97c5f19d5bc4

7 files changed, 22 insertions(+), 7 deletions(-)

jump to
M cgit.ccgit.c

@@ -51,6 +51,8 @@ if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))

ctx.cfg.virtual_root = ""; } else if (!strcmp(name, "nocache")) ctx.cfg.nocache = atoi(value); + else if (!strcmp(name, "noplainemail")) + ctx.cfg.noplainemail = atoi(value); else if (!strcmp(name, "noheader")) ctx.cfg.noheader = atoi(value); else if (!strcmp(name, "snapshots"))
M cgit.hcgit.h

@@ -168,6 +168,7 @@ int max_msg_len;

int max_repodesc_len; int max_stats; int nocache; + int noplainemail; int noheader; int renamelimit; int snapshots;
M cgitrc.5.txtcgitrc.5.txt

@@ -158,6 +158,10 @@ If set to the value "1" caching will be disabled. This settings is

deprecated, and will not be honored starting with cgit-1.0. Default value: "0". +noplainemail:: + If set to "1" showing full author email adresses will be disabled. + Default value: "0". + noheader:: Flag which, when set to "1", will make cgit omit the standard header on all pages. Default value: none. See also: "embedded".
M ui-atom.cui-atom.c

@@ -32,7 +32,7 @@ html("<name>");

html_txt(info->author); html("</name>\n"); } - if (info->author_email) { + if (info->author_email && !ctx.cfg.noplainemail) { mail = xstrdup(info->author_email); t = strchr(mail, '<'); if (t)
M ui-commit.cui-commit.c

@@ -40,15 +40,19 @@

html("<table summary='commit info' class='commit-info'>\n"); html("<tr><th>author</th><td>"); html_txt(info->author); - html(" "); - html_txt(info->author_email); + if (!ctx.cfg.noplainemail) { + html(" "); + html_txt(info->author_email); + } html("</td><td class='right'>"); cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); html("</td></tr>\n"); html("<tr><th>committer</th><td>"); html_txt(info->committer); - html(" "); - html_txt(info->committer_email); + if (!ctx.cfg.noplainemail) { + html(" "); + html_txt(info->committer_email); + } html("</td><td class='right'>"); cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); html("</td></tr>\n");
M ui-patch.cui-patch.c

@@ -108,7 +108,11 @@ ctx.page.mimetype = "text/plain";

ctx.page.filename = patchname; cgit_print_http_headers(&ctx); htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); - htmlf("From: %s %s\n", info->author, info->author_email); + htmlf("From: %s", info->author); + if (!ctx.cfg.noplainemail) { + htmlf(" %s", info->author_email); + } + html("\n"); html("Date: "); cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); htmlf("Subject: %s\n\n", info->subject);
M ui-tag.cui-tag.c

@@ -64,7 +64,7 @@ }

if (info->tagger) { html("<tr><td>Tagged by</td><td>"); html_txt(info->tagger); - if (info->tagger_email) { + if (info->tagger_email && !ctx.cfg.noplainemail) { html(" "); html_txt(info->tagger_email); }