commit 8762929a1a8555f4108c4495bd52ca6dd7f7aefc from: Omar Polo date: Fri Dec 29 12:18:56 2023 UTC gotwebd: add knob for the number of tags and commits in the summary page ok jamsek commit - 5d6193d0d085d8d8ab3c2f6357b3121bbe728a50 commit + 8762929a1a8555f4108c4495bd52ca6dd7f7aefc blob - e3dca64b089f1e1e0d76ef5826837a9f3b31cf50 blob + cb7ff351528d07661dbabfbdb4d26756af7e252d --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -346,11 +346,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 - 23dfd5628aac5e91500730e48a91ab1fb553f397 blob + afa5bdf78876db639c2d76f70ed4ee8cd6e793c7 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -301,6 +301,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 - 207d9f20026688bdc8849f0125e73b94a285504e blob + 9848fc283aaafc5137c8cbdd288f9c58ca6793db --- gotwebd/parse.y +++ gotwebd/parse.y @@ -113,6 +113,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 @@ -407,7 +408,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 @@ -478,6 +495,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 }, }; @@ -909,6 +928,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;