aboutsummaryrefslogtreecommitdiff
path: root/p/api/pshb.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-24 11:06:20 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-01-24 11:06:20 +0100
commit0915772fe6735f6051c6b56a3b3e59dd3c44833b (patch)
tree8a993cdfc7975a2e8cf7a56b077a29beb528fd29 /p/api/pshb.php
parent9637e018bf0bdd17ecfabe825cb12ea9a67d7553 (diff)
PubSubHubbub unsubscribe request
https://github.com/FreshRSS/FreshRSS/issues/1058
Diffstat (limited to 'p/api/pshb.php')
-rw-r--r--p/api/pshb.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/p/api/pshb.php b/p/api/pshb.php
index 4bb4694b3..7de4cc1a2 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -68,6 +68,15 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
}
+if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') {
+ if (empty($hubJson['lease_end']) || $hubJson['lease_end'] < time()) {
+ exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
+ } else {
+ header('HTTP/1.1 422 Unprocessable Entity');
+ die('We did not ask to unsubscribe!');
+ }
+}
+
if ($ORIGINAL_INPUT == '') {
header('HTTP/1.1 422 Unprocessable Entity');
die('Missing XML payload!');