Skip to content

A free, self-hostable news aggregator…

WebSub fix POST, fix warning, better message (#9420)

Alexandre Alapetitec7c53f4576a8
diff --git a/README.fr.md b/README.fr.md
index 0ac2e3ce5..42320f141 100644
--- a/README.fr.md
+++ b/README.fr.md
@@ -236,33 +236,33 @@ Voir le [dépôt dédié à ces extensions](https://github.com/FreshRSS/Extensio
| Langage | Progression | |
| - | - | - |
-| Azərbaycanca (az) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Faz+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Беларуская (be) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fbe+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Azərbaycanca (az) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Faz+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Беларуская (be) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fbe+%2F%28TODO%7CDIRTY%29%24%2F) |
| Čeština (cs) | ■■■■■■■■・・ 81% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fcs+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Deutsch (de) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fde+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Deutsch (de) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fde+%2F%28TODO%7CDIRTY%29%24%2F) |
| Ελληνικά (el) | ■■■■■■■・・・ 75% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fel+%2F%28TODO%7CDIRTY%29%24%2F) |
| English (en) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen+%2F%28TODO%7CDIRTY%29%24%2F) |
| English (United States) (en-US) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen-US+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Español (es) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Español (es) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) |
| فارسی (fa) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffa+%2F%28TODO%7CDIRTY%29%24%2F) |
| Suomi (fi) | ■■■■■■■■■・ 91% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) |
| Français (fr) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffr+%2F%28TODO%7CDIRTY%29%24%2F) |
| עברית (he) | ■■■■・・・・・・ 41% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhe+%2F%28TODO%7CDIRTY%29%24%2F) |
| Magyar (hu) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhu+%2F%28TODO%7CDIRTY%29%24%2F) |
| Bahasa Indonesia (id) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fid+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Italiano (it) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fit+%2F%28TODO%7CDIRTY%29%24%2F) |
-| 日本語 (ja) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fja+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Italiano (it) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fit+%2F%28TODO%7CDIRTY%29%24%2F) |
+| 日本語 (ja) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fja+%2F%28TODO%7CDIRTY%29%24%2F) |
| 한국어 (ko) | ■■■■■■■■・・ 80% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fko+%2F%28TODO%7CDIRTY%29%24%2F) |
| Lietuvių (lt) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Flt+%2F%28TODO%7CDIRTY%29%24%2F) |
| Latviešu (lv) | ■■■■■■■■・・ 81% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Flv+%2F%28TODO%7CDIRTY%29%24%2F) |
| Nederlands (nl) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fnl+%2F%28TODO%7CDIRTY%29%24%2F) |
| Occitan (oc) | ■■■■■■■・・・ 73% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Foc+%2F%28TODO%7CDIRTY%29%24%2F) |
| Polski (pl) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpl+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Português (Brasil) (pt-BR) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-BR+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Português (Brasil) (pt-BR) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-BR+%2F%28TODO%7CDIRTY%29%24%2F) |
| Português (Portugal) (pt-PT) | ■■■■■■■■・・ 80% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-PT+%2F%28TODO%7CDIRTY%29%24%2F) |
| Русский (ru) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fru+%2F%28TODO%7CDIRTY%29%24%2F) |
| Slovenčina (sk) | ■■■■■■■■・・ 81% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fsk+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Türkçe (tr) | ■■■■■■■■■■ 100% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ftr+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Türkçe (tr) | ■■■■■■■■■・ 99% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ftr+%2F%28TODO%7CDIRTY%29%24%2F) |
| Українська (uk) | ■■■■■■■■■・ 98% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fuk+%2F%28TODO%7CDIRTY%29%24%2F) |
| 简体中文 (zh-CN) | ■■■■■■■■■・ 96% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fzh-CN+%2F%28TODO%7CDIRTY%29%24%2F) |
| 正體中文 (zh-TW) | ■■■■■■■■■・ 97% | [contribuer](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fzh-TW+%2F%28TODO%7CDIRTY%29%24%2F) |
diff --git a/README.md b/README.md
index a2af7d456..eaf58c940 100644
--- a/README.md
+++ b/README.md
@@ -132,33 +132,33 @@ See the [repository dedicated to those extensions](https://github.com/FreshRSS/E
| Language | Progress | |
| - | - | - |
-| Azərbaycanca (az) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Faz+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Беларуская (be) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fbe+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Azərbaycanca (az) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Faz+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Беларуская (be) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fbe+%2F%28TODO%7CDIRTY%29%24%2F) |
| Čeština (cs) | ■■■■■■■■・・ 81% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fcs+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Deutsch (de) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fde+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Deutsch (de) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fde+%2F%28TODO%7CDIRTY%29%24%2F) |
| Ελληνικά (el) | ■■■■■■■・・・ 75% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fel+%2F%28TODO%7CDIRTY%29%24%2F) |
| English (en) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen+%2F%28TODO%7CDIRTY%29%24%2F) |
| English (United States) (en-US) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fen-US+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Español (es) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Español (es) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fes+%2F%28TODO%7CDIRTY%29%24%2F) |
| فارسی (fa) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffa+%2F%28TODO%7CDIRTY%29%24%2F) |
| Suomi (fi) | ■■■■■■■■■・ 91% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffi+%2F%28TODO%7CDIRTY%29%24%2F) |
| Français (fr) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ffr+%2F%28TODO%7CDIRTY%29%24%2F) |
| עברית (he) | ■■■■・・・・・・ 41% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhe+%2F%28TODO%7CDIRTY%29%24%2F) |
| Magyar (hu) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fhu+%2F%28TODO%7CDIRTY%29%24%2F) |
| Bahasa Indonesia (id) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fid+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Italiano (it) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fit+%2F%28TODO%7CDIRTY%29%24%2F) |
-| 日本語 (ja) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fja+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Italiano (it) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fit+%2F%28TODO%7CDIRTY%29%24%2F) |
+| 日本語 (ja) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fja+%2F%28TODO%7CDIRTY%29%24%2F) |
| 한국어 (ko) | ■■■■■■■■・・ 80% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fko+%2F%28TODO%7CDIRTY%29%24%2F) |
| Lietuvių (lt) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Flt+%2F%28TODO%7CDIRTY%29%24%2F) |
| Latviešu (lv) | ■■■■■■■■・・ 81% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Flv+%2F%28TODO%7CDIRTY%29%24%2F) |
| Nederlands (nl) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fnl+%2F%28TODO%7CDIRTY%29%24%2F) |
| Occitan (oc) | ■■■■■■■・・・ 73% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Foc+%2F%28TODO%7CDIRTY%29%24%2F) |
| Polski (pl) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpl+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Português (Brasil) (pt-BR) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-BR+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Português (Brasil) (pt-BR) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-BR+%2F%28TODO%7CDIRTY%29%24%2F) |
| Português (Portugal) (pt-PT) | ■■■■■■■■・・ 80% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fpt-PT+%2F%28TODO%7CDIRTY%29%24%2F) |
| Русский (ru) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fru+%2F%28TODO%7CDIRTY%29%24%2F) |
| Slovenčina (sk) | ■■■■■■■■・・ 81% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fsk+%2F%28TODO%7CDIRTY%29%24%2F) |
-| Türkçe (tr) | ■■■■■■■■■■ 100% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ftr+%2F%28TODO%7CDIRTY%29%24%2F) |
+| Türkçe (tr) | ■■■■■■■■■・ 99% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Ftr+%2F%28TODO%7CDIRTY%29%24%2F) |
| Українська (uk) | ■■■■■■■■■・ 98% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fuk+%2F%28TODO%7CDIRTY%29%24%2F) |
| 简体中文 (zh-CN) | ■■■■■■■■■・ 96% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fzh-CN+%2F%28TODO%7CDIRTY%29%24%2F) |
| 正體中文 (zh-TW) | ■■■■■■■■■・ 97% | [contribute](https://github.com/search?q=repo%3AFreshRSS%2FFreshRSS+path%3Aapp%2Fi18n%2Fzh-TW+%2F%28TODO%7CDIRTY%29%24%2F) |
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 9dc697214..675c814ae 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -1363,8 +1363,11 @@ class FreshRSS_Feed extends Minz_Model {
//<WebSub>
- public function pubSubHubbubEnabled(): bool {
- // Whether the current user is enrolled in the WebSub of that topic
+ /**
+ * WebSub subscription state for the current user, or false when not subscribed
+ * @return array<string,mixed>|false
+ */
+ private function pubSubHubbubState(): array|false {
$currentUser = Minz_User::name() ?? '';
if ($currentUser === '') {
return false;
@@ -1372,16 +1375,33 @@ class FreshRSS_Feed extends Minz_Model {
$url = $this->selfUrl ?: $this->url;
$path = PSHB_PATH . '/feeds/' . sha1($url);
if (($hubFile = @file_get_contents($path . '/!hub.json')) != false) {
+ /** @var array<string,mixed> $hubJson */
$hubJson = json_decode($hubFile, true);
- if (is_array($hubJson) && empty($hubJson['error']) &&
+ if (is_array($hubJson) &&
(empty($hubJson['lease_end']) || $hubJson['lease_end'] > time()) &&
file_exists($path . '/' . $currentUser . '.txt')) {
- return true;
+ return $hubJson;
}
}
return false;
}
+ /**
+ * Whether WebSub is activated for this feed and this user, and validated by a successfully received push
+ */
+ public function pubSubHubbubEnabled(): bool {
+ $hubJson = $this->pubSubHubbubState();
+ return is_array($hubJson) && empty($hubJson['error']);
+ }
+
+ /**
+ * Whether WebSub is activated for this feed and this user, but waiting for first successful push
+ */
+ public function pubSubHubbubPending(): bool {
+ $hubJson = $this->pubSubHubbubState();
+ return is_array($hubJson) && !empty($hubJson['error']);
+ }
+
public function pubSubHubbubError(bool $error = true): bool {
$url = $this->selfUrl ?: $this->url;
$hubFilename = PSHB_PATH . '/feeds/' . sha1($url) . '/!hub.json';
@@ -1505,7 +1525,7 @@ class FreshRSS_Feed extends Minz_Model {
' via hub ' . $hubJson['hub'] .
' with callback ' . $callbackUrl . ': ' . $response['status'] . ' ' . $response['body'], PSHB_LOG);
- if (str_starts_with('' . $response['status'], '2')) {
+ if ($response['method'] === 'POST' && str_starts_with('' . $response['status'], '2')) {
return true;
} else {
$hubJson['lease_start'] = time(); //Prevent trying again too soon
diff --git a/app/Models/SimplePieFetch.php b/app/Models/SimplePieFetch.php
index 449e39e03..113799de6 100644
--- a/app/Models/SimplePieFetch.php
+++ b/app/Models/SimplePieFetch.php
@@ -25,7 +25,7 @@ final class FreshRSS_SimplePieFetch extends \SimplePie\File
}
}
- $redirects = $curl_options[CURLOPT_MAXREDIRS] ?? null;
+ $redirects = $curl_options[CURLOPT_MAXREDIRS] ?? $redirects;
if (!is_int($redirects)) {
$redirects = 4;
} elseif ($redirects < 0) {
diff --git a/app/Utils/httpUtil.php b/app/Utils/httpUtil.php
index c45218137..cb88b1a5a 100644
--- a/app/Utils/httpUtil.php
+++ b/app/Utils/httpUtil.php
@@ -457,22 +457,37 @@ final class FreshRSS_http_Util {
}
+ /**
+ * Whether cURL sends the request as a HTTP POST (`CURLOPT_POST` or `CURLOPT_POSTFIELDS`)
+ * @param array<mixed> $user_options User-defined cURL options derived from `curl_params`
+ * @param array<mixed> $curl_options Internal cURL options
+ */
+ private static function isPost(array $user_options, array $curl_options): bool {
+ return !empty($user_options[CURLOPT_POST]) || !empty($curl_options[CURLOPT_POST]) ||
+ isset($user_options[CURLOPT_POSTFIELDS]) || isset($curl_options[CURLOPT_POSTFIELDS]);
+ }
+
/**
* @param non-empty-string $url
* @param string|null $cachePath path to cache file, or `null` to disable caching
* @param string $type {html,ico,json,opml,xml}
* @param array<string,mixed> $attributes May contain user-defined cURL options in `$attributes['curl_params']`
* @param array<int,mixed> $curl_options Internal overrides of cURL options
- * @return array{body:string,effective_url:string,redirect_count:int,fail:bool,status:int,error:string}
+ * @return array{body:string,effective_url:string,redirect_count:int,fail:bool,status:int,error:string,method:string}
* `status` is the HTTP response code (e.g. 200, 404), or a custom negative value:
* * `-200` served from local cache;
* * `-429` blocked by active `Retry-After` period;
- * * `-500` `curl_init()` failure.
+ * * `-500` `curl_init()` failure, or request refused by a security check.
+ *
+ * `method` is the HTTP method used for the request producing `status` ('GET' or 'POST').
*/
public static function httpGet(string $url, ?string $cachePath = null, string $type = 'html', array $attributes = [], array $curl_options = []): array {
+ $options = is_array($attributes['curl_params'] ?? null) ?
+ self::sanitizeCurlParams($attributes['curl_params']) : []; // User-defined cURL options
+ $c_method = self::isPost($options, $curl_options) ? 'POST' : 'GET';
if (!\SimplePie\Misc::is_remote_uri($url)) {
Minz_Log::warning('Error fetching content: malformed URL “' . $url . '“');
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
}
$limits = FreshRSS_Context::systemConf()->limits;
@@ -486,7 +501,8 @@ final class FreshRSS_http_Util {
if (FreshRSS_Context::systemConf()->simplepie_syslog_enabled) {
syslog(LOG_DEBUG, 'FreshRSS uses cache for ' . \SimplePie\Misc::url_remove_credentials($url));
}
- return ['body' => $body, 'effective_url' => $url, 'redirect_count' => 0, 'fail' => false, 'status' => -200, 'error' => ''];
+ return ['body' => $body, 'effective_url' => $url, 'redirect_count' => 0, 'fail' => false, 'status' => -200,
+ 'error' => '', 'method' => $c_method];
}
}
}
@@ -499,9 +515,7 @@ final class FreshRSS_http_Util {
$proxy = is_string(FreshRSS_Context::systemConf()->curl_options[CURLOPT_PROXY] ?? null) ? FreshRSS_Context::systemConf()->curl_options[CURLOPT_PROXY] : '';
$proxy_type = is_int(FreshRSS_Context::systemConf()->curl_options[CURLOPT_PROXYTYPE] ?? null) ?
FreshRSS_Context::systemConf()->curl_options[CURLOPT_PROXYTYPE] : 0;
- $options = []; // User-defined cURL options
- if (is_array($attributes['curl_params'] ?? null)) {
- $options = self::sanitizeCurlParams($attributes['curl_params']);
+ if (!empty($options)) {
$proxy = is_string($options[CURLOPT_PROXY] ?? null) ? $options[CURLOPT_PROXY] : $proxy;
$proxy_type = is_int($options[CURLOPT_PROXYTYPE] ?? null) ? $options[CURLOPT_PROXYTYPE] : $proxy_type;
if (is_array($options[CURLOPT_HTTPHEADER] ?? null)) {
@@ -516,11 +530,11 @@ final class FreshRSS_http_Util {
if (($retryAfter = FreshRSS_http_Util::getRetryAfter($url, $proxy)) > 0) {
Minz_Log::warning('For that domain, will first retry after ' . date('c', $retryAfter) . '. ' . \SimplePie\Misc::url_remove_credentials($url));
- return ['body' => '', 'effective_url' => $url, 'redirect_count' => 0, 'fail' => true, 'status' => -429, 'error' => ''];
+ return ['body' => '', 'effective_url' => $url, 'redirect_count' => 0, 'fail' => true, 'status' => -429, 'error' => '', 'method' => $c_method];
}
if (FreshRSS_Context::systemConf()->simplepie_syslog_enabled) {
- syslog(LOG_INFO, 'FreshRSS GET ' . $type . ' ' . \SimplePie\Misc::url_remove_credentials($url));
+ syslog(LOG_INFO, 'FreshRSS ' . $c_method . ' ' . $type . ' ' . \SimplePie\Misc::url_remove_credentials($url));
}
switch ($type) {
@@ -550,6 +564,7 @@ final class FreshRSS_http_Util {
$max_redirs = 4;
}
while (true) {
+ $c_method = self::isPost($options, $curl_options) ? 'POST' : 'GET'; // Can change after a redirect has changed the method
$url = is_string($url) ? $url : '';
$resolve = [];
if ($proxy === '') {
@@ -557,9 +572,9 @@ final class FreshRSS_http_Util {
if ($resolve === null) {
Minz_Log::warning('Fetching this URL is not allowed, because the host’s IP is not in the allowlist [' .
\SimplePie\Misc::url_remove_credentials($url) . ']');
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
} elseif ($resolve === false) {
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
}
if (!empty($resolve)) {
$curl_options[CURLOPT_RESOLVE] = $resolve; // Prevent DNS rebinding
@@ -577,7 +592,7 @@ final class FreshRSS_http_Util {
};
if ($proxy_scheme === null) {
// Unsupported proxy type
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
}
$proxy_url = "$proxy_scheme://$proxy"; // CURLOPT_PROXY ($proxy) is formatted as user:pass@hostname:port, with the part before @ being optional
$resolve = self::getCurlResolveInfo($proxy_url);
@@ -585,9 +600,9 @@ final class FreshRSS_http_Util {
Minz_Log::warning('Failed to fetch this URL, because the proxy’s IP is not in the allowlist [' .
\SimplePie\Misc::url_remove_credentials($url) . '] [' .
\SimplePie\Misc::url_remove_credentials($proxy_url) . ']');
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
} elseif ($resolve === false) {
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
}
if (!empty($resolve)) {
// Only for the proxy domain, socks4a and socks5h DNS queries will be passed through the proxy.
@@ -599,7 +614,7 @@ final class FreshRSS_http_Util {
// TODO: Implement HTTP 1.1 conditional GET If-Modified-Since
$ch = curl_init();
if ($ch === false || $url === '') {
- return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => ''];
+ return ['body' => '', 'effective_url' => '', 'redirect_count' => 0, 'fail' => true, 'status' => -500, 'error' => '', 'method' => $c_method];
}
curl_setopt_array($ch, [
CURLOPT_URL => $url,
@@ -693,7 +708,7 @@ final class FreshRSS_http_Util {
Minz_Log::warning('Error fetching content: Too many redirects were hit [' . \SimplePie\Misc::url_remove_credentials($original_url) . ']');
break;
}
- if ((isset($options[CURLOPT_POST]) || isset($curl_options[CURLOPT_POST])) &&
+ if (self::isPost($options, $curl_options) &&
in_array($c_status, [301, 302, 303], true)) { // Not for 307 and 308, which must not change the HTTP method
unset($curl_options[CURLOPT_POST]);
unset($curl_options[CURLOPT_POSTFIELDS]);
@@ -712,7 +727,7 @@ final class FreshRSS_http_Util {
continue;
}
- $fail = $c_status != 200 || $c_error != '' || $body === false;
+ $fail = $c_status < 200 || $c_status >= 300 || $c_error != '' || $body === false;
if ($fail) {
$body = '';
Minz_Log::warning('Error fetching content: HTTP code ' . $c_status . ': ' . $c_error . ' ' . $url);
@@ -753,7 +768,7 @@ final class FreshRSS_http_Util {
}
return ['body' => is_string($body) ? $body : '', 'effective_url' => $c_effective_url, 'redirect_count' => $redirs,
- 'fail' => $fail, 'status' => $c_status, 'error' => $c_error];
+ 'fail' => $fail, 'status' => $c_status, 'error' => $c_error, 'method' => $c_method];
}
/**
diff --git a/app/i18n/az/sub.php b/app/i18n/az/sub.php
index 8c8fd7ca9..f426b0ad2 100644
--- a/app/i18n/az/sub.php
+++ b/app/i18n/az/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Lentin etibarlılığını yoxla',
'website' => 'Veb saytın URL-i',
'websub' => 'WebSub ilə ani bildirişlər',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/be/sub.php b/app/i18n/be/sub.php
index 221ba7097..8e2d8f636 100644
--- a/app/i18n/be/sub.php
+++ b/app/i18n/be/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Праверыць сапраўднасць стужкі',
'website' => 'URL-адрас вэб-сайта',
'websub' => 'Імгненныя апавяшчэнні праз WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/cs/sub.php b/app/i18n/cs/sub.php
index 2439dd48d..8ec2066bd 100644
--- a/app/i18n/cs/sub.php
+++ b/app/i18n/cs/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Zkontrolovat platnost kanálu',
'website' => 'Adresa URL webové stránky',
'websub' => 'Okamžité oznámení s WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php
index 7bb5cf749..614988d71 100644
--- a/app/i18n/de/sub.php
+++ b/app/i18n/de/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Gültigkeit des Feeds überprüfen',
'website' => 'Website-URL',
'websub' => 'Sofortbenachrichtigung mit WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/el/sub.php b/app/i18n/el/sub.php
index f209b58b9..027c84a92 100644
--- a/app/i18n/el/sub.php
+++ b/app/i18n/el/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Check the validity of the feed', // TODO
'website' => 'Website URL', // TODO
'websub' => 'Instant notifications with WebSub', // TODO
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/en-US/sub.php b/app/i18n/en-US/sub.php
index 6c18f24d4..fb72cb54c 100644
--- a/app/i18n/en-US/sub.php
+++ b/app/i18n/en-US/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Check the validity of the feed', // IGNORE
'website' => 'Website URL', // IGNORE
'websub' => 'Instant notifications with WebSub', // IGNORE
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // IGNORE
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php
index 020eb989c..412c15386 100644
--- a/app/i18n/en/sub.php
+++ b/app/i18n/en/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Check the validity of the feed',
'website' => 'Website URL',
'websub' => 'Instant notifications with WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.',
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php
index 5f025d9fa..55ba24671 100644
--- a/app/i18n/es/sub.php
+++ b/app/i18n/es/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Verifica la validez de la fuente',
'website' => 'Web de la URL',
'websub' => 'Notificación inmediata con WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/fa/sub.php b/app/i18n/fa/sub.php
index 721af1737..17a7a0be9 100644
--- a/app/i18n/fa/sub.php
+++ b/app/i18n/fa/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => ' اعتبار خوراک را بررسی کنید',
'website' => 'نشانی وب‌سایت',
'websub' => ' اطلاع رسانی فوری با WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/fi/sub.php b/app/i18n/fi/sub.php
index fd601d32a..745de7d5b 100644
--- a/app/i18n/fi/sub.php
+++ b/app/i18n/fi/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Tarkista syötteen kelpoisuus',
'website' => 'Sivuston URL-osoite',
'websub' => 'Välittömät ilmoitukset WebSubin avulla',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php
index f773beab3..f90bdb6aa 100644
--- a/app/i18n/fr/sub.php
+++ b/app/i18n/fr/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Vérifier la validité du flux',
'website' => 'URL du site',
'websub' => 'Notifications instantanée par WebSub',
+ 'websub_pending' => 'WebSub activé ; en attente de la première notification.',
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php
index 32a3b6de9..718f5bff6 100644
--- a/app/i18n/he/sub.php
+++ b/app/i18n/he/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'בדיקות תקינות ההזנה',
'website' => 'אתר URL',
'websub' => 'Instant notifications with WebSub', // TODO
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/hu/sub.php b/app/i18n/hu/sub.php
index 70ad37293..a4d02427b 100644
--- a/app/i18n/hu/sub.php
+++ b/app/i18n/hu/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Hírforrás helyességének ellenőrzése',
'website' => 'Weboldal URL',
'websub' => 'Azonnali értesítés WebSub-al',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/id/sub.php b/app/i18n/id/sub.php
index 2497c37d5..bd5676655 100644
--- a/app/i18n/id/sub.php
+++ b/app/i18n/id/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Periksa validitas umpan ini',
'website' => 'URL situs',
'websub' => 'Notifikasi langsung menggunakan WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php
index d0dce63c1..a47298508 100644
--- a/app/i18n/it/sub.php
+++ b/app/i18n/it/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Controlla la validita del feed ',
'website' => 'URL del sito',
'websub' => 'Notifica istantanea con WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/ja/sub.php b/app/i18n/ja/sub.php
index df25a375f..e5e429659 100644
--- a/app/i18n/ja/sub.php
+++ b/app/i18n/ja/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'フィードが有効かどうかを確認する',
'website' => 'WebサイトのURL',
'websub' => 'WebSubとの即時通知',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/ko/sub.php b/app/i18n/ko/sub.php
index 11d4bcb7e..77d7ca9e6 100644
--- a/app/i18n/ko/sub.php
+++ b/app/i18n/ko/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => '피드 유효성 검사',
'website' => '웹사이트 URL',
'websub' => 'WebSub을 사용한 즉시 알림',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/lt/sub.php b/app/i18n/lt/sub.php
index 649386985..bf9f74b51 100644
--- a/app/i18n/lt/sub.php
+++ b/app/i18n/lt/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Patikrinti kanalo tinkamumą',
'website' => 'Svetainės URL',
'websub' => 'Momentiniai pranešimai su WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/lv/sub.php b/app/i18n/lv/sub.php
index 11d121171..588ed5b46 100644
--- a/app/i18n/lv/sub.php
+++ b/app/i18n/lv/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Pārbaudēt barotnes derīgumu',
'website' => 'Mājaslapas URL',
'websub' => 'Tūlītēji paziņojumi ar WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php
index 1d0c32ac4..a5c119866 100644
--- a/app/i18n/nl/sub.php
+++ b/app/i18n/nl/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Controleer de geldigheid van de feed',
'website' => 'Website-url',
'websub' => 'Directe notificaties met WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.php
index 4f3565357..4370b2fc7 100644
--- a/app/i18n/oc/sub.php
+++ b/app/i18n/oc/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Verificar la validitat del flux',
'website' => 'URL del site',
'websub' => 'Notificacions instantanèas amb WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/pl/sub.php b/app/i18n/pl/sub.php
index 23b22edc4..7e29d1456 100644
--- a/app/i18n/pl/sub.php
+++ b/app/i18n/pl/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Sprawdź zgodność kanału',
'website' => 'Adres strony',
'websub' => 'Natychmiastowe powiadomienia protokołu WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/pt-BR/sub.php b/app/i18n/pt-BR/sub.php
index 72f210542..561da0136 100644
--- a/app/i18n/pt-BR/sub.php
+++ b/app/i18n/pt-BR/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Verifique a validade do feed',
'website' => 'URL do site',
'websub' => 'Notificação instantânea com WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/pt-PT/sub.php b/app/i18n/pt-PT/sub.php
index 45cc723f1..731984cf7 100644
--- a/app/i18n/pt-PT/sub.php
+++ b/app/i18n/pt-PT/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Verifique a validade do feed',
'website' => 'URL do site',
'websub' => 'Notificação instantânea com WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php
index 4164cb868..6b62c2e4e 100644
--- a/app/i18n/ru/sub.php
+++ b/app/i18n/ru/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Проверить валидность ленты',
'website' => 'URL сайта',
'websub' => 'Моментальные оповещения посредством WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/sk/sub.php b/app/i18n/sk/sub.php
index 5c5ea9ec4..b8e7df3cc 100644
--- a/app/i18n/sk/sub.php
+++ b/app/i18n/sk/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Skontrolovať platnosť kanála',
'website' => 'Odkaz webovej stránky',
'websub' => 'Okamžité oznámenia cez WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php
index c36431f87..5668b1b4f 100644
--- a/app/i18n/tr/sub.php
+++ b/app/i18n/tr/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Beslemenin geçerliliğini kontrol et',
'website' => 'Web sitesi URL’si',
'websub' => 'WebSub ile anlık bildirimler',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/uk/sub.php b/app/i18n/uk/sub.php
index cbde7a75b..7fd610929 100644
--- a/app/i18n/uk/sub.php
+++ b/app/i18n/uk/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => 'Перевірити коректність стрічки',
'website' => 'URL-адреса вебсайту',
'websub' => 'Негайні сповіщення за допомогою WebSub',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/zh-CN/sub.php b/app/i18n/zh-CN/sub.php
index fd5e49a11..8f90055f1 100644
--- a/app/i18n/zh-CN/sub.php
+++ b/app/i18n/zh-CN/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => '检查订阅源有效性',
'website' => '网站地址',
'websub' => 'WebSub 即时通知',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/i18n/zh-TW/sub.php b/app/i18n/zh-TW/sub.php
index 881a25080..f00ec71b1 100644
--- a/app/i18n/zh-TW/sub.php
+++ b/app/i18n/zh-TW/sub.php
@@ -266,6 +266,7 @@ return array(
'validator' => '檢查訂閱源有效性',
'website' => '網站 URL',
'websub' => 'WebSub 即時通知',
+ 'websub_pending' => 'Subscribed to WebSub. Waiting for the first notification.', // TODO
),
'import_export' => array(
'export' => array(
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index 2e4fc1ac2..39f5710bf 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -269,12 +269,21 @@
</div>
</div>
- <?php if ($this->feed->pubSubHubbubEnabled()) { ?>
+ <?php
+ if ($this->feed->pubSubHubbubEnabled()) {
+ $websub = _t('sub.feed.websub');
+ } elseif ($this->feed->pubSubHubbubPending()) {
+ $websub = _t('sub.feed.websub_pending');
+ } else {
+ $websub = '';
+ }
+ if ($websub !== '') {
+ ?>
<div class="form-group">
<div class="group-controls">
<label class="checkbox" for="pubsubhubbub">
<input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1" checked="checked" />
- <?= _t('sub.feed.websub') ?>
+ <?= $websub ?>
</label>
</div>
</div>