mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Moved Pocket token to user config
This commit is contained in:
parent
4fc998245c
commit
ebe0787e09
34 changed files with 161 additions and 44 deletions
|
@ -44,7 +44,7 @@ class PocketController extends Controller
|
|||
|
||||
return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
|
||||
'import' => $this->getPocketImportService(),
|
||||
'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true,
|
||||
'has_consumer_key' => '' === trim($this->getUser()->getConfig()->getPocketConsumerKey()) ? false : true,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -13,16 +13,14 @@ use Craue\ConfigBundle\Util\Config;
|
|||
class PocketImport extends AbstractImport
|
||||
{
|
||||
private $client;
|
||||
private $consumerKey;
|
||||
private $accessToken;
|
||||
|
||||
const NB_ELEMENTS = 5000;
|
||||
|
||||
public function __construct(EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
|
||||
public function __construct(EntityManager $em, ContentProxy $contentProxy)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->contentProxy = $contentProxy;
|
||||
$this->consumerKey = $craueConfig->get('pocket_consumer_key');
|
||||
$this->logger = new NullLogger();
|
||||
}
|
||||
|
||||
|
@ -72,7 +70,7 @@ class PocketImport extends AbstractImport
|
|||
$request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request',
|
||||
[
|
||||
'body' => json_encode([
|
||||
'consumer_key' => $this->consumerKey,
|
||||
'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
|
||||
'redirect_uri' => $redirectUri,
|
||||
]),
|
||||
]
|
||||
|
@ -102,7 +100,7 @@ class PocketImport extends AbstractImport
|
|||
$request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize',
|
||||
[
|
||||
'body' => json_encode([
|
||||
'consumer_key' => $this->consumerKey,
|
||||
'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
|
||||
'code' => $code,
|
||||
]),
|
||||
]
|
||||
|
@ -131,7 +129,7 @@ class PocketImport extends AbstractImport
|
|||
$request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get',
|
||||
[
|
||||
'body' => json_encode([
|
||||
'consumer_key' => $this->consumerKey,
|
||||
'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
|
||||
'access_token' => $this->accessToken,
|
||||
'detailType' => 'complete',
|
||||
'state' => 'all',
|
||||
|
|
|
@ -12,11 +12,7 @@
|
|||
<div class="card-panel red white-text">
|
||||
{{ 'import.pocket.config_missing.description'|trans }}
|
||||
|
||||
{% if is_granted('ROLE_SUPER_ADMIN') %}
|
||||
{{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }}
|
||||
{% else %}
|
||||
{{ 'import.pocket.config_missing.user_message'|trans }}
|
||||
{% endif %}
|
||||
{{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('config') ~ '">', '%keyurle%':'</a>'})|raw }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -31,7 +27,7 @@
|
|||
{{ form_label(form.mark_as_read) }}
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn waves-effect waves-light" type="submit" name="action">
|
||||
<button class="btn waves-effect waves-light" type="submit" name="action" {% if not has_consumer_key %}disabled="disabled"{% endif %}>
|
||||
{{ 'import.pocket.connect_to_pocket'|trans }}
|
||||
</button>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue