From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Thu, 21 Jun 2018 17:34:49 +0800 Subject: [PATCH v2 1/5] config: add js In-Reply-To: <152957329993.21285.2517119299142660486.stgit@mail.warmcat.com> References: <152957329993.21285.2517119299142660486.stgit@mail.warmcat.com> Message-ID: <152957368964.21285.17402274172973616296.stgit@mail.warmcat.com> Just like the config allows setting css URL path, add a config for setting the js URL path Signed-off-by: Andy Green --- cgit.c | 3 +++ cgit.h | 1 + cgitrc.5.txt | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/cgit.c b/cgit.c index bdb2fad..8b23c8f 100644 --- a/cgit.c +++ b/cgit.c @@ -146,6 +146,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.root_readme = xstrdup(value); else if (!strcmp(name, "css")) ctx.cfg.css = xstrdup(value); + else if (!strcmp(name, "js")) + ctx.cfg.js = xstrdup(value); else if (!strcmp(name, "favicon")) ctx.cfg.favicon = xstrdup(value); else if (!strcmp(name, "footer")) @@ -384,6 +386,7 @@ static void prepare_context(void) ctx.cfg.branch_sort = 0; ctx.cfg.commit_sort = 0; ctx.cfg.css = "/cgit.css"; + ctx.cfg.js = "/cgit.js"; ctx.cfg.logo = "/cgit.png"; ctx.cfg.favicon = "/favicon.ico"; ctx.cfg.local_time = 0; diff --git a/cgit.h b/cgit.h index 99ea7a2..e5a703e 100644 --- a/cgit.h +++ b/cgit.h @@ -194,6 +194,7 @@ struct cgit_config { char *clone_prefix; char *clone_url; char *css; + char *js; char *favicon; char *footer; char *head_include; diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 99fc799..a692aa5 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -248,6 +248,10 @@ inline-readme:: individually also choose to ignore this global list, and create a repo-specific list by using 'repo.inline-readme'. +js:: + Url which specifies the javascript script document to include in all cgit + pages. Default value: "/cgit.js". + local-time:: Flag which, if set to "1", makes cgit print commit and tag times in the servers timezone. Default value: "0".