From 39541f8ebd970e5f737d30911ee863e27e39d4ca Mon Sep 17 00:00:00 2001 From: Nikolay Shaplov Date: Sun, 7 Jun 2026 14:22:13 +0000 Subject: [PATCH] More link fixed, proper redirect for ls-tree --- cgi/git4ai-log.pl | 2 +- cgi/git4ai-ls-tree.pl | 6 +++--- cgi/git4ai.pl | 4 ++-- conf/nginx/git4ai | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/cgi/git4ai-log.pl b/cgi/git4ai-log.pl index ed55b5f..0046463 100755 --- a/cgi/git4ai-log.pl +++ b/cgi/git4ai-log.pl @@ -74,7 +74,7 @@ print "DiffДеревоДатаАвтор{hash}, 0, 8); my $show_url = "$BASE_URL/git4ai-show/$repo/$c->{hash}"; - my $tree_url = "$BASE_URL/git4ai-ls-tree/$repo/$c->{hash}/0/r$rand"; + my $tree_url = "$BASE_URL/git4ai-ls-tree/$repo/$c->{hash}"; print ""; print "$short"; print "tree"; diff --git a/cgi/git4ai-ls-tree.pl b/cgi/git4ai-ls-tree.pl index 137ed05..06ba1f6 100755 --- a/cgi/git4ai-ls-tree.pl +++ b/cgi/git4ai-ls-tree.pl @@ -64,16 +64,16 @@ print <Файлов: $total, показаны $offset — @{[$offset + scalar @page]}

HTML -print "← выше   " +print "← выше   " if $offset > 0; -print "ниже →" +print "ниже →" if $next < $total; print "\n\n"; print "\n"; for my $f (@page) { - my $raw_url = "$BASE_URL/gitai-cat-file/$repo/$f->{hash}/r$rand"; + my $raw_url = "$BASE_URL/git4ai-cat-file/$repo/$f->{hash}"; my $short = substr($f->{hash}, 0, 8); printf "\n", $raw_url, $short, $f->{size}, $f->{name}; diff --git a/cgi/git4ai.pl b/cgi/git4ai.pl index 8823a8d..5dd4f49 100755 --- a/cgi/git4ai.pl +++ b/cgi/git4ai.pl @@ -22,7 +22,7 @@ print < -gitai: $repo / $branch +git4ai: $repo / $branch @@ -32,7 +32,7 @@ print <Прочитав коммит лог, ты сможешь посмотреть на ls-tree для заданного коммита по ссылке вида https://gitweb.nataraj.world/git4ai-ls-tree/$repo/[commit_id]

-

Так же посмотреть на блобы упомянуте в ls-tree по ссылке вида https://gitweb.nataraj.world/gitai-raw/$repo/[blob_id]

+

Так же посмотреть на блобы упомянуте в ls-tree по ссылке вида https://gitweb.nataraj.world/git4ai-raw/$repo/[blob_id]

А так же на diff самих коммитов по ссылке вида https://gitweb.nataraj.world/git4ai-show/$repo/[commit_id]

diff --git a/conf/nginx/git4ai b/conf/nginx/git4ai index 510d72c..0a2ed2b 100644 --- a/conf/nginx/git4ai +++ b/conf/nginx/git4ai @@ -119,6 +119,24 @@ location ~ "^/git4ai/([^/]+)/([^/]+)$" { rewrite ^/git4ai/([^/]+)/([^/]+)$ /git4ai/$1/$2/-/- last; } + +location ~ "^/git4ai-show/([^/]+)/([^/]+)$" { + rewrite ^/git4ai-show/([^/]+)/([^/]+)$ /git4ai-show/$1/-/$2/- last; +} + + +# repo id +location ~ "^/git4ai-ls-tree/([^/]+)/([^/]+)$" { + return 302 https://gitweb.nataraj.world/git4ai-ls-tree/$1/-/$2/0/$request_id; + add_header Cache-Control "no-store" always; +} + +# repo id offset +location ~ "^/git4ai-ls-tree/([^/]+)/([^/]+)/([^/]+)$" { + return 302 https://gitweb.nataraj.world/git4ai-ls-tree/$1/-/$2/$3/$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; -- 2.47.3
БлобРазмерФайл
%s%s%s