aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2019-02-13 15:05:57 +0100
committerGitHub <noreply@github.com>2019-02-13 15:05:57 +0100
commitb1992b340e21b6846a1ec2ae6ddd7217f3b24fb5 (patch)
treec8c5ab6b1354782c82139a12372c3532001124fd
parent47e47841105a34c852744e207b4a0ea9e879ec49 (diff)
parent44560c77677d1d2a0eda0bf63f56c9dff033744f (diff)
downloadwallabag-b1992b340e21b6846a1ec2ae6ddd7217f3b24fb5.tar.gz
wallabag-b1992b340e21b6846a1ec2ae6ddd7217f3b24fb5.tar.zst
wallabag-b1992b340e21b6846a1ec2ae6ddd7217f3b24fb5.zip
Merge pull request #3882 from wallabag/fix/cors
Fix CORS for API
-rw-r--r--app/config/config.yml8
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php2
-rw-r--r--src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php10
-rw-r--r--src/Wallabag/ImportBundle/Import/ChromeImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/FirefoxImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php2
9 files changed, 16 insertions, 16 deletions
diff --git a/app/config/config.yml b/app/config/config.yml
index 0c2b6a1d..8bef8312 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -147,18 +147,18 @@ nelmio_cors:
147 paths: 147 paths:
148 '^/api/': 148 '^/api/':
149 allow_origin: ['*'] 149 allow_origin: ['*']
150 allow_headers: ['X-Custom-Auth'] 150 allow_headers: ['Authorization','content-type']
151 allow_methods: ['POST', 'PUT', 'PATCH','GET', 'DELETE'] 151 allow_methods: ['POST', 'PUT', 'PATCH','GET', 'DELETE']
152 max_age: 3600 152 max_age: 3600
153 '^/oauth/': 153 '^/oauth/':
154 allow_origin: ['*'] 154 allow_origin: ['*']
155 allow_headers: ['X-Custom-Auth'] 155 allow_headers: ['Authorization','content-type']
156 allow_methods: ['POST', 'PUT', 'GET', 'DELETE'] 156 allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
157 max_age: 3600 157 max_age: 3600
158 '^/': 158 '^/':
159 #origin_regex: true 159 #origin_regex: true
160 allow_origin: ['^http://localhost:[0-9]+'] 160 allow_origin: ['*']
161 allow_headers: ['X-Custom-Auth'] 161 allow_headers: ['Authorization','content-type']
162 allow_methods: ['POST', 'PUT', 'GET', 'DELETE'] 162 allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
163 max_age: 3600 163 max_age: 3600
164 hosts: ['^api\.'] 164 hosts: ['^api\.']
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index 702c7f7a..37d0640a 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -108,7 +108,7 @@ class EntryFilterType extends AbstractType
108 ->add('httpStatus', TextFilterType::class, [ 108 ->add('httpStatus', TextFilterType::class, [
109 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 109 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
110 $value = $values['value']; 110 $value = $values['value'];
111 if (false === array_key_exists($value, Response::$statusTexts)) { 111 if (false === \array_key_exists($value, Response::$statusTexts)) {
112 return; 112 return;
113 } 113 }
114 114
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
index 1c2c5093..183d394a 100644
--- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
+++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
@@ -23,7 +23,7 @@ class PreparePagerForEntries
23 * @param AdapterInterface $adapter 23 * @param AdapterInterface $adapter
24 * @param User $user If user isn't logged in, we can force it (like for rss) 24 * @param User $user If user isn't logged in, we can force it (like for rss)
25 * 25 *
26 * @return null|Pagerfanta 26 * @return Pagerfanta|null
27 */ 27 */
28 public function prepare(AdapterInterface $adapter, User $user = null) 28 public function prepare(AdapterInterface $adapter, User $user = null)
29 { 29 {
diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
index 36906761..b2e212a4 100644
--- a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
@@ -22,7 +22,7 @@ class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
22 * @param string $host 22 * @param string $host
23 * @param int $userId 23 * @param int $userId
24 * 24 *
25 * @return null|array 25 * @return array|null
26 */ 26 */
27 public function findOneByHostAndUser($host, $userId) 27 public function findOneByHostAndUser($host, $userId)
28 { 28 {
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index 4678ae0c..811e3fb8 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport
77 */ 77 */
78 public function parseEntry(array $importedEntry) 78 public function parseEntry(array $importedEntry)
79 { 79 {
80 if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) { 80 if ((!\array_key_exists('guid', $importedEntry) || (!\array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
81 if ($this->producer) { 81 if ($this->producer) {
82 $this->parseEntriesForProducer($importedEntry); 82 $this->parseEntriesForProducer($importedEntry);
83 83
@@ -89,7 +89,7 @@ abstract class BrowserImport extends AbstractImport
89 return; 89 return;
90 } 90 }
91 91
92 if (array_key_exists('children', $importedEntry)) { 92 if (\array_key_exists('children', $importedEntry)) {
93 if ($this->producer) { 93 if ($this->producer) {
94 $this->parseEntriesForProducer($importedEntry['children']); 94 $this->parseEntriesForProducer($importedEntry['children']);
95 95
@@ -101,11 +101,11 @@ abstract class BrowserImport extends AbstractImport
101 return; 101 return;
102 } 102 }
103 103
104 if (!array_key_exists('uri', $importedEntry) && !array_key_exists('url', $importedEntry)) { 104 if (!\array_key_exists('uri', $importedEntry) && !\array_key_exists('url', $importedEntry)) {
105 return; 105 return;
106 } 106 }
107 107
108 $url = array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; 108 $url = \array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url'];
109 109
110 $existingEntry = $this->em 110 $existingEntry = $this->em
111 ->getRepository('WallabagCoreBundle:Entry') 111 ->getRepository('WallabagCoreBundle:Entry')
@@ -126,7 +126,7 @@ abstract class BrowserImport extends AbstractImport
126 // update entry with content (in case fetching failed, the given entry will be return) 126 // update entry with content (in case fetching failed, the given entry will be return)
127 $this->fetchContent($entry, $data['url'], $data); 127 $this->fetchContent($entry, $data['url'], $data);
128 128
129 if (array_key_exists('tags', $data)) { 129 if (\array_key_exists('tags', $data)) {
130 $this->tagsAssigner->assignTagsToEntry( 130 $this->tagsAssigner->assignTagsToEntry(
131 $entry, 131 $entry,
132 $data['tags'] 132 $data['tags']
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php
index eccee698..4ae82ade 100644
--- a/src/Wallabag/ImportBundle/Import/ChromeImport.php
+++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php
@@ -57,7 +57,7 @@ class ChromeImport extends BrowserImport
57 'created_at' => substr($entry['date_added'], 0, 10), 57 'created_at' => substr($entry['date_added'], 0, 10),
58 ]; 58 ];
59 59
60 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { 60 if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) {
61 $data['tags'] = $entry['tags']; 61 $data['tags'] = $entry['tags'];
62 } 62 }
63 63
diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
index 8999e3f3..b3558f21 100644
--- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php
+++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
@@ -57,7 +57,7 @@ class FirefoxImport extends BrowserImport
57 'created_at' => substr($entry['dateAdded'], 0, 10), 57 'created_at' => substr($entry['dateAdded'], 0, 10),
58 ]; 58 ];
59 59
60 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { 60 if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) {
61 $data['tags'] = $entry['tags']; 61 $data['tags'] = $entry['tags'];
62 } 62 }
63 63
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php
index 350d0600..58b6a970 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagImport.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php
@@ -122,7 +122,7 @@ abstract class WallabagImport extends AbstractImport
122 // update entry with content (in case fetching failed, the given entry will be return) 122 // update entry with content (in case fetching failed, the given entry will be return)
123 $this->fetchContent($entry, $data['url'], $data); 123 $this->fetchContent($entry, $data['url'], $data);
124 124
125 if (array_key_exists('tags', $data)) { 125 if (\array_key_exists('tags', $data)) {
126 $this->tagsAssigner->assignTagsToEntry( 126 $this->tagsAssigner->assignTagsToEntry(
127 $entry, 127 $entry,
128 $data['tags'], 128 $data['tags'],
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index b9bb525a..e0562611 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport
61 $data['html'] = $this->fetchingErrorMessage; 61 $data['html'] = $this->fetchingErrorMessage;
62 } 62 }
63 63
64 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { 64 if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) {
65 $data['tags'] = $entry['tags']; 65 $data['tags'] = $entry['tags'];
66 } 66 }
67 67