summaryrefslogtreecommitdiffabout
authorMartin Szulecki <opensuse@sukimashita.com>2009-08-07 12:05:17 (UTC)
committer Martin Szulecki <opensuse@sukimashita.com>2009-08-08 12:23:28 (UTC)
commit2f56e390f04fe6975b75e512c1436ef173e4aafe (patch) (unidiff)
tree4e187a5cf039a39a1908623b97e0676c6e7cb756
parent286a905842dc0bec6d21a614ec4a97c5f19d5bc4 (diff)
downloadcgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.zip
cgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.tar.gz
cgit-2f56e390f04fe6975b75e512c1436ef173e4aafe.tar.bz2
Introduce noplainemail option to hide email adresses from spambots
Signed-off-by: Martin Szulecki <opensuse@sukimashita.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
-rw-r--r--ui-atom.c2
-rw-r--r--ui-commit.c4
-rw-r--r--ui-patch.c6
-rw-r--r--ui-tag.c2
7 files changed, 18 insertions, 3 deletions
diff --git a/cgit.c b/cgit.c
index 2039ab1..f6bb0c7 100644
--- a/cgit.c
+++ b/cgit.c
@@ -46,16 +46,18 @@ void config_cb(const char *name, const char *value)
46 else if (!strcmp(name, "module-link")) 46 else if (!strcmp(name, "module-link"))
47 ctx.cfg.module_link = xstrdup(value); 47 ctx.cfg.module_link = xstrdup(value);
48 else if (!strcmp(name, "virtual-root")) { 48 else if (!strcmp(name, "virtual-root")) {
49 ctx.cfg.virtual_root = trim_end(value, '/'); 49 ctx.cfg.virtual_root = trim_end(value, '/');
50 if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) 50 if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))
51 ctx.cfg.virtual_root = ""; 51 ctx.cfg.virtual_root = "";
52 } else if (!strcmp(name, "nocache")) 52 } else if (!strcmp(name, "nocache"))
53 ctx.cfg.nocache = atoi(value); 53 ctx.cfg.nocache = atoi(value);
54 else if (!strcmp(name, "noplainemail"))
55 ctx.cfg.noplainemail = atoi(value);
54 else if (!strcmp(name, "noheader")) 56 else if (!strcmp(name, "noheader"))
55 ctx.cfg.noheader = atoi(value); 57 ctx.cfg.noheader = atoi(value);
56 else if (!strcmp(name, "snapshots")) 58 else if (!strcmp(name, "snapshots"))
57 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 59 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
58 else if (!strcmp(name, "enable-index-links")) 60 else if (!strcmp(name, "enable-index-links"))
59 ctx.cfg.enable_index_links = atoi(value); 61 ctx.cfg.enable_index_links = atoi(value);
60 else if (!strcmp(name, "enable-log-filecount")) 62 else if (!strcmp(name, "enable-log-filecount"))
61 ctx.cfg.enable_log_filecount = atoi(value); 63 ctx.cfg.enable_log_filecount = atoi(value);
diff --git a/cgit.h b/cgit.h
index 8c64efe..acb5e8f 100644
--- a/cgit.h
+++ b/cgit.h
@@ -163,16 +163,17 @@ struct cgit_config {
163 int local_time; 163 int local_time;
164 int max_repo_count; 164 int max_repo_count;
165 int max_commit_count; 165 int max_commit_count;
166 int max_lock_attempts; 166 int max_lock_attempts;
167 int max_msg_len; 167 int max_msg_len;
168 int max_repodesc_len; 168 int max_repodesc_len;
169 int max_stats; 169 int max_stats;
170 int nocache; 170 int nocache;
171 int noplainemail;
171 int noheader; 172 int noheader;
172 int renamelimit; 173 int renamelimit;
173 int snapshots; 174 int snapshots;
174 int summary_branches; 175 int summary_branches;
175 int summary_log; 176 int summary_log;
176 int summary_tags; 177 int summary_tags;
177}; 178};
178 179
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index a207fe0..7754923 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -153,16 +153,20 @@ module-link::
153 formatstring are the path and SHA1 of the submodule commit. Default 153 formatstring are the path and SHA1 of the submodule commit. Default
154 value: "./?repo=%s&page=commit&id=%s" 154 value: "./?repo=%s&page=commit&id=%s"
155 155
156nocache:: 156nocache::
157 If set to the value "1" caching will be disabled. This settings is 157 If set to the value "1" caching will be disabled. This settings is
158 deprecated, and will not be honored starting with cgit-1.0. Default 158 deprecated, and will not be honored starting with cgit-1.0. Default
159 value: "0". 159 value: "0".
160 160
161noplainemail::
162 If set to "1" showing full author email adresses will be disabled.
163 Default value: "0".
164
161noheader:: 165noheader::
162 Flag which, when set to "1", will make cgit omit the standard header 166 Flag which, when set to "1", will make cgit omit the standard header
163 on all pages. Default value: none. See also: "embedded". 167 on all pages. Default value: none. See also: "embedded".
164 168
165renamelimit:: 169renamelimit::
166 Maximum number of files to consider when detecting renames. The value 170 Maximum number of files to consider when detecting renames. The value
167 "-1" uses the compiletime value in git (for further info, look at 171 "-1" uses the compiletime value in git (for further info, look at
168 `man git-diff`). Default value: "-1". 172 `man git-diff`). Default value: "-1".
diff --git a/ui-atom.c b/ui-atom.c
index e5c31d9..808b2d0 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -27,17 +27,17 @@ void add_entry(struct commit *commit, char *host)
27 cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); 27 cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time);
28 html("</updated>\n"); 28 html("</updated>\n");
29 html("<author>\n"); 29 html("<author>\n");
30 if (info->author) { 30 if (info->author) {
31 html("<name>"); 31 html("<name>");
32 html_txt(info->author); 32 html_txt(info->author);
33 html("</name>\n"); 33 html("</name>\n");
34 } 34 }
35 if (info->author_email) { 35 if (info->author_email && !ctx.cfg.noplainemail) {
36 mail = xstrdup(info->author_email); 36 mail = xstrdup(info->author_email);
37 t = strchr(mail, '<'); 37 t = strchr(mail, '<');
38 if (t) 38 if (t)
39 t++; 39 t++;
40 else 40 else
41 t = mail; 41 t = mail;
42 t2 = strchr(t, '>'); 42 t2 = strchr(t, '>');
43 if (t2) 43 if (t2)
diff --git a/ui-commit.c b/ui-commit.c
index 41ce70e..9fdb8ee 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -35,25 +35,29 @@ void cgit_print_commit(char *hex)
35 } 35 }
36 info = cgit_parse_commit(commit); 36 info = cgit_parse_commit(commit);
37 37
38 load_ref_decorations(); 38 load_ref_decorations();
39 39
40 html("<table summary='commit info' class='commit-info'>\n"); 40 html("<table summary='commit info' class='commit-info'>\n");
41 html("<tr><th>author</th><td>"); 41 html("<tr><th>author</th><td>");
42 html_txt(info->author); 42 html_txt(info->author);
43 if (!ctx.cfg.noplainemail) {
43 html(" "); 44 html(" ");
44 html_txt(info->author_email); 45 html_txt(info->author_email);
46 }
45 html("</td><td class='right'>"); 47 html("</td><td class='right'>");
46 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); 48 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time);
47 html("</td></tr>\n"); 49 html("</td></tr>\n");
48 html("<tr><th>committer</th><td>"); 50 html("<tr><th>committer</th><td>");
49 html_txt(info->committer); 51 html_txt(info->committer);
52 if (!ctx.cfg.noplainemail) {
50 html(" "); 53 html(" ");
51 html_txt(info->committer_email); 54 html_txt(info->committer_email);
55 }
52 html("</td><td class='right'>"); 56 html("</td><td class='right'>");
53 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); 57 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time);
54 html("</td></tr>\n"); 58 html("</td></tr>\n");
55 html("<tr><th>commit</th><td colspan='2' class='sha1'>"); 59 html("<tr><th>commit</th><td colspan='2' class='sha1'>");
56 tmp = sha1_to_hex(commit->object.sha1); 60 tmp = sha1_to_hex(commit->object.sha1);
57 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); 61 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp);
58 html(" ("); 62 html(" (");
59 cgit_patch_link("patch", NULL, NULL, NULL, tmp); 63 cgit_patch_link("patch", NULL, NULL, NULL, tmp);
diff --git a/ui-patch.c b/ui-patch.c
index 5d665d3..2a8f7a5 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -103,17 +103,21 @@ void cgit_print_patch(char *hex)
103 else 103 else
104 hashclr(old_sha1); 104 hashclr(old_sha1);
105 105
106 patchname = fmt("%s.patch", sha1_to_hex(sha1)); 106 patchname = fmt("%s.patch", sha1_to_hex(sha1));
107 ctx.page.mimetype = "text/plain"; 107 ctx.page.mimetype = "text/plain";
108 ctx.page.filename = patchname; 108 ctx.page.filename = patchname;
109 cgit_print_http_headers(&ctx); 109 cgit_print_http_headers(&ctx);
110 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); 110 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
111 htmlf("From: %s %s\n", info->author, info->author_email); 111 htmlf("From: %s", info->author);
112 if (!ctx.cfg.noplainemail) {
113 htmlf(" %s", info->author_email);
114 }
115 html("\n");
112 html("Date: "); 116 html("Date: ");
113 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); 117 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time);
114 htmlf("Subject: %s\n\n", info->subject); 118 htmlf("Subject: %s\n\n", info->subject);
115 if (info->msg && *info->msg) { 119 if (info->msg && *info->msg) {
116 htmlf("%s", info->msg); 120 htmlf("%s", info->msg);
117 if (info->msg[strlen(info->msg) - 1] != '\n') 121 if (info->msg[strlen(info->msg) - 1] != '\n')
118 html("\n"); 122 html("\n");
119 } 123 }
diff --git a/ui-tag.c b/ui-tag.c
index 0e056e0..a9c8670 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -59,17 +59,17 @@ void cgit_print_tag(char *revname)
59 if (info->tagger_date > 0) { 59 if (info->tagger_date > 0) {
60 html("<tr><td>Tag date</td><td>"); 60 html("<tr><td>Tag date</td><td>");
61 cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); 61 cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time);
62 html("</td></tr>\n"); 62 html("</td></tr>\n");
63 } 63 }
64 if (info->tagger) { 64 if (info->tagger) {
65 html("<tr><td>Tagged by</td><td>"); 65 html("<tr><td>Tagged by</td><td>");
66 html_txt(info->tagger); 66 html_txt(info->tagger);
67 if (info->tagger_email) { 67 if (info->tagger_email && !ctx.cfg.noplainemail) {
68 html(" "); 68 html(" ");
69 html_txt(info->tagger_email); 69 html_txt(info->tagger_email);
70 } 70 }
71 html("</td></tr>\n"); 71 html("</td></tr>\n");
72 } 72 }
73 html("<tr><td>Tagged object</td><td>"); 73 html("<tr><td>Tagged object</td><td>");
74 cgit_object_link(tag->tagged); 74 cgit_object_link(tag->tagged);
75 html("</td></tr>\n"); 75 html("</td></tr>\n");