Sfoglia il codice sorgente

Add core extension for Google Groups (#2838)

* Add core extension for Google Groups

#Fix https://github.com/FreshRSS/FreshRSS/issues/2835
Add ability to discover RSS feeds for Google Groups
Based on https://github.com/FreshRSS/FreshRSS/pull/2837

* Allow HTTP in addition of HTTPS
Alexandre Alapetite 6 anni fa
parent
commit
daa4922d90

+ 3 - 2
config.default.php

@@ -175,9 +175,10 @@ return array(
 	),
 
 	# List of enabled FreshRSS extensions.
-	'extensions_enabled' => array(
+	'extensions_enabled' => [
+		'Google-Groups' => true,
 		'Tumblr-GDPR' => true,
-	),
+	],
 
 	# Disable self-update,
 	'disable_update' => false,

+ 1 - 0
force-https.default.txt

@@ -8,6 +8,7 @@ fsfe.org
 github.com
 gitlab.com
 gnu.org
+google.com
 gravatar.com
 gstatic.com
 kernel.org

+ 3 - 0
lib/core-extensions/Google-Groups/README.md

@@ -0,0 +1,3 @@
+# Google Groups
+
+Needed for discovering RSS feeds from [Google Groups](https://groups.google.com).

+ 10 - 0
lib/core-extensions/Google-Groups/extension.php

@@ -0,0 +1,10 @@
+<?php
+class GoogleGroupsExtension extends Minz_Extension {
+	public function init() {
+		$this->registerHook('check_url_before_add', array('GoogleGroupsExtension', 'findFeed'));
+	}
+
+	public static function findFeed($url) {
+		return preg_replace('%^(https?://groups.google.com/forum)/#!forum/(.+)$%i', '$1/feed/$2/msgs/rss.xml', $url);
+	}
+}

+ 8 - 0
lib/core-extensions/Google-Groups/metadata.json

@@ -0,0 +1,8 @@
+{
+	"name": "Google-Groups",
+	"author": "Alkarex",
+	"description": "To discover RSS feeds for Google Groups",
+	"version": 1.0,
+	"entrypoint": "GoogleGroups",
+	"type": "system"
+}