]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WWW.pm
www: serve $INBOX_DIR/description as $INBOX_URL/description
[public-inbox.git] / lib / PublicInbox / WWW.pm
index 3ce7cc2a7b6ddb2ef74616898e60accd3f92b0ae..02b5ded32e9a2950508ef39ef5d7697603eebf1b 100644 (file)
@@ -85,6 +85,8 @@ sub call {
                invalid_inbox($ctx, $1) || get_atom($ctx);
        } elsif ($path_info =~ m!$INBOX_RE/new\.html\z!o) {
                invalid_inbox($ctx, $1) || get_new($ctx);
+       } elsif ($path_info =~ m!$INBOX_RE/description\z!o) {
+               get_description($ctx, $1);
        } elsif ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
                                ($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
                my ($epoch, $path) = ($2, $3);
@@ -621,4 +623,13 @@ sub get_css ($$$) {
        [ 200, $h, [ $css ] ];
 }
 
+sub get_description {
+       my ($ctx, $inbox) = @_;
+       invalid_inbox($ctx, $inbox) || do {
+               my $d = $ctx->{-inbox}->description . "\n";
+               [ 200, [ 'Content-Length', bytes::length($d),
+                       'Content-Type', 'text/plain' ], [ $d ] ];
+       };
+}
+
 1;