diff --git a/app/config/services.yml b/app/config/services.yml index 0e8ef4ff6..34c1bd13c 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -22,7 +22,6 @@ services: $fetchingErrorMessage: '%wallabag.fetching_error_message%' $languages: '%wallabag.languages%' $lifeTime: '%wallabag.cache_lifetime%' - $cookieFile: "%kernel.cache_dir%/cookiejar.json" $logoPath: 'web/img/appicon/apple-touch-icon-152.png' $registrationEnabled: '%fosuser_registration%' $restrictedAccess: '@=service(''craue_config'').get(''restricted_access'')' @@ -213,8 +212,7 @@ services: Wallabag\SiteConfig\SiteConfigBuilder: alias: Wallabag\SiteConfig\GrabySiteConfigBuilder - GuzzleHttp\Cookie\CookieJar: - alias: 'Wallabag\Helper\FileCookieJar' + GuzzleHttp\Cookie\CookieJar: ~ Wallabag\Helper\HttpClientFactory: calls: diff --git a/src/Helper/FileCookieJar.php b/src/Helper/FileCookieJar.php deleted file mode 100644 index c5a02b223..000000000 --- a/src/Helper/FileCookieJar.php +++ /dev/null @@ -1,67 +0,0 @@ -logger = $logger; - } - - /** - * Load cookies from a JSON formatted file. - * - * Old cookies are kept unless overwritten by newly loaded ones. - * - * @param string $filename cookie file to load - * - * @throws \RuntimeException if the file cannot be loaded - */ - public function load($filename) - { - $json = file_get_contents($filename); - if (false === $json) { - // @codeCoverageIgnoreStart - throw new \RuntimeException("Unable to load file {$filename}"); - // @codeCoverageIgnoreEnd - } - - try { - $data = Utils::jsonDecode($json, true); - } catch (\InvalidArgumentException $e) { - $this->logger->error('JSON inside the cookie is broken', [ - 'json' => $json, - 'error_msg' => $e->getMessage(), - ]); - - // cookie file is invalid, just ignore the exception and it'll reset the whole cookie file - $data = ''; - } - - if (\is_array($data)) { - foreach (Utils::jsonDecode($json, true) as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (\strlen($data)) { - throw new \RuntimeException("Invalid cookie file: {$filename}"); - } - } -}