From: Nikolay Shaplov Date: Sun, 7 Jun 2026 16:49:52 +0000 (+0000) Subject: Cgi script for showing list of all available repos X-Git-Url: http://gitweb.nataraj.world/?a=commitdiff_plain;h=d526228e03bf5bc1c0d2e8690fcef1973c9e6bdf;p=git4ai.git Cgi script for showing list of all available repos --- diff --git a/cgi/git4ai-repos.pl b/cgi/git4ai-repos.pl new file mode 100755 index 0000000..4dbf1af --- /dev/null +++ b/cgi/git4ai-repos.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl +use strict; +use warnings; + +my $GIT_ROOT = '/var/lib/git'; +my $BASE_URL = 'https://gitweb.nataraj.world'; + +print "Content-Type: text/html; charset=utf-8\r\n"; +print "Cache-Control: no-store, no-cache, must-revalidate\r\n"; +print "\r\n"; + +opendir(my $dh, $GIT_ROOT) or die "Cannot open $GIT_ROOT: $!"; +my @repos = sort grep { /\.git$/ && -d "$GIT_ROOT/$_" } readdir($dh); +closedir($dh); + +print < + + +git repositories + + +

git repositories

+\n\n"; diff --git a/conf/nginx/git4ai b/conf/nginx/git4ai index c105b5c..b045aac 100644 --- a/conf/nginx/git4ai +++ b/conf/nginx/git4ai @@ -5,6 +5,7 @@ map $uri $git4ai_script { ~^/git4ai-log/ /srv/cgi/git4ai-log.pl; ~^/git4ai-ls-tree/ /srv/cgi/git4ai-ls-tree.pl; ~^/git4ai-branches/ /srv/cgi/git4ai-branches.pl; + ~^/git4ai-repos/ /srv/cgi/git4ai-repos.pl; ~^/git4ai/ /srv/cgi/git4ai.pl; } @@ -86,6 +87,11 @@ location ~ "^/git4ai-branches/([^/]+)$" { add_header Cache-Control "no-store" always; } +location ~ "^/git4ai-repos$" { + return 302 https://gitweb.nataraj.world/git4ai-repos/-/-/-/-/$request_id; + add_header Cache-Control "no-store" always; +} + # repo branch id offset nonce location ~ "^/git4ai[^/]*/([a-zA-Z0-9._-]+)/([a-zA-Z0-9._-]+|-)/([0-9a-f]{4,40}|-)/([0-9]+|-)(?:/([a-zA-Z0-9]+))?$" { set $git_repo $1;