summary refs log tree commit diff
path: root/cmd.c
diff options
context:
space:
mode:
authorequa <equaa@protonmail.com>2022-01-06 18:18:05 -0600
committerequa <equaa@protonmail.com>2022-01-06 18:36:08 -0600
commit99c81764f66c0877a7ed66f5a03d52f948377678 (patch)
tree97626b497daa42b067e2ba2a49f8f9f56a240f39 /cmd.c
parent5258c297ba6fb604ae1415fbc19a3fe42457e49e (diff)
Add "default-tab" and "root-default-tab" configuration options HEAD master
These options allow the user to specify a page to display at the root
repository/index location instead of the default summary or repository list.

Signed-off-by: equa <equaa@protonmail.com>
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd.c b/cmd.c
index 0eb75b1..64f6639 100644
--- a/cmd.c
+++ b/cmd.c
@@ -55,7 +55,7 @@ static void about_fn(void)
 			cgit_redirect(ctx.repo->homepage, false);
 		else {
 			char *currenturl = cgit_currenturl();
-			char *redirect = fmtalloc("%s../", currenturl);
+			char *redirect = cgit_pageurl(ctx.repo->url, "summary", NULL);
 			cgit_redirect(redirect, false);
 			free(currenturl);
 			free(redirect);
@@ -196,9 +196,9 @@ struct cgit_cmd *cgit_get_cmd(void)
 
 	if (ctx.qry.page == NULL) {
 		if (ctx.repo)
-			ctx.qry.page = "summary";
+			ctx.qry.page = ctx.repo->default_tab;
 		else
-			ctx.qry.page = "repolist";
+			ctx.qry.page = ctx.cfg.root_default_tab;
 	}
 
 	for (i = 0; i < sizeof(cmds)/sizeof(*cmds); i++)