From f8ec6323aa7658a071b95f3b452e34c547f87e4a Mon Sep 17 00:00:00 2001 From: Will Budic Date: Thu, 7 Dec 2023 09:42:56 +1100 Subject: [PATCH] Implemented compression for service. --- htdocs/cgi-bin/CNFServices.cgi | 28 ++++++++++++------- htdocs/cgi-bin/rss_feeds_setup.cnf | 4 ++- .../cgi-bin/system/modules/RSSFeedsPlugin.pm | 18 ++++++++---- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/htdocs/cgi-bin/CNFServices.cgi b/htdocs/cgi-bin/CNFServices.cgi index 3513927..6464182 100755 --- a/htdocs/cgi-bin/CNFServices.cgi +++ b/htdocs/cgi-bin/CNFServices.cgi @@ -67,8 +67,8 @@ cgi { # $p->{'service'} = ['feeds']; # $p->{'action'} = ['read']; # $p->{'feed'} = ['Life Hacker']; - # $p->{'setup'} = ['htdocs/cgi-bin/rss_feeds_setup.cnf']; - + #$p->{'setup'} = ['htdocs/cgi-bin/rss_feeds_setup.cnf']; + # $p->{'setup'} = ['rss_feeds_setup.cnf']; ## # This is a entry point script (main). @@ -153,27 +153,35 @@ LOG_Settings . <<__CNF_IS_COOL__; >> // Following is a table having a list of details for available RSS feeds to process. || The more rows have here the longer it takes to fetch them, what is it, once a day, week, month? -<< RSS_FEEDS +<< RSS_FEEDS __CONST__ ID`Name`URL`Expires`Description~ -#`CPAN`http://search.cpan.org/uploads.rdf`3 business days` -CPAN modules news and agenda.~ -#`The Perl Foundation RSS Feed`https://news.perlfoundation.org/rss.xml`3 business days` +#`CPAN`http://search.cpan.org/uploads.rdf` +3 business days`CPAN modules news and agenda.~ + +#`The Perl Foundation RSS Feed`https://news.perlfoundation.org/rss.xml` +3 business days` The Perl Foundation is dedicated to the advancement of the Perl programming language through open discussion, collaboration, design, and code. The Perl Foundation is a non-profit organization* based in Holland, Michigan~ -#`Perl Weekly`https://perlweekly.com/perlweekly.rss` `A free, once a week e-mail round-up of hand-picked news and articles about Perl. +#`Perl Weekly`https://perlweekly.com/perlweekly.rss` +`A free, once a week e-mail round-up of hand-picked news and articles about Perl. The Perl Weekly ( http://perlweekly.com/ ) is a newsletter including links to blog posts and other news items related to the Perl programming language.~ -#`The Cipher Brief RSS Feed`https://www.thecipherbrief.com/feed` `The Cipher Brief is the go-to digital platform for the latest security news and high-level analysis. Each day, we offer multiple expert perspectives, engaging the private sector to find solutions and foster dialogue on what events mean for businesses and organizations around the world. More than just reporting on the news, The Cipher Brief helps readers understand what the news means to you.~ + +#`The Cipher Brief RSS Feed`https://www.thecipherbrief.com/feed` +`The Cipher Brief is the go-to digital platform for the latest security news and high-level analysis. Each day, we offer multiple expert perspectives, engaging the private sector to find solutions and foster dialogue on what events mean for businesses and organizations around the world. More than just reporting on the news, The Cipher Brief helps readers understand what the news means to you.~ #`Viral Now`https://viralnow.uk/feed/`3 business days`ViralNow is a dynamic online platform at the forefront of curating and delivering trending and viral content. ViralNow brings you the latest and most engaging stories, videos, and articles from around the world.~ -#`The Sydney Morning Herald - World RSS Feed`http://www.smh.com.au/rssheadlines/world/article/rss.xml`1 business days` +#`The Sydney Morning Herald - World RSS Feed`http://www.smh.com.au/rssheadlines/world/article/rss.xml` +1 business days` The Sydney Morning Herald is Australia's leading news source. The Sydney Morning Herald sets the standard for journalistic excellence for Sydney, Australia, and the rest of the world. From breaking news, to travel and fashion, The Sydney Morning Herald continues to transform the way Australians get their news.~ -#`Life Hacker`https://lifehacker.com/feed/rss`3 business days`Lifehacker's is an award-winning daily blog that features tips, shortcuts, and downloads that help you work and live smarter and more efficiently.`~ +#`Life Hacker`https://lifehacker.com/feed/rss` +3 business days` +Lifehacker's is an award-winning daily blog that features tips, shortcuts, and downloads that help you work and live smarter and more efficiently.`~ #`Politico`http://www.politico.com/rss/politicopicks.xml`3 business days`POLITICO strives to be the dominant source for news on politics and policy in power centers across every continent where access to reliable information, nonpartisan journ.lism and real-time tools create, inform and engage a global citizenry.~ >> diff --git a/htdocs/cgi-bin/rss_feeds_setup.cnf b/htdocs/cgi-bin/rss_feeds_setup.cnf index 4d702d1..7c043c5 100644 --- a/htdocs/cgi-bin/rss_feeds_setup.cnf +++ b/htdocs/cgi-bin/rss_feeds_setup.cnf @@ -11,4 +11,6 @@ The Sydney Morning Herald is Australia's leading news source. The Sydney Morning 13 business days` Lifehacker's is an award-winning daily blog that features tips, shortcuts, and downloads that help you work and live smarter and more efficiently.`~ ->> \ No newline at end of file +>> + +Feeds now server side cached and compressed, for your browsing pleasure. \ No newline at end of file diff --git a/htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm b/htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm index 1a223df..9c1cafa 100644 --- a/htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm +++ b/htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm @@ -31,6 +31,8 @@ sub new ($class, $plugin){ return bless $settings, $class } +my %hdr; + ### # Process config data to contain expected fields. ### @@ -50,11 +52,18 @@ sub process ($self, $parser, $property) { } if($cgi&&$cgi->param('action') eq 'list'){ my $page = _css().'

List Of Feeds

    '; - for my $idx (1 .. $#data){ + for my $idx (0 .. $#data){ my @col = @{$data[$idx]}; - $page .= qq|
  1. - $col[1] -   [ $col[4] ]
    $col[3]
  2. \n|; + + if($idx==0){ + for my $i(0..$#col){ # Get the matching table column index names as scripted. + $hdr{$col[$i]} = $i + } + }else{ + $page .= qq|
  3. + $col[$hdr{Name}] +   [ $col[$hdr{last_updated}] ]
    $col[$hdr{Description}]
  4. \n|; + } } $page .= '
'; $parser->data()->{PAGE} = \$page @@ -80,7 +89,6 @@ __CSS sub collectFeeds($self, $parser) { my $property = $self->{property}; - my %hdr; my @data = @{$parser->data()->{$property}}; my $cgi = $parser->const('CGI'); my $page; -- 2.34.1