]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Implemented compression for service.
authorWill Budic <redacted>
Wed, 6 Dec 2023 22:42:56 +0000 (09:42 +1100)
committerWill Budic <redacted>
Wed, 6 Dec 2023 22:42:56 +0000 (09:42 +1100)
htdocs/cgi-bin/CNFServices.cgi
htdocs/cgi-bin/rss_feeds_setup.cnf
htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm

index 351392722773f762e3d21887b6301e16eeac7189..6464182bbc01e941e6eeccbaeebbe219e303c384 100755 (executable)
@@ -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     <DATA>
+<<    RSS_FEEDS     <DATA> __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.~
 >>
index 4d702d1777e296ef977c123901f2c6315368506e..7c043c52e9adeeaa6ab1603db751b3d88a36c901 100644 (file)
@@ -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
index 1a223df80afe61ba8c49ee11d450ede0322de328..9c1cafafe8327f9380dee1157645645ace338170 100644 (file)
@@ -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().'<div class="feed"><h2>List Of Feeds</h2><ol>';
-       for my $idx (1 .. $#data){
+       for my $idx (0 .. $#data){
            my @col = @{$data[$idx]};
-           $page .= qq|<li><span class="feeds_list_span">
-           <a onclick="return fetchFeed('$col[1]')" style="cursor: pointer;"> <b>$col[1]</b> </a></span>
-            &nbsp;&nbsp;[ $col[4] ]<dt style="padding:10px;">$col[3]</dt></li>\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|<li><span class="feeds_list_span">
+                <a onclick="return fetchFeed('$col[$hdr{Name}]')" style="cursor: pointer;"> <b>$col[$hdr{Name}]</b> </a></span>
+                    &nbsp;&nbsp;[ $col[$hdr{last_updated}] ]<dt style="padding:10px;">$col[$hdr{Description}]</dt></li>\n|;
+            }
        }
        $page .= '</ol></div>';
        $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;