| -rw-r--r-- | cgit.c | 13 | ||||
| -rw-r--r-- | cgit.h | 3 | ||||
| -rw-r--r-- | cgitrc.5.txt | 21 | ||||
| -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-plain.c | 20 | ||||
| -rw-r--r-- | ui-tag.c | 2 | ||||
| -rw-r--r-- | ui-tree.c | 8 |
9 files changed, 13 insertions, 74 deletions
@@ -17,14 +17,6 @@ const char *cgit_version = CGIT_VERSION; -void add_mimetype(const char *name, const char *value) -{ - struct string_list_item *item; - - item = string_list_insert(xstrdup(name), &ctx.cfg.mimetypes); - item->util = xstrdup(value); -} - struct cgit_filter *new_filter(const char *cmd, int extra_args) { struct cgit_filter *f; @@ -74,8 +66,6 @@ void config_cb(const char *name, const char *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")) @@ -132,8 +122,6 @@ void config_cb(const char *name, const char *value) ctx.cfg.clone_prefix = xstrdup(value); else if (!strcmp(name, "local-time")) ctx.cfg.local_time = atoi(value); - else if (!prefixcmp(name, "mimetype.")) - add_mimetype(name + 9, value); else if (!strcmp(name, "repo.group")) ctx.cfg.repo_group = xstrdup(value); else if (!strcmp(name, "repo.url")) @@ -252,7 +240,6 @@ static void prepare_context(struct cgit_context *ctx) ctx->page.modified = time(NULL); ctx->page.expires = ctx->page.modified; ctx->page.etag = NULL; - memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list)); } struct refmatch { @@ -15,7 +15,6 @@ #include <revision.h> #include <log-tree.h> #include <archive.h> -#include <string-list.h> #include <xdiff-interface.h> #include <xdiff/xdiff.h> #include <utf8.h> @@ -181,14 +180,12 @@ struct cgit_config { int max_repodesc_len; int max_stats; int nocache; - int noplainemail; int noheader; int renamelimit; int snapshots; int summary_branches; int summary_log; int summary_tags; - struct string_list mimetypes; struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 4d656fe..d8e4b97 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -160,10 +160,6 @@ max-stats:: "month", "quarter" and "year". If unspecified, statistics are disabled. Default value: none. See also: "repo.max-stats". -mimetype.<ext>:: - Set the mimetype for the specified filename extension. This is used - by the `plain` command when returning blob content. - module-link:: Text which will be used as the formatstring for a hyperlink when a submodule is printed in a directory listing. The arguments for the @@ -175,10 +171,6 @@ nocache:: 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". @@ -363,19 +355,6 @@ snapshots=tar.gz tar.bz2 zip ## -## List of common mimetypes -## - -mimetype.git=image/git -mimetype.html=text/html -mimetype.jpg=image/jpeg -mimetype.jpeg=image/jpeg -mimetype.pdf=application/pdf -mimetype.png=image/png -mimetype.svg=image/svg+xml - - -## ## List of repositories. ## PS: Any repositories listed when repo.group is unset will not be ## displayed under a group heading @@ -32,7 +32,7 @@ void add_entry(struct commit *commit, char *host) html_txt(info->author); html("</name>\n"); } - if (info->author_email && !ctx.cfg.noplainemail) { + if (info->author_email) { mail = xstrdup(info->author_email); t = strchr(mail, '<'); if (t) diff --git a/ui-commit.c b/ui-commit.c index d6b73ee..5815b58 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -40,19 +40,15 @@ void cgit_print_commit(char *hex) html("<table summary='commit info' class='commit-info'>\n"); html("<tr><th>author</th><td>"); html_txt(info->author); - if (!ctx.cfg.noplainemail) { - html(" "); - html_txt(info->author_email); - } + 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); - if (!ctx.cfg.noplainemail) { - html(" "); - html_txt(info->committer_email); - } + 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"); @@ -108,11 +108,7 @@ void cgit_print_patch(char *hex) 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", info->author); - if (!ctx.cfg.noplainemail) { - htmlf(" %s", info->author_email); - } - html("\n"); + htmlf("From: %s %s\n", info->author, info->author_email); 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); @@ -17,9 +17,8 @@ int match; static void print_object(const unsigned char *sha1, const char *path) { enum object_type type; - char *buf, *ext; + char *buf; unsigned long size; - struct string_list_item *mime; type = sha1_object_info(sha1, &size); if (type == OBJ_BAD) { @@ -32,19 +31,10 @@ static void print_object(const unsigned char *sha1, const char *path) html_status(404, "Not found", 0); return; } - ctx.page.mimetype = NULL; - ext = strrchr(path, '.'); - if (ext && *(++ext)) { - mime = string_list_lookup(ext, &ctx.cfg.mimetypes); - if (mime) - ctx.page.mimetype = (char *)mime->util; - } - if (!ctx.page.mimetype) { - if (buffer_is_binary(buf, size)) - ctx.page.mimetype = "application/octet-stream"; - else - ctx.page.mimetype = "text/plain"; - } + if (buffer_is_binary(buf, size)) + ctx.page.mimetype = "application/octet-stream"; + else + ctx.page.mimetype = "text/plain"; ctx.page.filename = fmt("%s", path); ctx.page.size = size; ctx.page.etag = sha1_to_hex(sha1); @@ -64,7 +64,7 @@ void cgit_print_tag(char *revname) if (info->tagger) { html("<tr><td>Tagged by</td><td>"); html_txt(info->tagger); - if (info->tagger_email && !ctx.cfg.noplainemail) { + if (info->tagger_email) { html(" "); html_txt(info->tagger_email); } @@ -113,7 +113,6 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, { char *name; char *fullpath; - char *class; enum object_type type; unsigned long size = 0; @@ -146,12 +145,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, curr_rev, fullpath); } else { - 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, + cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, curr_rev, fullpath); } htmlf("</td><td class='ls-size'>%li</td>", size); |