diff options
author | Naïm Favier <fnaim42@gmail.com> | 2019-12-09 21:38:14 +0300 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-01-30 11:06:33 +0300 |
commit | d9f3d6fb1817fd22512ac62e8d7c36c67dc5584a (patch) | |
tree | 17c9acce3bb78c564ef97d6ff76147f690b25f8d /cmd.c | |
parent | 00ecfaadea2c40cc62b7a43e246384329e6ddb98 (diff) |
Make default pages configurablech/default-pages
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -51,13 +51,10 @@ static void about_fn(void) free(redirect); } else if (ctx.repo->readme.nr) cgit_print_repo_readme(ctx.qry.path); - else if (ctx.repo->homepage) - cgit_redirect(ctx.repo->homepage, false); else { - char *currenturl = cgit_currenturl(); - char *redirect = fmtalloc("%s../", currenturl); + char *redirect = fmtalloc("%s%s/summary/", + ctx.cfg.virtual_root, ctx.repo->url); cgit_redirect(redirect, false); - free(currenturl); free(redirect); } } else @@ -195,10 +192,13 @@ struct cgit_cmd *cgit_get_cmd(void) int i; if (ctx.qry.page == NULL) { - if (ctx.repo) - ctx.qry.page = "summary"; - else - ctx.qry.page = "repolist"; + if (ctx.repo) { + if (ctx.repo->default_page && *ctx.repo->default_page) + ctx.qry.page = ctx.repo->default_page; + else + ctx.qry.page = ctx.cfg.default_page; + } else + ctx.qry.page = ctx.cfg.root_default_page; } for (i = 0; i < sizeof(cmds)/sizeof(*cmds); i++) |