aboutsummaryrefslogtreecommitdiff
path: root/p/api/pshb.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-16 13:05:43 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-16 13:05:43 +0200
commit3adab4b70fab858048bd68ed72e71676c4d5badf (patch)
treed920a83bc8aaca915bdde358e24ee84f52c3b139 /p/api/pshb.php
parent0163564b9e02bc399c26d3083048f38d3374cbd7 (diff)
More PubSubHubbub
https://github.com/FreshRSS/FreshRSS/issues/312 Show whether PubSubHubbub is enabled in the Web interface of feed configuration. When PubSubHubbub is used, do not pull refresh so often (hard-coded to max once per 24h for now). Improved logic for lease renewal, and some detection of lease problems. Updated read-me and changelog.
Diffstat (limited to 'p/api/pshb.php')
-rw-r--r--p/api/pshb.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/p/api/pshb.php b/p/api/pshb.php
index 6280c04ac..2f7f48cd8 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -57,8 +57,10 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
$leaseSeconds = empty($_REQUEST['hub_lease_seconds']) ? 0 : intval($_REQUEST['hub_lease_seconds']);
if ($leaseSeconds > 60) {
$hubJson['lease_end'] = time() + $leaseSeconds;
- file_put_contents('./!hub.json', json_encode($hubJson));
+ } else {
+ unset($hubJson['lease_end']);
}
+ file_put_contents('./!hub.json', json_encode($hubJson));
exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
}
@@ -84,7 +86,7 @@ $self = isset($links[0]) ? $links[0] : null;
if ($self !== base64url_decode($canonical64)) {
//header('HTTP/1.1 422 Unprocessable Entity');
- logMe('Warning: Self URL ' . $self . ' does not match registered canonical URL!: ' . base64url_decode($canonical64));
+ logMe('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64));
//die('Self URL does not match registered canonical URL!');
$self = base64url_decode($canonical64);
}
@@ -120,5 +122,5 @@ if ($nb === 0) {
die('Nobody is subscribed to this feed anymore after all!');
}
-logMe($self . ' done: ' . $nb);
+logMe('PubSubHubbub ' . $self . ' done: ' . $nb);
exit('Done: ' . $nb . "\n");