From mboxrd@z Thu Jan 1 00:00:00 1970 From: hacking at nachtgeist.net (Daniel Reichelt) Date: Thu, 13 Aug 2015 06:49:20 +0200 Subject: [PATCH] add new option atom-root Message-ID: <55CC21D0.6030904@nachtgeist.net> In reverse-proxy setups cgit's auto-determination of the hostname doesn't work. When set, this option will be used as prefix to all atom-related URLs. While the rest of cgit's URLs are not absolute, this option, if set, should be absolute and include a scheme. Default value: none. Signed-off-by: Daniel Reichelt --- cgit.c | 2 ++ cgit.h | 1 + cgitrc.5.txt | 6 ++++++ ui-atom.c | 16 ++++++++++++---- ui-shared.c | 8 ++++++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cgit.c b/cgit.c index d84b4be..351f9bd 100644 --- a/cgit.c +++ b/cgit.c @@ -142,6 +142,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.strict_export = xstrdup(value); else if (!strcmp(name, "virtual-root")) { ctx.cfg.virtual_root = ensure_end(value, '/'); + } else if (!strcmp(name, "atom-root")) { + ctx.cfg.atom_root = xstrdup(value); } else if (!strcmp(name, "nocache")) ctx.cfg.nocache = atoi(value); else if (!strcmp(name, "noplainemail")) diff --git a/cgit.h b/cgit.h index 3120562..a3bb3aa 100644 --- a/cgit.h +++ b/cgit.h @@ -209,6 +209,7 @@ struct cgit_config { char *section; char *repository_sort; char *virtual_root; /* Always ends with '/'. */ + char *atom_root; char *strict_export; int cache_size; int cache_dynamic_ttl; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 759f353..4cb5be9 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -42,6 +42,12 @@ agefile:: hh:mm:ss". You may want to generate this file from a post-receive hook. Default value: "info/web/last-modified". +atom-root:: + In reverse-proxy setups cgit's auto-determination of the hostname doesn't + work. When set, this option will be used as prefix to all atom-related + URLs. While the rest of cgit's URLs are not absolute, this option, if set, + should be absolute and include a scheme. Default value: none. + auth-filter:: Specifies a command that will be invoked for authenticating repository access. Receives quite a few arguments, and data on both stdin and diff --git a/ui-atom.c b/ui-atom.c index e2b39ee..038a168 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -54,8 +54,12 @@ static void add_entry(struct commit *commit, const char *host) html("\n"); if (host) { html("\n"); if (host) { html("\n"); } diff --git a/ui-shared.c b/ui-shared.c index 6be0c2e..a051cd8 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -751,8 +751,12 @@ void cgit_print_docstart(void) strbuf_addf(&sb, "h=%s", ctx.qry.head); html("\n"); -- 2.1.4