Make default pages configurable

Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
Naïm Favier 2019-12-09 19:38:14 +01:00 committed by Christian Hesse
parent 00ecfaadea
commit d9f3d6fb18
7 changed files with 48 additions and 13 deletions

10
cgit.c
View file

@ -56,6 +56,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
repo->homepage = xstrdup(value);
else if (!strcmp(name, "defbranch"))
repo->defbranch = xstrdup(value);
else if (!strcmp(name, "default-page"))
repo->default_page = xstrdup(value);
else if (!strcmp(name, "extra-head-content"))
repo->extra_head_content = xstrdup(value);
else if (!strcmp(name, "snapshots"))
@ -141,6 +143,8 @@ static void config_cb(const char *name, const char *value)
ctx.cfg.root_desc = xstrdup(value);
else if (!strcmp(name, "root-readme"))
ctx.cfg.root_readme = xstrdup(value);
else if (!strcmp(name, "root-default-page"))
ctx.cfg.root_default_page = xstrdup(value);
else if (!strcmp(name, "css"))
string_list_append(&ctx.cfg.css, xstrdup(value));
else if (!strcmp(name, "js"))
@ -157,6 +161,8 @@ static void config_cb(const char *name, const char *value)
ctx.cfg.logo = xstrdup(value);
else if (!strcmp(name, "logo-link"))
ctx.cfg.logo_link = xstrdup(value);
else if (!strcmp(name, "default-page"))
ctx.cfg.default_page = xstrdup(value);
else if (!strcmp(name, "module-link"))
ctx.cfg.module_link = xstrdup(value);
else if (!strcmp(name, "strict-export"))
@ -380,6 +386,7 @@ static void prepare_context(void)
ctx.cfg.case_sensitive_sort = 1;
ctx.cfg.branch_sort = 0;
ctx.cfg.commit_sort = 0;
ctx.cfg.default_page= "summary";
ctx.cfg.logo = "/cgit.png";
ctx.cfg.favicon = "/favicon.ico";
ctx.cfg.local_time = 0;
@ -400,6 +407,7 @@ static void prepare_context(void)
ctx.cfg.robots = "index, nofollow";
ctx.cfg.root_title = "Git repository browser";
ctx.cfg.root_desc = "a fast webinterface for the git dscm";
ctx.cfg.root_default_page = "repolist";
ctx.cfg.scan_hidden_path = 0;
ctx.cfg.script_name = CGIT_SCRIPT_NAME;
ctx.cfg.section = "";
@ -811,6 +819,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
}
if (repo->defbranch)
fprintf(f, "repo.defbranch=%s\n", repo->defbranch);
if (repo->default_page)
fprintf(f, "repo.default-page=%s\n", repo->default_page);
if (repo->extra_head_content)
fprintf(f, "repo.extra-head-content=%s\n", repo->extra_head_content);
if (repo->module_link)