From: Lars Hjemli Date: Sun, 9 Aug 2009 11:46:34 +0000 (+0200) Subject: Merge branch 'lh/about' X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/db8b8cb9467625cb8d9ecb67863aa67590e59cc0?hp=-c Merge branch 'lh/about' Conflicts: cgit.h --- db8b8cb9467625cb8d9ecb67863aa67590e59cc0 diff --combined cgit.c index dbec196,cb1149d..7b228af --- a/cgit.c +++ b/cgit.c @@@ -17,14 -17,6 +17,14 @@@ 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 +74,8 @@@ void config_cb(const char *name, const 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")) @@@ -100,6 -90,8 +100,8 @@@ ctx.cfg.cache_static_ttl = atoi(value); else if (!strcmp(name, "cache-dynamic-ttl")) ctx.cfg.cache_dynamic_ttl = atoi(value); + else if (!strcmp(name, "about-filter")) + ctx.cfg.about_filter = new_filter(value, 0); else if (!strcmp(name, "commit-filter")) ctx.cfg.commit_filter = new_filter(value, 0); else if (!strcmp(name, "embedded")) @@@ -130,8 -122,6 +132,8 @@@ 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")) @@@ -158,6 -148,8 +160,8 @@@ ctx.repo->max_stats = cgit_find_stats_period(value, NULL); else if (ctx.repo && !strcmp(name, "repo.module-link")) ctx.repo->module_link= xstrdup(value); + else if (ctx.repo && !strcmp(name, "repo.about-filter")) + ctx.repo->about_filter = new_filter(value, 0); else if (ctx.repo && !strcmp(name, "repo.commit-filter")) ctx.repo->commit_filter = new_filter(value, 0); else if (ctx.repo && !strcmp(name, "repo.source-filter")) @@@ -248,7 -240,6 +252,7 @@@ static void prepare_context(struct cgit 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 { diff --combined cgit.h index b8557ac,b8f4850..4c854ea --- a/cgit.h +++ b/cgit.h @@@ -15,7 -15,6 +15,7 @@@ #include #include #include +#include #include #include #include @@@ -74,6 -73,7 +74,7 @@@ struct cgit_repo int enable_log_linecount; int max_stats; time_t mtime; + struct cgit_filter *about_filter; struct cgit_filter *commit_filter; struct cgit_filter *source_filter; }; @@@ -180,14 -180,13 +181,15 @@@ 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 --combined cgitrc.5.txt index dc63637,d8e4b97..4d656fe --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@@ -16,6 -16,13 +16,13 @@@ lines, and lines starting with '#', ar GLOBAL SETTINGS --------------- + about-filter:: + Specifies a command which will be invoked to format the content of + about pages (both top-level and for each repository). The command will + get the content of the about-file on its STDIN, and the STDOUT from the + command will be included verbatim on the about page. Default value: + none. + agefile:: Specifies a path, relative to each repository path, which can be used to specify the date and time of the youngest commit in the repository. @@@ -153,10 -160,6 +160,10 @@@ max-stats: "month", "quarter" and "year". If unspecified, statistics are disabled. Default value: none. See also: "repo.max-stats". +mimetype.:: + 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 @@@ -168,10 -171,6 +175,10 @@@ 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". @@@ -242,6 -241,9 +249,9 @@@ virtual-root: REPOSITORY SETTINGS ------------------- + repo.about-filter:: + Override the default about-filter. Default value: . + repo.clone-url:: A list of space-separated urls which can be used to clone this repo. Default value: none. @@@ -352,19 -354,6 +362,19 @@@ root-readme=/var/www/htdocs/about.htm 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