online rss & atom feed reader for gemini
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

51 lines
1.1 KiB

#!/usr/bin/perl
# Copyright René Wagner 2020
# licenced under BSD 3-Clause licence
# https://src.clttr.info/rwa/orrg
use strict;
use URI::Escape;
use lib 'lib/';
use orrg;
# enable UTF-8 mode for everything
use utf8;
binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';
if (!defined($ENV{'SERVER_PROTOCOL'}) || $ENV{'SERVER_PROTOCOL'} ne 'GEMINI') {
write_response('CGI_ERROR', 'CGI execution error', undef);
}
if ($ENV{'QUERY_STRING'} ne '' || $ENV{'PATH_INFO'} ne '') {
write_response('NOT_FOUND', 'File not found', undef);
}
write_response('SUCCESS', 'text/gemini', body());
exit;
sub body
{
my ($cnt, $uri, $name);
my $populars = popular_get();
if ( defined($populars) ) {
($cnt, $uri, $name) = split / /, @$populars[ rand @$populars ], 3;
}
return (
'# Welcome to orrg',
'',
'orrg is your online rss/atom feed reader for gemini.',
'',
'=> ./orrg.pl view a feed',
'',
'## explore',
'',
'=> ./orrg.pl?'. uri_escape($uri) .' random feed',
'=> ./recent.pl top 10 recent feeds',
'=> ./popular.pl top 10 popular feeds',
'',
'',
'=> https://src.clttr.info/rwa/orrg powered by orrg');
}