about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwText.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/WwwText.pm')
-rw-r--r--lib/PublicInbox/WwwText.pm36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index 224fed5c..8279591a 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -7,7 +7,7 @@ use strict;
 use v5.10.1;
 use PublicInbox::Linkify;
 use PublicInbox::WwwStream;
-use PublicInbox::Hval qw(ascii_html prurl);
+use PublicInbox::Hval qw(ascii_html prurl fmt_ts);
 use HTTP::Date qw(time2str);
 use URI::Escape qw(uri_escape_utf8);
 use PublicInbox::GzipFilter qw(gzf_maybe);
@@ -37,7 +37,7 @@ sub get_text {
         }
         my $env = $ctx->{env};
         if ($raw) {
-                my $h = delete $ctx->{-res_hdr};
+                my $h = delete $ctx->{-res_hdr} // [];
                 $txt = gzf_maybe($h, $env)->zflush($txt) if $code == 200;
                 push @$h, 'Content-Type', 'text/plain',
                         'Content-Length', length($txt);
@@ -248,23 +248,24 @@ EOS
 
 sub coderepos_raw ($$) {
         my ($ctx, $top_url) = @_;
-        my $cr = $ctx->{ibx}->{coderepo} // return ();
         my $cfg = $ctx->{www}->{pi_cfg};
-        my @ret = ('Code repositories for project(s) associated with this '.
-                $ctx->{ibx}->thing_type . "\n");
-        for my $cr_name (@$cr) {
-                my $urls = $cfg->get_all("coderepo.$cr_name.cgiturl");
-                if ($urls) {
-                        for (@$urls) {
-                                my $u = m!\A(?:[a-z\+]+:)?//!i ? $_ :
-                                        $top_url.$_;
-                                $ret[0] .= "\n\t" . prurl($ctx->{env}, $u);
-                        }
-                } else {
-                        $ret[0] .= qq[\n\t$cr_name.git (no URL configured)];
+        my $cr = $cfg->repo_objs($ctx->{ibx}) or return ();
+        my $buf = 'Code repositories for project(s) associated with this '.
+                $ctx->{ibx}->thing_type . ":\n";
+        my @recs = PublicInbox::CodeSearch::repos_sorted($cfg, @$cr);
+        my $cr_score = $ctx->{ibx}->{-cr_score};
+        my $env = $ctx->{env};
+        for (@recs) {
+                my ($t, $git) = @$_;
+                for ($git->pub_urls($env)) {
+                        my $u = m!\A(?:[a-z\+]+:)?//!i ? $_ : $top_url.$_;
+                        my $nr = $cr_score->{$git->{nick}};
+                        $buf .= "\n";
+                        $buf .= $nr ? sprintf('% 9u', $nr) : (' 'x9);
+                        $buf .= ' '.fmt_ts($t).' '.prurl($env, $u);
                 }
         }
-        @ret; # may be empty, this sub is called as an arg for join()
+        ($buf);
 }
 
 sub _add_non_http_urls ($$) {
@@ -299,6 +300,9 @@ The POP3 password is: anonymous
 The POP3 username is: \$(uuidgen)\@$ctx->{ibx}->{newsgroup}
 where \$(uuidgen) in the output of the `uuidgen' command on your system.
 The UUID in the username functions as a private cookie (don't share it).
+By default, only 1000 messages are retrieved.  You may download more
+by appending `?limit=NUM' (without quotes) to the username, where
+`NUM' is an integer between 1 and 50000.
 Idle accounts will expire periodically.
 EOM
         }