diff options
| author | 2020-01-04 23:35:42 +0100 | |
|---|---|---|
| committer | 2020-01-04 23:35:42 +0100 | |
| commit | 2aff347b2e942286292b21e0b20d93ab85220a17 (patch) | |
| tree | a00c587dbaafe36da019dafca00b77357c3f58a8 /app/Models/Feed.php | |
| parent | acc50df0efef8bd9fa937a5d640314c0e78e9117 (diff) | |
Fix wrong getHeader refactoring (#2749)
* Fix wrong getHeader refactoring
Fix regression introduced by
https://github.com/FreshRSS/FreshRSS/pull/2373
The refactoring required a call to init() even for static functions,
which is most of the time not done.
Removed premature abstraction of `$_SERVER`, which was the root cause of
the bug.
https://github.com/FreshRSS/FreshRSS/issues/2748#issuecomment-569898931
* Refactoring: Move serverIsPublic to Minz_Request
* Add mitigations for wrong configurations
Due to the regression, we have some existing configurations with a bad
base_url
* Forgot one instance
Diffstat (limited to 'app/Models/Feed.php')
| -rw-r--r-- | app/Models/Feed.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 0a45a1f4c..a467fda57 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -643,7 +643,8 @@ class FreshRSS_Feed extends Minz_Model { public function pubSubHubbubPrepare() { $key = ''; - if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { + if (Minz_Request::serverIsPublic(FreshRSS_Context::$system_conf->base_url) && + $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); $hubFilename = $path . '/!hub.json'; if ($hubFile = @file_get_contents($hubFilename)) { @@ -690,7 +691,7 @@ class FreshRSS_Feed extends Minz_Model { //Parameter true to subscribe, false to unsubscribe. public function pubSubHubbubSubscribe($state) { $url = $this->selfUrl ? $this->selfUrl : $this->url; - if (FreshRSS_Context::$system_conf->base_url && $url) { + if ($url && (Minz_Request::serverIsPublic(FreshRSS_Context::$system_conf->base_url) || !$state)) { $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; $hubFile = @file_get_contents($hubFilename); if ($hubFile === false) { |
