user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 05/13] feed: add $INBOX/new.html endpoint
  2016-06-30  9:21  6% [PATCH 0/13] www: hybrid flat+thread conversation view Eric Wong
@ 2016-06-30  9:21  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-06-30  9:21 UTC (permalink / raw)
  To: meta

This acts like the Atom feed; but should be viewable directly
from browsers.
---
 lib/PublicInbox/Feed.pm | 27 +++++++++++++++++++++++++++
 lib/PublicInbox/WWW.pm  | 10 +++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index ddc1e3c..c16c417 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -34,6 +34,33 @@ sub generate_html_index {
 	sub { emit_html_index($_[0], $ctx) };
 }
 
+sub new_html {
+	my ($ctx) = @_;
+	my @paths;
+	my (undef, $last) = each_recent_blob($ctx, sub {
+		my ($path, $commit, $ts, $u, $subj) = @_;
+		$ctx->{first} ||= $commit;
+		push @paths, $path;
+	});
+	if (!@paths) {
+		return [404, ['Content-Type', 'text/plain'],
+			["No messages, yet\n"] ];
+	}
+	$ctx->{-html_tip} = '<pre>';
+	$ctx->{-upfx} = '';
+	my $res = PublicInbox::WwwStream->new($ctx, sub {
+		while (my $path = shift @paths) {
+			my $m = do_cat_mail($ctx->{-inbox}, $path) or next;
+			my $more = scalar @paths;
+			my $s = PublicInbox::View::index_entry($m, $ctx, $more);
+			$s .= '</pre>' unless $more;
+			return $s;
+		}
+		undef;
+	});
+	[ 200, ['Content-Type', 'text/html; charset=UTF-8'], $res ]
+}
+
 # private subs
 
 sub title_tag {
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 196486f..da5c1d3 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -75,7 +75,8 @@ sub call {
 		invalid_inbox($self, $ctx, $1) || get_index($ctx);
 	} elsif ($path_info =~ m!$INBOX_RE/(?:atom\.xml|new\.atom)\z!o) {
 		invalid_inbox($self, $ctx, $1) || get_atom($ctx);
-
+	} elsif ($path_info =~ m!$INBOX_RE/new\.html\z!o) {
+		invalid_inbox($self, $ctx, $1) || get_new($ctx);
 	} elsif ($path_info =~ m!$INBOX_RE/
 				($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
 		my $path = $2;
@@ -189,6 +190,13 @@ sub get_atom {
 	PublicInbox::Feed::generate($ctx);
 }
 
+# /$INBOX/new.html			-> HTML only
+sub get_new {
+	my ($ctx) = @_;
+	require PublicInbox::Feed;
+	PublicInbox::Feed::new_html($ctx);
+}
+
 # /$INBOX/?r=$GIT_COMMIT                 -> HTML only
 sub get_index {
 	my ($ctx) = @_;
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/13] www: hybrid flat+thread conversation view
@ 2016-06-30  9:21  6% Eric Wong
  2016-06-30  9:21  7% ` [PATCH 05/13] feed: add $INBOX/new.html endpoint Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-06-30  9:21 UTC (permalink / raw)
  To: meta

I've been long-dreaming of this and finally it's at least
publishable (I hope :x).  This flat view with thread skeletons
is 100% more usable than the dumb old one, but a little slower
(naturally :<)

I was originally hoping to remove the threaded /t/ endpoint
conversation view entirely to reduce server/caching overheads
but I still find it more usable in some situations.

What I still enjoy is being able to toggle between
[flat|threaded] views.

Eric Wong (13):
      www: implement hybrid flat+thread conversation view
      www: use WwwStream for dumping thread and search views
      view: show thread context in the thread-aware flat view
      view: merge $state hash with existing $ctx
      feed: add $INBOX/new.html endpoint
      view: tweak thread/index header slightly
      view: show more nearby messages in flat thread view
      www: reinstate old thread view as an option
      view: fix up some HTML injection via Message-ID vectors
      view: default to flat/hybrid thread display
      view: show thread size when linking to summary
      view: fixup bad reference to new_msgid
      www_stream: add response wrapper sub

 TODO                          |   2 -
 lib/PublicInbox/Feed.pm       |  51 +++-
 lib/PublicInbox/SearchView.pm | 141 +++++-----
 lib/PublicInbox/View.pm       | 590 +++++++++++++++++++++++-------------------
 lib/PublicInbox/WWW.pm        |  22 +-
 lib/PublicInbox/WwwStream.pm  |  20 +-
 t/view.t                      |   3 +-
 7 files changed, 464 insertions(+), 365 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-06-30  9:21  6% [PATCH 0/13] www: hybrid flat+thread conversation view Eric Wong
2016-06-30  9:21  7% ` [PATCH 05/13] feed: add $INBOX/new.html endpoint Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).