diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-30 12:23:51 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-02 23:27:41 +0100 |
commit | 252ebd60719d32ec954d0519c9edf2b52b03310c (patch) | |
tree | 044c97abeda75c33901d8bfcd33fa107279b1778 /src/Wallabag/ImportBundle/Resources | |
parent | b4b592a0c0ee356e81775baf8f9976288d7b686c (diff) | |
download | wallabag-252ebd60719d32ec954d0519c9edf2b52b03310c.tar.gz wallabag-252ebd60719d32ec954d0519c9edf2b52b03310c.tar.zst wallabag-252ebd60719d32ec954d0519c9edf2b52b03310c.zip |
Rewrote Pocket Import
For the moment, we won't do a queue system, just a plain synchronous import.
We also use ContentProxy to grab content for each article from Pocket.
Error from Pocket are now logged using the logger.
The ImportInterface need to be simple and not related to oAuth (not all import will use that method).
Diffstat (limited to 'src/Wallabag/ImportBundle/Resources')
3 files changed, 13 insertions, 38 deletions
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index ab516ca5..f421821c 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml | |||
@@ -1,14 +1,4 @@ | |||
1 | services: | 1 | services: |
2 | wallabag_import.pocket.import: | ||
3 | class: Wallabag\ImportBundle\Import\PocketImport | ||
4 | arguments: | ||
5 | - "@security.token_storage" | ||
6 | - "@session" | ||
7 | - "@doctrine.orm.entity_manager" | ||
8 | - %pocket_consumer_key% | ||
9 | calls: | ||
10 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] | ||
11 | |||
12 | wallabag_import.pocket.client: | 2 | wallabag_import.pocket.client: |
13 | class: GuzzleHttp\Client | 3 | class: GuzzleHttp\Client |
14 | arguments: | 4 | arguments: |
@@ -17,3 +7,14 @@ services: | |||
17 | headers: | 7 | headers: |
18 | content-type: "application/json" | 8 | content-type: "application/json" |
19 | X-Accept: "application/json" | 9 | X-Accept: "application/json" |
10 | |||
11 | wallabag_import.pocket.import: | ||
12 | class: Wallabag\ImportBundle\Import\PocketImport | ||
13 | arguments: | ||
14 | - "@security.token_storage" | ||
15 | - "@doctrine.orm.entity_manager" | ||
16 | - "@wallabag_core.content_proxy" | ||
17 | - %pocket_consumer_key% | ||
18 | calls: | ||
19 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] | ||
20 | - [ setLogger, [ "@logger" ]] | ||
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index ee759a52..b068283a 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig | |||
@@ -8,35 +8,9 @@ | |||
8 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
9 | {% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} | 9 | {% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} |
10 | <ul> | 10 | <ul> |
11 | <li><a href="{{ path('pocket_import') }}">Pocket</a></li> | 11 | <li><a href="{{ path('import_pocket') }}">Pocket</a></li> |
12 | </ul> | 12 | </ul> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | |||
17 | |||
18 | <div class="row"> | ||
19 | <div class="col s12"> | ||
20 | <div class="card-panel settings"> | ||
21 | <div class="row"> | ||
22 | <div class="col s12"> | ||
23 | <form action="{{ path('import') }}" method="post" {{ form_enctype(form.import) }}> | ||
24 | {{ form_errors(form.import) }} | ||
25 | <div class="row"> | ||
26 | <div class="input-field col s12"> | ||
27 | <p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p> | ||
28 | {{ form_errors(form.import.file) }} | ||
29 | {{ form_widget(form.import.file) }} | ||
30 | </div> | ||
31 | </div> | ||
32 | <div class="hidden">{{ form_rest(form.import) }}</div> | ||
33 | <button class="btn waves-effect waves-light" type="submit" name="action"> | ||
34 | {% trans %}Upload file{% endtrans %} | ||
35 | </button> | ||
36 | </form> | ||
37 | </div> | ||
38 | </div> | ||
39 | </div> | ||
40 | </div> | ||
41 | </div> | ||
42 | {% endblock %} | 16 | {% endblock %} |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index df64e472..940fe4cc 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig | |||
@@ -7,7 +7,7 @@ | |||
7 | <div class="col s12"> | 7 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
9 | {% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %} | 9 | {% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %} |
10 | <form method="post" action="{{ path('pocket_auth') }}"> | 10 | <form method="post" action="{{ path('import_pocket_auth') }}"> |
11 | <input type="submit" value="Connect to Pocket and import data" /> | 11 | <input type="submit" value="Connect to Pocket and import data" /> |
12 | </form> | 12 | </form> |
13 | </div> | 13 | </div> |