orrg

online rss & atom feed reader for gemini
git clone https://git.clttr.info/orrg.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 7eaf663655cd395a0c3b925142b7f07901a3cca4
parent 8d1d84dc5de30083cf64f405572ba62fe8d1da0a
Author: René Wagner <rwagner@rw-net.de>
Date:   Wed, 25 Nov 2020 21:52:40 +0100

tabify

again...

Diffstat:
Morrg.pl | 28++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/orrg.pl b/orrg.pl @@ -38,13 +38,13 @@ our %RC = ( if (!defined($ENV{'SERVER_PROTOCOL'}) || $ENV{'SERVER_PROTOCOL'} ne 'GEMINI') { - write_response('CGI_ERROR', '', undef); + write_response('CGI_ERROR', '', undef); } my $query = lc(uri_unescape($ENV{'QUERY_STRING'})); if ($query eq '' || $query !~ /^https\:\/\//) { - write_response('INPUT', 'Paste the URI of the rss feed you want to read:', undef); + write_response('INPUT', 'Paste the URI of the rss feed you want to read:', undef); } write_response('SUCCESS', 'text/gemini', create_response($query)); @@ -52,7 +52,7 @@ exit; sub create_response { - my ( $qs ) = @_; + my ( $qs ) = @_; my @body = (); my $feed = XML::FeedPP->new($qs, utf8_flag => 1); @@ -62,7 +62,7 @@ sub create_response return @body; } - push @body, '# '. $feed->title; + push @body, '# '. $feed->title; push @body, 'fetched '. strftime('%Y-%m-%dT%H:%M:%SZ', gmtime()); $feed->description eq '' or push @body, ('', $feed->description); $feed->image eq '' or push @body, '=> '. $feed->image .' feed image'; @@ -73,23 +73,23 @@ sub create_response push @body, '### '. $it->title; $it->pubDate eq '' or push @body, 'published '. $it->pubDate; push @body, ''; - $it->description eq '' or push @body, $it->description; + $it->description eq '' or push @body, $it->description; $it->link eq '' or push @body, ('=> '.$it->link.' open entry in browser', ''); } - - return @body; + + return @body; } sub write_response { - my ($returncode, $meta, @content) = @_; - + my ($returncode, $meta, @content) = @_; + if (!defined($RC{$returncode})) { die "Unknown response code!"; } - printf("%d %s\r\n", $RC{$returncode}, ($meta eq '') ? $returncode : $meta); - foreach (@content) { - print("$_\r\n"); - } + printf("%d %s\r\n", $RC{$returncode}, ($meta eq '') ? $returncode : $meta); + foreach (@content) { + print("$_\r\n"); + } - exit; + exit; }