aboutsummaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-06-09 15:58:18 +0200
committerGravatar GitHub <noreply@github.com> 2018-06-09 15:58:18 +0200
commit6a56894e940db0b1f7ee6788fbc38f26c80d004d (patch)
treea0ef3d306ee3f0aa02a7addbb743af9863565691 /extensions
parent32676d59a386fe067ae0beac0287c700274f3d57 (diff)
New extension event + Tumblr GDPR (#1924)
* New extension event + Tumblr GDPR https://github.com/FreshRSS/FreshRSS/issues/1894 simplepie_before_init event * Refactor extension enabling + Tumblr GDPR enabled by default Add possibility for extensions to be enabled by default, and disabled back by users. * Minor whitespace
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Tumblr-GDPR/README.md4
-rw-r--r--extensions/Tumblr-GDPR/extension.php13
-rw-r--r--extensions/Tumblr-GDPR/metadata.json8
3 files changed, 25 insertions, 0 deletions
diff --git a/extensions/Tumblr-GDPR/README.md b/extensions/Tumblr-GDPR/README.md
new file mode 100644
index 000000000..fc5e4dd50
--- /dev/null
+++ b/extensions/Tumblr-GDPR/README.md
@@ -0,0 +1,4 @@
+# Tumblr-GDPR
+
+Needed for accessing [Tumblr](https://www.tumblr.com/) RSS feeds from the European Union:
+bypass the [GPDR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation) check, implying consent.
diff --git a/extensions/Tumblr-GDPR/extension.php b/extensions/Tumblr-GDPR/extension.php
new file mode 100644
index 000000000..7a7708c9f
--- /dev/null
+++ b/extensions/Tumblr-GDPR/extension.php
@@ -0,0 +1,13 @@
+<?php
+
+class TumblrGdprExtension extends Minz_Extension {
+ public function init() {
+ $this->registerHook('simplepie_before_init', array('TumblrGdprExtension', 'curlHook'));
+ }
+
+ public static function curlHook($simplePie, $feed) {
+ if (preg_match('#^https?://[a-zA-Z_0-9-]+.tumblr.com/#i', $feed->url())) {
+ $simplePie->set_useragent(FRESHRSS_USERAGENT . ' like Googlebot');
+ }
+ }
+}
diff --git a/extensions/Tumblr-GDPR/metadata.json b/extensions/Tumblr-GDPR/metadata.json
new file mode 100644
index 000000000..b5c33787b
--- /dev/null
+++ b/extensions/Tumblr-GDPR/metadata.json
@@ -0,0 +1,8 @@
+{
+ "name": "Tumblr-GDPR",
+ "author": "Alkarex",
+ "description": "Bypass Tumblr’ GPDR check (implying consent) for the European Union",
+ "version": 1.0,
+ "entrypoint": "TumblrGdpr",
+ "type": "system"
+}