]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'lh/about'
authorLars Hjemli <hjemli@gmail.com>
Sun, 9 Aug 2009 11:46:34 +0000 (13:46 +0200)
committerLars Hjemli <hjemli@gmail.com>
Sun, 9 Aug 2009 11:46:34 +0000 (13:46 +0200)
Conflicts:
cgit.h

1  2 
cgit.c
cgit.h
cgitrc.5.txt

diff --combined cgit.c
index dbec1962763145d3c88f89b3ba947dd9ca11bbd5,cb1149d44189d17a13bbec97f8aa4f28c84c7f91..7b228af83046faef92602b0a74a6e1e6e58fea47
--- 1/cgit.c
--- 2/cgit.c
+++ b/cgit.c
  
  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"))
                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"))
                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"))
                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 b8557ace3912b4b62c59eb709fc37dea2f1f506c,b8f485047e48d49f1c3fbdd0fe84a6aac6c6b355..4c854eaa8320771466460f18ff0839c73cc2dafc
--- 1/cgit.h
--- 2/cgit.h
+++ b/cgit.h
@@@ -15,7 -15,6 +15,7 @@@
  #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>
@@@ -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 dc63637b4bb7b17f9a5aeb7088e94db343189d72,d8e4b97b18f80e4ef50fff0b551b2257e8773eb7..4d656fee5323fb35f0846ec086d7dfbd016d21c3
@@@ -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.<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
@@@ -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: <about-filter>.
  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