commit e85a14fab54d116e5aa188fbc1c8f319042a197a from: Omar Polo via: Thomas Adam date: Sat Dec 30 18:51:43 2023 UTC gotwebd: add knob for the number of tags and commits in the summary page ok jamsek commit - e2ac8a3da0010ac9a2d6ed0457d75d71b3a27ce5 commit + e85a14fab54d116e5aa188fbc1c8f319042a197a blob - a3af7ecdcc4dfcc32a7dee15fc4c302b1a627efd blob + 81932fc95c4d74b1c3b2af23037fefc435fb69da --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -345,11 +345,11 @@ gotweb_process_request(struct request *c) error->msg); goto err; } - error = got_get_repo_commits(c, D_MAXSLCOMMDISP); + error = got_get_repo_commits(c, srv->summary_commits_display); if (error) goto err; qs->action = TAGS; - error = got_get_repo_tags(c, D_MAXSLTAGDISP); + error = got_get_repo_tags(c, srv->summary_tags_display); if (error) { log_warnx("%s: got_get_repo_tags: %s", __func__, error->msg); blob - 0a41fb98df13059fc8f142e386a1d099a8d24de9 blob + 4c767ed265dc319ad4197dca6add8519857c0aea --- gotwebd/gotwebd.conf.5 +++ gotwebd/gotwebd.conf.5 @@ -156,6 +156,10 @@ Set the displayed site name title. Set the displayed site owner. .It Ic show_site_owner Ar on | off Toggle display of the site owner. +.It Ic summary_commits_display Ar number +The maximum number of commits to show in the summary page. +.It Ic summary_tags_display Ar number +The maximum number of tags to show in the summary page. .El .Sh FILES .Bl -tag -width Ds -compact @@ -198,6 +202,9 @@ server "localhost-unix" { #max_repos 0 #max_repos_display 25 #max_commits_display 25 + + #summary_commits_display 10 + #summary_tags_display 3 } # Example server context for FCGI over TCP connections: blob - 4ac6df645c49875304c9cd6afec8cff0c4b8f3b2 blob + d8c7c9c630d74c1b2acde77f1cd158400dedd993 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -303,6 +303,8 @@ struct server { size_t max_repos; size_t max_repos_display; size_t max_commits_display; + size_t summary_commits_display; + size_t summary_tags_display; int show_site_owner; int show_repo_owner; blob - 76826bfca0a204a99c8679cd0b3a965cf08b6f41 blob + ac8d5fb0175cfb20d850c15e6a83c221e6edcaa2 --- gotwebd/parse.y +++ gotwebd/parse.y @@ -114,6 +114,7 @@ typedef struct { %token MAX_REPOS_DISPLAY REPOS_PATH MAX_COMMITS_DISPLAY ON ERROR %token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK RESPECT_EXPORTOK %token UNIX_SOCKET UNIX_SOCKET_NAME SERVER CHROOT CUSTOM_CSS SOCKET +%token SUMMARY_COMMITS_DISPLAY SUMMARY_TAGS_DISPLAY %token STRING %token NUMBER @@ -408,7 +409,23 @@ serveropts1 : REPOS_PATH STRING { YYERROR; } new_srv->max_commits_display = $2; + } + | SUMMARY_COMMITS_DISPLAY NUMBER { + if ($2 < 1) { + yyerror("summary_commits_display is too small:" + " %lld", $2); + YYERROR; + } + new_srv->summary_commits_display = $2; } + | SUMMARY_TAGS_DISPLAY NUMBER { + if ($2 < 1) { + yyerror("summary_tags_display is too small:" + " %lld", $2); + YYERROR; + } + new_srv->summary_tags_display = $2; + } ; serveropts2 : serveropts2 serveropts1 nl @@ -479,6 +496,8 @@ lookup(char *s) { "site_name", SITE_NAME }, { "site_owner", SITE_OWNER }, { "socket", SOCKET }, + { "summary_commits_display", SUMMARY_COMMITS_DISPLAY }, + { "summary_tags_display", SUMMARY_TAGS_DISPLAY }, { "unix_socket", UNIX_SOCKET }, { "unix_socket_name", UNIX_SOCKET_NAME }, }; @@ -910,6 +929,8 @@ conf_new_server(const char *name) srv->max_repos_display = D_MAXREPODISP; srv->max_commits_display = D_MAXCOMMITDISP; + srv->summary_commits_display = D_MAXSLCOMMDISP; + srv->summary_tags_display = D_MAXSLTAGDISP; srv->max_repos = D_MAXREPO; srv->unix_socket = 1;