Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.zx2c4.com/cgit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorNaïm Favier <fnaim42@gmail.com>2019-12-09 21:38:14 +0300
committerChristian Hesse <mail@eworm.de>2024-01-30 11:06:33 +0300
commitd9f3d6fb1817fd22512ac62e8d7c36c67dc5584a (patch)
tree17c9acce3bb78c564ef97d6ff76147f690b25f8d /cmd.c
parent00ecfaadea2c40cc62b7a43e246384329e6ddb98 (diff)
Make default pages configurablech/default-pages
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmd.c b/cmd.c
index 0eb75b1..669c345 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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++)