Skip to content

Commit

Permalink
Update naming to WebSub (FreshRSS#2184)
Browse files Browse the repository at this point in the history
Instead of PubSubHubbub / PuSH
  • Loading branch information
Alkarex committed Dec 16, 2018
1 parent 890d14b commit 7ccf7b5
Show file tree
Hide file tree
Showing 25 changed files with 62 additions and 47 deletions.
7 changes: 5 additions & 2 deletions README.fr.md
Expand Up @@ -8,9 +8,12 @@ FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de [Leed]

Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable.

Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture anonyme.
Il supporte les étiquettes personnalisées, et [PubSubHubbub](https://github.com/pubsubhubbub/PubSubHubbub) pour des notifications instantanées depuis les sites compatibles.
Il permet de gérer plusieurs utilisateurs, dispose d’un mode de lecture anonyme, et supporte les étiquettes personnalisées.
Il y a une API pour les clients (mobiles), ainsi qu’une [interface en ligne de commande](cli/README.md).

Grâce au standard [WebSub](https://www.w3.org/TR/websub/) (anciennement [PubSubHubbub](https://github.com/pubsubhubbub/PubSubHubbub)),
FreshRSS est capable de recevoir des notifications push instantanées depuis les sources compatibles, telles [Mastodon](https://joinmastodon.org), [Friendica](https://friendi.ca), [WordPress](https://wordpress.org/plugins/pubsubhubbub/), Blogger, FeedBurner, etc.

Enfin, il permet l’ajout d’[extensions](#extensions) pour encore plus de personnalisation.

Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont les bienvenues. Privilégiez pour cela des [demandes sur GitHub](https://github.com/FreshRSS/FreshRSS/issues).
Expand Down
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -8,9 +8,12 @@ FreshRSS is a self-hosted RSS feed aggregator like [Leed](http://leed.idleman.fr

It is lightweight, easy to work with, powerful, and customizable.

It is a multi-user application with an anonymous reading mode.
It supports custom tags, and [PubSubHubbub](https://github.com/pubsubhubbub/PubSubHubbub) for instant notifications from compatible Web sites.
It is a multi-user application with an anonymous reading mode. It supports custom tags.
There is an API for (mobile) clients, and a [Command-Line Interface](cli/README.md).

Thanks to the [WebSub](https://www.w3.org/TR/websub/) standard (formerly [PubSubHubbub](https://github.com/pubsubhubbub/PubSubHubbub)),
FreshRSS is able to receive instant push notifications from compatible sources, such as [Mastodon](https://joinmastodon.org), [Friendica](https://friendi.ca), [WordPress](https://wordpress.org/plugins/pubsubhubbub/), Blogger, FeedBurner, etc.

Finally, it supports [extensions](#extensions) for further tuning.

Feature requests, bug reports, and other contributions are welcome. The best way to contribute is to [open an issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues).
Expand Down
12 changes: 6 additions & 6 deletions app/Controllers/feedController.php
Expand Up @@ -266,7 +266,7 @@ public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush
$nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1);
$date_min = time() - (3600 * 24 * 30 * $nb_month_old);

// PubSubHubbub support
// WebSub (PubSubHubbub) support
$pubsubhubbubEnabledGeneral = FreshRSS_Context::$system_conf->pubsubhubbub_enabled;
$pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration.

Expand Down Expand Up @@ -437,13 +437,13 @@ public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush
$entryDAO->commit();
}

if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for PubSubHubbub
if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for WebSub
if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs
$selfUrl = checkUrl($feed->selfUrl());
if ($selfUrl) {
Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url(false));
Minz_Log::debug('WebSub unsubscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe
Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url(false));
Minz_Log::warning('Error while WebSub unsubscribing from ' . $feed->url(false));
}
$feed->_url($selfUrl, false);
Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url(false));
Expand All @@ -457,9 +457,9 @@ public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush

$feed->faviconPrepare();
if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) {
Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url(false));
Minz_Log::notice('WebSub subscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe
Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url(false));
Minz_Log::warning('Error while WebSub subscribing to ' . $feed->url(false));
}
}
$feed->unlock();
Expand Down
18 changes: 9 additions & 9 deletions app/Models/Feed.php
Expand Up @@ -498,7 +498,7 @@ public function unlock() {
@unlink($this->lockPath);
}

//<PubSubHubbub>
//<WebSub>

public function pubSubHubbubEnabled() {
$url = $this->selfUrl ? $this->selfUrl : $this->url;
Expand Down Expand Up @@ -534,13 +534,13 @@ public function pubSubHubbubPrepare() {
if ($hubFile = @file_get_contents($hubFilename)) {
$hubJson = json_decode($hubFile, true);
if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) {
$text = 'Invalid JSON for PubSubHubbub: ' . $this->url;
$text = 'Invalid JSON for WebSub: ' . $this->url;
Minz_Log::warning($text);
Minz_Log::warning($text, PSHB_LOG);
return false;
}
if ((!empty($hubJson['lease_end'])) && ($hubJson['lease_end'] < (time() + (3600 * 23)))) { //TODO: Make a better policy
$text = 'PubSubHubbub lease ends at '
$text = 'WebSub lease ends at '
. date('c', empty($hubJson['lease_end']) ? time() : $hubJson['lease_end'])
. ' and needs renewal: ' . $this->url;
Minz_Log::warning($text);
Expand All @@ -560,7 +560,7 @@ public function pubSubHubbubPrepare() {
file_put_contents($hubFilename, json_encode($hubJson));
@mkdir(PSHB_PATH . '/keys/');
file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl));
$text = 'PubSubHubbub prepared for ' . $this->url;
$text = 'WebSub prepared for ' . $this->url;
Minz_Log::debug($text);
Minz_Log::debug($text, PSHB_LOG);
}
Expand All @@ -579,17 +579,17 @@ public function pubSubHubbubSubscribe($state) {
$hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json';
$hubFile = @file_get_contents($hubFilename);
if ($hubFile === false) {
Minz_Log::warning('JSON not found for PubSubHubbub: ' . $this->url);
Minz_Log::warning('JSON not found for WebSub: ' . $this->url);
return false;
}
$hubJson = json_decode($hubFile, true);
if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key']) || empty($hubJson['hub'])) {
Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url);
Minz_Log::warning('Invalid JSON for WebSub: ' . $this->url);
return false;
}
$callbackUrl = checkUrl(Minz_Request::getBaseUrl() . '/api/pshb.php?k=' . $hubJson['key']);
if ($callbackUrl == '') {
Minz_Log::warning('Invalid callback for PubSubHubbub: ' . $this->url);
Minz_Log::warning('Invalid callback for WebSub: ' . $this->url);
return false;
}
if (!$state) { //unsubscribe
Expand Down Expand Up @@ -618,7 +618,7 @@ public function pubSubHubbubSubscribe($state) {
$response = curl_exec($ch);
$info = curl_getinfo($ch);

Minz_Log::warning('PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $url .
Minz_Log::warning('WebSub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $url .
' via hub ' . $hubJson['hub'] .
' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response, PSHB_LOG);

Expand All @@ -634,5 +634,5 @@ public function pubSubHubbubSubscribe($state) {
return false;
}

//</PubSubHubbub>
//</WebSub>
}
2 changes: 1 addition & 1 deletion app/i18n/cz/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Zobrazit ve “Všechny kanály”',
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Okamžité oznámení s PubSubHubbub',
'websub' => 'Okamžité oznámení s WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/de/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'In Haupt-Feeds zeigen',
'normal' => 'Zeige in eigener Kategorie',
),
'pubsubhubbub' => 'Sofortbenachrichtigung mit PubSubHubbub',
'websub' => 'Sofortbenachrichtigung mit WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/en/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Show in main stream',
'normal' => 'Show in its category',
),
'pubsubhubbub' => 'Instant notification with PubSubHubbub',
'websub' => 'Instant notification with WebSub',
'show' => array(
'all' => 'Show all feeds',
'error' => 'Show only feeds with error',
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/es/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Mostrar en salida principal',
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Notificación inmedaiata con PubSubHubbub',
'websub' => 'Notificación inmedaiata con WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/fr/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Afficher dans le flux principal',
'normal' => 'Afficher dans sa catégorie',
),
'pubsubhubbub' => 'Notification instantanée par PubSubHubbub',
'websub' => 'Notification instantanée par WebSub',
'show' => array(
'all' => 'Montrer tous les flux',
'error' => 'Montrer seulement les flux en erreur',
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/he/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'הצגה בזרם המרכזי',
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Instant notification with PubSubHubbub', //TODO - Translation
'websub' => 'Instant notification with WebSub', //TODO - Translation
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/it/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Mostra in homepage', //TODO - Translation
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Notifica istantanea con PubSubHubbub',
'websub' => 'Notifica istantanea con WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/kr/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => '메인 스트림에 표시하기',
'normal' => '피드가 속한 카테고리에만 표시하기',
),
'pubsubhubbub' => 'PubSubHubbub을 사용한 즉시 알림',
'websub' => 'WebSub을 사용한 즉시 알림',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/nl/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Zichtbaar in het overzicht',
'normal' => 'Toon in categorie',
),
'pubsubhubbub' => 'Directe notificaties met PubSubHubbub',
'websub' => 'Directe notificaties met WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/oc/sub.php
Expand Up @@ -44,7 +44,7 @@
'main_stream' => 'Mostar al flux màger',
'normal' => 'Mostar dins sa categoria',
),
'pubsubhubbub' => 'Notificaciones instantáneas amb PubSubHubbub',
'websub' => 'Notificaciones instantáneas amb WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/pt-br/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Mostrar na tela principal',
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Notificação instantânea com PubSubHubbub',
'websub' => 'Notificação instantânea com WebSub',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/ru/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Show in main stream', //TODO - Translation
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'Instant notification with PubSubHubbub', //TODO - Translation
'websub' => 'Instant notification with WebSub', //TODO - Translation
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/tr/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => 'Ana akışda göster',
'normal' => 'Show in its category', //TODO - Translation
),
'pubsubhubbub' => 'PubSubHubbub ile anlık bildirim',
'websub' => 'WebSub ile anlık bildirim',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/zh-cn/sub.php
Expand Up @@ -45,7 +45,7 @@
'main_stream' => '在首页中显示',
'normal' => '在分类中显示',
),
'pubsubhubbub' => 'PubSubHubbub 即时通知',
'websub' => 'WebSub 即时通知',
'show' => array(
'all' => 'Show all feeds', //TODO - Translation
'error' => 'Show only feeds with error', //TODO - Translation
Expand Down
2 changes: 1 addition & 1 deletion app/views/helpers/feed/update.phtml
Expand Up @@ -133,7 +133,7 @@
</div>
</div>
<div class="form-group">
<label class="group-name" for="pubsubhubbub"><?php echo _t('sub.feed.pubsubhubbub'); ?></label>
<label class="group-name" for="pubsubhubbub"><?php echo _t('sub.feed.websub'); ?></label>
<div class="group-controls">
<label class="checkbox" for="pubsubhubbub">
<input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1"<?php echo $this->feed->pubSubHubbubEnabled() ? ' checked="checked"' : ''; ?> />
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Expand Up @@ -38,7 +38,7 @@ cd /usr/share/FreshRSS
./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net --language en --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss )
# --auth_type can be: 'form' (default), 'http_auth' (using the Web server access control), 'none' (dangerous)
# --db-type can be: 'sqlite' (default), 'mysql' (MySQL or MariaDB), 'pgsql' (PostgreSQL)
# --base_url should be a public (routable) URL if possible, and is used for push (PubSubHubbub), for some API functions (e.g. favicons), and external URLs in FreshRSS.
# --base_url should be a public (routable) URL if possible, and is used for push (WebSub), for some API functions (e.g. favicons), and external URLs in FreshRSS.
# --environment can be: 'production' (default), 'development' (for additional log messages)
# --language can be: 'en' (default), 'fr', or one of the [supported languages](../app/i18n/)
# --db-prefix is an optional prefix in front of the names of the tables. We suggest using 'freshrss_'
Expand Down
2 changes: 1 addition & 1 deletion config.default.php
Expand Up @@ -12,7 +12,7 @@
'salt' => '',

# Specify address of the FreshRSS instance,
# used when building absolute URLs, e.g. for PubSubHubbub.
# used when building absolute URLs, e.g. for WebSub.
# Examples:
# https://example.net/FreshRSS/p/
# https://freshrss.example.net/
Expand Down
2 changes: 1 addition & 1 deletion docs/en/users/05_Configuration.md
Expand Up @@ -132,7 +132,7 @@ At the moment, there is no helper to build a user query from here.

1. User control is based on the `.htaccess` file.
2. It is best practice to place the `.htaccess` file in the `./i/` subdirectory so the API and other third party services can work.
3. If you want to limit all access to registered users only, place the file in the FreshRSS directory itself or in a parent directory. Note that PubsubHubbub and API will not work!
3. If you want to limit all access to registered users only, place the file in the FreshRSS directory itself or in a parent directory. Note that WebSub and API will not work!
4. Example `.htaccess` file for a user "marie":

```
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/contributing.md
Expand Up @@ -15,6 +15,6 @@ Vous pouvez notamment regarder [les tickets ouverts avec le tag "Documentation"]

## Contribuer au blog

Vous souhaitez écrire un article à propos des technologies RSS/Atom/PubSubHubbub ou tout simplement nous donner un coup de main à la rédaction d'un billet ? Vous pouvez nous aider !
Vous souhaitez écrire un article à propos des technologies RSS/Atom/WebSub ou tout simplement nous donner un coup de main à la rédaction d'un billet ? Vous pouvez nous aider !

Pour cela, il suffit de vous rendre sur le dépôt GitHub [FreshRSS/freshrss.org](https://github.com/FreshRSS/freshrss.org) et de nous proposer une « Pull Request ». Les articles de blog doivent se trouver dans le répertoire `./blog` et être écrits en Markdown.
23 changes: 16 additions & 7 deletions docs/fr/users/08_PubSubHubbub.md
@@ -1,15 +1,24 @@
# Qu'est-ce que PubSubHubbub ?
# Quest-ce que [WebSub](https://www.w3.org/TR/websub/) ?

Derrière ce nom barbare se cache un protocole qui vient compléter Atom et RSS. En effet, le fonctionnement de base de ces deux derniers implique de vérifier à intervalles réguliers s'il existe de nouveaux articles sur les sites suivis. Cela même si le site concerné n'a rien publié depuis la dernière synchronisation. Le protocole PubSubHubbub permet d'éviter des synchronisations inutiles en notifiant en temps réel l'agrégateur de la présence de nouveaux articles.
Derrière ce nom (anciennement [PubSubHubbub](https://github.com/pubsubhubbub/PubSubHubbub)) se cache un protocole qui vient compléter Atom et RSS.
En effet, le fonctionnement de base de ces deux derniers implique de vérifier à intervalles réguliers s’il existe de nouveaux articles sur les sites suivis.
Cela même si le site concerné n’a rien publié depuis la dernière synchronisation.
Le [protocole WebSub](https://www.w3.org/TR/websub/) permet d’éviter des synchronisations inutiles en notifiant en temps réel l’agrégateur de la présence de nouveaux articles.

# Fonctionnement de PubSubHubbub
# Fonctionnement de WebSub

On va retrouver trois notions dans PubSubHubbub : les éditeurs (les sites qui publient du contenu), les abonnés (les agrégateurs de flux RSS) et les hubs.
On va retrouver trois notions dans WebSub : les éditeurs (les sites qui publient du contenu), les abonnés (les agrégateurs de flux RSS) et les hubs.

Lorsqu'un agrégateur s'abonne à un site et récupère son flux RSS, il peut y trouver l'adresse d'un hub. Si c'est le cas — car un site peut ne pas en préciser —, l'agrégateur va s'abonner au hub et non pas à l'éditeur directement. Ainsi, lorsqu'un éditeur va publier du contenu, il va notifier le hub qui va lui-même notifier et envoyer le contenu à tous ses abonnés.
Lorsqu’un agrégateur s’abonne à un site et récupère son flux RSS, il peut y trouver l’adresse d’un hub.
Si c’est le cas — car un site peut ne pas en préciser —, l’agrégateur va s’abonner au hub et non pas à l’éditeur directement.
Ainsi, lorsqu’un éditeur va publier du contenu, il va notifier le hub qui va lui-même notifier et envoyer le contenu à tous ses abonnés.

Pour pouvoir être notifié, les abonnés doivent fournir une adresse accessible publiquement sur Internet.

# PubSubHubbub et FreshRSS
# WebSub et FreshRSS

Depuis la version 1.1.2-beta, FreshRSS supporte officiellement PubSubHubbub. Vous pouvez donc recevoir en temps réel les articles des sites qui affichent dans leur flux RSS un « hub ».
Depuis la version 1.1.2-beta, FreshRSS supporte officiellement WebSub.
Vous pouvez donc recevoir en temps réel les articles des sites qui affichent dans leur flux RSS un « hub »,
tels [Mastodon](https://joinmastodon.org), [Friendica](https://friendi.ca), WordPress (WordPress.com ou avec [une extension](https://wordpress.org/plugins/pubsubhubbub/)), Blogger, FeedBurner, Slashdot, etc.

Vous pouvez tester avec http://push-pub.appspot.com.
4 changes: 2 additions & 2 deletions p/api/pshb.php
Expand Up @@ -79,7 +79,7 @@
}
$hubJson['lease_start'] = time();
if (!isset($hubJson['error'])) {
$hubJson['error'] = true; //Do not assume that PubSubHubbub works until the first successul push
$hubJson['error'] = true; //Do not assume that WebSub works until the first successul push
}
file_put_contents('./!hub.json', json_encode($hubJson));
header('Connection: close');
Expand Down Expand Up @@ -162,5 +162,5 @@
file_put_contents('./!hub.json', json_encode($hubJson));
}

Minz_Log::notice('PubSubHubbub ' . $self . ' done: ' . $nb, PSHB_LOG);
Minz_Log::notice('WebSub ' . $self . ' done: ' . $nb, PSHB_LOG);
exit('Done: ' . $nb . "\n");

0 comments on commit 7ccf7b5

Please sign in to comment.