]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwCoderepo.pm
www_coderepo: wire up snapshot support
[public-inbox.git] / lib / PublicInbox / WwwCoderepo.pm
index 4b1a4f9baeb2b00ad03e84a35122605e58ecaa81..fb510b2848b6fc4351dfd1d217421cf99614a7db 100644 (file)
@@ -171,6 +171,18 @@ sub srv { # endpoint called by PublicInbox::WWW
        }
        $path_info =~ m!\A/(.+?)/\z! and
                ($ctx->{git} = $self->{"\0$1"}) and return summary($self, $ctx);
+       $path_info =~ m!\A/(.+?)/([a-f0-9]+)/s/\z! and
+                       ($ctx->{git} = $self->{"\0$1"}) and
+               return PublicInbox::ViewVCS::show($ctx, $2);
+
+       # snapshots:
+       if ($path_info =~ m!\A/(.+?)/snapshot/([^/]+)\z! and
+                       ($ctx->{git} = $self->{"\0$1"})) {
+               require PublicInbox::RepoSnapshot;
+               return PublicInbox::RepoSnapshot::srv($ctx, $2) // r(404);
+       }
+
+       # enforce trailing slash:
        if ($path_info =~ m!\A/(.+?)\z! and ($git = $self->{"\0$1"})) {
                my $qs = $ctx->{env}->{QUERY_STRING};
                my $url = $git->base_url($ctx->{env});