#!/usr/bin/perl # Copyright René Wagner 2020 # licenced under BSD 3-Clause licence # https://src.clttr.info/rwa/orrgg use strict; no warnings 'experimental'; 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', '', undef); } write_response('SUCCESS', 'text/gemini', create_response()); exit; sub create_response { my @body = (); push @body, ('# recently visited feeds', ''); my $recents = recent_get(); if ( defined($recents) ) { foreach (@$recents) { my ($uri, $name) = split / /, $_, 2; push @body, '=> ./orrg.pl?'. uri_escape($uri) .' '. ($name eq '' ? $uri : $name); } } else { push @body, 'No feeds found'; } push @body, ('', '', '=> ./index.pl [home]'); return @body; }