aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-22 14:56:53 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-22 14:56:53 +0100
commitd64bf7953b0e4e793d7f75ec50bf6e42652560b2 (patch)
treec4b024b290911a3521d5a5b6166718dd9475661e /src
parent40f3ea57fbc86247495ef3c335f40f966a69aa50 (diff)
downloadwallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.tar.gz
wallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.tar.zst
wallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.zip
Added internal setting to enable/disable articles with paywall
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php5
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php5
-rw-r--r--src/Wallabag/CoreBundle/Helper/HttpClientFactory.php12
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
4 files changed, 21 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index e95c3a7b..f0738b91 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -432,6 +432,11 @@ class InstallCommand extends ContainerAwareCommand
432 'value' => '0', 432 'value' => '0',
433 'section' => 'misc', 433 'section' => 'misc',
434 ], 434 ],
435 [
436 'name' => 'restricted_access',
437 'value' => '0',
438 'section' => 'entry',
439 ],
435 ]; 440 ];
436 441
437 foreach ($settings as $setting) { 442 foreach ($settings as $setting) {
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
index 1f74891a..a723656e 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -155,6 +155,11 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
155 'value' => '0', 155 'value' => '0',
156 'section' => 'misc', 156 'section' => 'misc',
157 ], 157 ],
158 [
159 'name' => 'restricted_access',
160 'value' => '0',
161 'section' => 'entry',
162 ],
158 ]; 163 ];
159 164
160 foreach ($settings as $setting) { 165 foreach ($settings as $setting) {
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
index 161a5e9f..ca84c8da 100644
--- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
+++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
@@ -18,23 +18,31 @@ class HttpClientFactory
18 /** @var \GuzzleHttp\Cookie\CookieJar */ 18 /** @var \GuzzleHttp\Cookie\CookieJar */
19 private $cookieJar; 19 private $cookieJar;
20 20
21 private $restrictedAccess;
22
21 /** 23 /**
22 * HttpClientFactory constructor. 24 * HttpClientFactory constructor.
23 * 25 *
24 * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber 26 * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber
25 * @param \GuzzleHttp\Cookie\CookieJar $cookieJar 27 * @param \GuzzleHttp\Cookie\CookieJar $cookieJar
28 * @param string $restrictedAccess
26 */ 29 */
27 public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar) 30 public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess)
28 { 31 {
29 $this->authenticatorSubscriber = $authenticatorSubscriber; 32 $this->authenticatorSubscriber = $authenticatorSubscriber;
30 $this->cookieJar = $cookieJar; 33 $this->cookieJar = $cookieJar;
34 $this->restrictedAccess = $restrictedAccess;
31 } 35 }
32 36
33 /** 37 /**
34 * @return \GuzzleHttp\Client 38 * @return \GuzzleHttp\Client|null
35 */ 39 */
36 public function buildHttpClient() 40 public function buildHttpClient()
37 { 41 {
42 if (0 === (int) $this->restrictedAccess) {
43 return null;
44 }
45
38 // we clear the cookie to avoid websites who use cookies for analytics 46 // we clear the cookie to avoid websites who use cookies for analytics
39 $this->cookieJar->clear(); 47 $this->cookieJar->clear();
40 // need to set the (shared) cookie jar 48 // need to set the (shared) cookie jar
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 1b7f39fc..bcf0c9ca 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -73,6 +73,7 @@ services:
73 arguments: 73 arguments:
74 - "@bd_guzzle_site_authenticator.authenticator_subscriber" 74 - "@bd_guzzle_site_authenticator.authenticator_subscriber"
75 - "@wallabag_core.guzzle.cookie_jar" 75 - "@wallabag_core.guzzle.cookie_jar"
76 - '@=service(''craue_config'').get(''restricted_access'')'
76 77
77 wallabag_core.guzzle.cookie_jar: 78 wallabag_core.guzzle.cookie_jar:
78 class: GuzzleHttp\Cookie\FileCookieJar 79 class: GuzzleHttp\Cookie\FileCookieJar