commit 89d2888f0c1880256b7e86745b75f7e282a7b54a
parent f1fa213eb470dbebf16dd42ce165726006a8e352
Author: René Wagner <rwagner@rw-net.de>
Date: Fri, 18 Dec 2020 19:12:25 +0100
add "random feed" function
the random feed function helps you exploring the
likes of others
Diffstat:
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/index.pl b/index.pl
@@ -4,7 +4,7 @@
# https://git.sr.ht/~rwa/orrg
use strict;
-use DBI;
+use URI::Escape;
use lib 'lib/';
use orrg;
@@ -23,5 +23,25 @@ exit;
sub body
{
- return ('# Welcome to orrg', '', 'orrg is your online rss/atom feed reader for gemini.', '', '=> orrg.pl view a feed', '', '## explore', '', '=> recent.pl top 10 recent feeds', '=> popular.pl top 10 popular feeds', '', '', '=> https://git.sr.ht/~rwa/orrg powered by orrg');
+ 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://git.sr.ht/~rwa/orrg powered by orrg');
}