]> 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 e0fc90459d209b1a7299a550f09235723880d360..fb510b2848b6fc4351dfd1d217421cf99614a7db 100644 (file)
@@ -175,6 +175,14 @@ sub srv { # endpoint called by PublicInbox::WWW
                        ($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});