-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
-rw-r--r-- | ui-atom.c | 2 | ||||
-rw-r--r-- | ui-commit.c | 12 | ||||
-rw-r--r-- | ui-patch.c | 6 | ||||
-rw-r--r-- | ui-tag.c | 2 | ||||
-rw-r--r-- | ui-tree.c | 8 |
8 files changed, 29 insertions, 8 deletions
@@ -61,2 +61,4 @@ void config_cb(const char *name, const char *value) ctx.cfg.nocache = atoi(value); + else if (!strcmp(name, "noplainemail")) + ctx.cfg.noplainemail = atoi(value); else if (!strcmp(name, "noheader")) @@ -171,2 +171,3 @@ struct cgit_config { int nocache; + int noplainemail; int noheader; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 7256ec0..0412f64 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -164,2 +164,6 @@ nocache:: +noplainemail:: + If set to "1" showing full author email adresses will be disabled. + Default value: "0". + noheader:: @@ -34,3 +34,3 @@ void add_entry(struct commit *commit, char *host) } - if (info->author_email) { + if (info->author_email && !ctx.cfg.noplainemail) { mail = xstrdup(info->author_email); diff --git a/ui-commit.c b/ui-commit.c index 41ce70e..9fdb8ee 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -42,4 +42,6 @@ void cgit_print_commit(char *hex) 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'>"); @@ -49,4 +51,6 @@ void cgit_print_commit(char *hex) 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'>"); @@ -110,3 +110,7 @@ void cgit_print_patch(char *hex) 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: "); @@ -66,3 +66,3 @@ void cgit_print_tag(char *revname) html_txt(info->tagger); - if (info->tagger_email) { + if (info->tagger_email && !ctx.cfg.noplainemail) { html(" "); @@ -105,2 +105,3 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, char *fullpath; + char *class; enum object_type type; @@ -137,3 +138,8 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, } else { - cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, + class = strrchr(name, '.'); + if (class != NULL) { + class = fmt("ls-blob %s", class + 1); + } else + class = "ls-blob"; + cgit_tree_link(name, NULL, class, ctx.qry.head, curr_rev, fullpath); |