mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 02:51:04 +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
app/DoctrineMigrations/Version20160916201049.php
Normal file
44
app/DoctrineMigrations/Version20160916201049.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
private function getTable($tableName)
|
||||
{
|
||||
return $this->container->getParameter('database_table_prefix') . $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->addSql('ALTER TABLE '.$this->getTable('config').' ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE `'.$this->getTable('config').'` DROP pocket_consumer_key');
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ export_csv: Aktiver eksport til CSV
|
|||
export_json: Aktiver eksport til JSON
|
||||
export_txt: Aktiver eksport til TXT
|
||||
export_xml: Aktiver eksport til XML
|
||||
pocket_consumer_key: Brugers nøgle til Pocket for at importere materialer (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli-URL, hvis tjenesten er aktiv
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: CSV-Export aktivieren
|
|||
export_json: JSON-Export aktivieren
|
||||
export_txt: TXT-Export aktivieren
|
||||
export_xml: XML-Export aktivieren
|
||||
pocket_consumer_key: Consumer-Key für Pocket, um Inhalte zu importieren (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli-URL, sofern der Service aktiviert ist
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Enable CSV export
|
|||
export_json: Enable JSON export
|
||||
export_txt: Enable TXT export
|
||||
export_xml: Enable XML export
|
||||
pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
|
||||
import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli URL, if the service is enabled
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Activar exportación a CSV
|
|||
export_json: Activar exportación a JSON
|
||||
export_txt: Activar exportación a TXT
|
||||
export_xml: Activar exportación a XML
|
||||
pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli URL, si el servicio está activado
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: فعالسازی برونسپاری به CSV
|
|||
export_json: فعالسازی برونسپاری به JSON
|
||||
export_txt: فعالسازی برونسپاری به TXT
|
||||
export_xml: فعالسازی برونسپاری به XML
|
||||
pocket_consumer_key: کلید کاربری Pocket برای درونریزی مطالب (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: نشانی Shaarli، اگر فعال بود
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Activer l'export CSV
|
|||
export_json: Activer l'export JSON
|
||||
export_txt: Activer l'export TXT
|
||||
export_xml: Activer l'export XML
|
||||
pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
|
||||
import_with_rabbitmq: Activer RabbitMQ pour gérer les imports de façon asynchrone
|
||||
import_with_redis: Activer Redis pour gérer les imports de façon asynchrone
|
||||
shaarli_url: URL de Shaarli, si le service Shaarli est activé
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Abilita esportazione CSV
|
|||
export_json: Abilita esportazione JSON
|
||||
export_txt: Abilita esportazione TXT
|
||||
export_xml: Abilita esportazione XML
|
||||
pocket_consumer_key: Consumer key per Pocket per importare i contenuti (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli URL, se il servizio è abilitato
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Activar l'expòrt CSV
|
|||
export_json: Activar l'expòrt JSON
|
||||
export_txt: Activar l'expòrt TXT
|
||||
export_xml: Activar l'expòrt XML
|
||||
pocket_consumer_key: Clau d'autentificacion Pocket per importar las donadas (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: URL de Shaarli, se lo servici Shaarli es activat
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Włącz eksport do CSV
|
|||
export_json: Włącz eksport do JSON
|
||||
export_txt: Włącz eksport do TXT
|
||||
export_xml: Włącz eksport do XML
|
||||
pocket_consumer_key: Klucz klienta Pocket do importu zawartości (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Adress URL Shaarli, jeżeli usługa jest włączona
|
||||
|
|
|
@ -8,7 +8,6 @@ export_csv: Permite exportare CSV
|
|||
export_json: Permite exportare JSON
|
||||
export_txt: Permite exportare TXT
|
||||
export_xml: Permite exportare XML
|
||||
pocket_consumer_key: Cheie consumator pentru importarea contentului din Pocket (https://getpocket.com/developer/docs/authentication)
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
shaarli_url: Shaarli URL, dacă serviciul este permis
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# download_pictures: Download pictures on your server
|
||||
# carrot: Enable share to Carrot
|
||||
# diaspora_url: Diaspora URL, if the service is enabled
|
||||
# export_epub: Enable ePub export
|
||||
# export_mobi: Enable .mobi export
|
||||
# export_pdf: Enable PDF export
|
||||
# export_csv: Enable CSV export
|
||||
# export_json: Enable JSON export
|
||||
# export_txt: Enable TXT export
|
||||
# export_xml: Enable XML export
|
||||
# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
|
||||
# import_with_redis: Enable Redis to import data asynchronously
|
||||
# shaarli_url: Shaarli URL, if the service is enabled
|
||||
# share_diaspora: Enable share to Diaspora
|
||||
# share_mail: Enable share by email
|
||||
# share_shaarli: Enable share to Shaarli
|
||||
# share_twitter: Enable share to Twitter
|
||||
# show_printlink: Display a link to print content
|
||||
# wallabag_support_url: Support URL for wallabag
|
||||
# wallabag_url: URL of *your* wallabag instance
|
||||
# entry: "article"
|
||||
# export: "export"
|
||||
# import: "import"
|
||||
# misc: "misc"
|
||||
# modify_settings: "apply"
|
||||
# piwik_host: Host of your website in Piwik
|
||||
# piwik_site_id: ID of your website in Piwik
|
||||
# piwik_enabled: Enable Piwik
|
||||
# demo_mode_enabled: "Enable demo mode ? (only used for the wallabag public demo)"
|
||||
# demo_mode_username: "Demo user"
|
||||
# share_public: Allow public url for entries
|
|
@ -316,11 +316,6 @@ class InstallCommand extends ContainerAwareCommand
|
|||
'value' => '1',
|
||||
'section' => 'export',
|
||||
],
|
||||
[
|
||||
'name' => 'pocket_consumer_key',
|
||||
'value' => null,
|
||||
'section' => 'import',
|
||||
],
|
||||
[
|
||||
'name' => 'import_with_redis',
|
||||
'value' => '0',
|
||||
|
|
|
@ -20,6 +20,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$adminConfig->setItemsPerPage(30);
|
||||
$adminConfig->setReadingSpeed(1);
|
||||
$adminConfig->setLanguage('en');
|
||||
$adminConfig->setPocketConsumerKey('xxxxx');
|
||||
|
||||
$manager->persist($adminConfig);
|
||||
|
||||
|
@ -30,6 +31,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$bobConfig->setItemsPerPage(10);
|
||||
$bobConfig->setReadingSpeed(1);
|
||||
$bobConfig->setLanguage('fr');
|
||||
$bobConfig->setPocketConsumerKey(null);
|
||||
|
||||
$manager->persist($bobConfig);
|
||||
|
||||
|
@ -40,6 +42,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$emptyConfig->setItemsPerPage(10);
|
||||
$emptyConfig->setReadingSpeed(1);
|
||||
$emptyConfig->setLanguage('en');
|
||||
$emptyConfig->setPocketConsumerKey(null);
|
||||
|
||||
$manager->persist($emptyConfig);
|
||||
|
||||
|
|
|
@ -90,11 +90,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
|
|||
'value' => '1',
|
||||
'section' => 'export',
|
||||
],
|
||||
[
|
||||
'name' => 'pocket_consumer_key',
|
||||
'value' => null,
|
||||
'section' => 'import',
|
||||
],
|
||||
[
|
||||
'name' => 'import_with_redis',
|
||||
'value' => '0',
|
||||
|
|
|
@ -80,6 +80,13 @@ class Config
|
|||
*/
|
||||
private $readingSpeed;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
|
||||
*/
|
||||
private $pocketConsumerKey;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
||||
*/
|
||||
|
@ -278,6 +285,30 @@ class Config
|
|||
return $this->readingSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pocketConsumerKey.
|
||||
*
|
||||
* @param string $pocketConsumerKey
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public function setPocketConsumerKey($pocketConsumerKey)
|
||||
{
|
||||
$this->pocketConsumerKey = $pocketConsumerKey;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pocketConsumerKey.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPocketConsumerKey()
|
||||
{
|
||||
return $this->pocketConsumerKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaggingRule $rule
|
||||
*
|
||||
|
|
|
@ -52,6 +52,9 @@ class ConfigType extends AbstractType
|
|||
'choices' => array_flip($this->languages),
|
||||
'label' => 'config.form_settings.language_label',
|
||||
])
|
||||
->add('pocket_consumer_key', null, [
|
||||
'label' => 'config.form_settings.pocket_consumer_key_label',
|
||||
])
|
||||
->add('save', SubmitType::class, [
|
||||
'label' => 'config.form.save',
|
||||
])
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
|
||||
form_rss:
|
||||
description: 'RSS-feeds fra wallabag gør det muligt at læse de artikler, der gemmes i wallabag, med din RSS-læser. Det kræver, at du genererer et token først.'
|
||||
token_label: 'RSS-Token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'Ich lese ~200 Wörter pro Minute'
|
||||
300_word: 'Ich lese ~300 Wörter pro Minute'
|
||||
400_word: 'Ich lese ~400 Wörter pro Minute'
|
||||
pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
|
||||
form_rss:
|
||||
description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.'
|
||||
token_label: 'RSS-token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'I read ~200 words per minute'
|
||||
300_word: 'I read ~300 words per minute'
|
||||
400_word: 'I read ~400 words per minute'
|
||||
pocket_consumer_key_label: Consumer key for Pocket to import contents
|
||||
form_rss:
|
||||
description: 'RSS feeds provided by wallabag allow you to read your saved articles with your favourite RSS reader. You need to generate a token first.'
|
||||
token_label: 'RSS token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'Leo ~200 palabras por minuto'
|
||||
300_word: 'Leo ~300 palabras por minuto'
|
||||
400_word: 'Leo ~400 palabras por minuto'
|
||||
# pocket_consumer_key_label: Consumer key for Pocket to import contents
|
||||
form_rss:
|
||||
description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero'
|
||||
token_label: 'RSS token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه میخوانم'
|
||||
300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه میخوانم'
|
||||
400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه میخوانم'
|
||||
pocket_consumer_key_label: کلید کاربری Pocket برای درونریزی مطالب
|
||||
form_rss:
|
||||
description: 'با خوراک آر-اس-اس که wallabag در اختیارتان میگذارد، میتوانید مقالههای ذخیرهشده را در نرمافزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.'
|
||||
token_label: 'کد آر-اس-اس'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'Je lis environ 200 mots par minute'
|
||||
300_word: 'Je lis environ 300 mots par minute'
|
||||
400_word: 'Je lis environ 400 mots par minute'
|
||||
pocket_consumer_key_label: Clé d'authentification Pocket pour importer les données
|
||||
form_rss:
|
||||
description: "Les flux RSS fournis par wallabag vous permettent de lire vos articles sauvegardés dans votre lecteur de flux préféré. Pour pouvoir les utiliser, vous devez d'abord créer un jeton."
|
||||
token_label: 'Jeton RSS'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'Leggo ~200 parole al minuto'
|
||||
300_word: 'Leggo ~300 parole al minuto'
|
||||
400_word: 'Leggo ~400 parole al minuto'
|
||||
pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
|
||||
form_rss:
|
||||
description: 'I feed RSS generati da wallabag ti permettono di leggere i tuoi contenuti salvati con il tuo lettore di RSS preferito. Prima, devi generare un token.'
|
||||
token_label: 'RSS token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: "Legissi a l'entorn de 200 mots per minuta"
|
||||
300_word: "Legissi a l'entorn de 300 mots per minuta"
|
||||
400_word: "Legissi a l'entorn de 400 mots per minuta"
|
||||
pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
|
||||
form_rss:
|
||||
description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton."
|
||||
token_label: 'Geton RSS'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
200_word: 'Czytam ~200 słów na minutę'
|
||||
300_word: 'Czytam ~300 słów na minutę'
|
||||
400_word: 'Czytam ~400 słów na minutę'
|
||||
pocket_consumer_key_label: Klucz klienta Pocket do importu zawartości
|
||||
form_rss:
|
||||
description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.'
|
||||
token_label: 'Token RSS'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
|
||||
form_rss:
|
||||
description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.'
|
||||
token_label: 'RSS-Token'
|
||||
|
|
|
@ -68,6 +68,7 @@ config:
|
|||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
# pocket_consumer_key_label: Consumer key for Pocket to import contents
|
||||
form_rss:
|
||||
description: 'wallabag RSS akışı kaydetmiş olduğunuz makalelerini favori RSS okuyucunuzda görüntülemenizi sağlar. Bunu yapabilmek için öncelikle belirteç (token) oluşturmalısınız.'
|
||||
token_label: 'RSS belirteci (token)'
|
||||
|
|
|
@ -44,6 +44,18 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
<div class="row">
|
||||
{{ form_label(form.config.pocket_consumer_key) }}
|
||||
{{ form_errors(form.config.pocket_consumer_key) }}
|
||||
{{ form_widget(form.config.pocket_consumer_key) }}
|
||||
<p>
|
||||
»
|
||||
<a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
|
||||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{{ form_rest(form.config) }}
|
||||
</form>
|
||||
|
||||
|
|
|
@ -62,6 +62,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.config.pocket_consumer_key) }}
|
||||
{{ form_errors(form.config.pocket_consumer_key) }}
|
||||
{{ form_widget(form.config.pocket_consumer_key) }}
|
||||
<p>
|
||||
»
|
||||
<a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
|
||||
{{ form_rest(form.config) }}
|
||||
</form>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Tests\Wallabag\ImportBundle\Import;
|
|||
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
use Wallabag\ImportBundle\Import\PocketImport;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Subscriber\Mock;
|
||||
|
@ -27,6 +28,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->user = new User();
|
||||
|
||||
$config = new Config($this->user);
|
||||
$config->setPocketConsumerKey('xxx');
|
||||
|
||||
$this->user->setConfig($config);
|
||||
|
||||
$this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -35,19 +41,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$config->expects($this->any())
|
||||
->method('get')
|
||||
->with('pocket_consumer_key')
|
||||
->willReturn($consumerKey);
|
||||
|
||||
$pocket = new PocketImport(
|
||||
$this->em,
|
||||
$this->contentProxy,
|
||||
$config
|
||||
$this->contentProxy
|
||||
);
|
||||
$pocket->setUser($this->user);
|
||||
|
||||
|
|
Loading…
Reference in a new issue