From: Jeremy Benoist Date: Thu, 3 Nov 2016 15:41:29 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/master' into 2.2 X-Git-Tag: 2.2.0~3^2~78 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=5a619812ca3eb05a82a023ccdaee13501eb8d45f;hp=84795d015b3c7e1af48a3dda3cb33cf080b66e8f;p=github%2Fwallabag%2Fwallabag.git Merge remote-tracking branch 'origin/master' into 2.2 --- diff --git a/.gitignore b/.gitignore index 32b0fbbb..84fb95d7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ web/uploads/ !web/bundles web/bundles/* !web/bundles/wallabagcore +/web/assets/images/* +!web/assets/images/.gitkeep # Build /app/build @@ -34,7 +36,6 @@ web/bundles/* /composer.phar # Data for wallabag -data/assets/* data/db/wallabag*.sqlite # Docker container logs and data diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php index 3aafea64..39423e2f 100644 --- a/app/DoctrineMigrations/Version20160812120952.php +++ b/app/DoctrineMigrations/Version20160812120952.php @@ -33,9 +33,11 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI case 'sqlite': $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL'); break; + case 'mysql': $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext COLLATE \'utf8_unicode_ci\' DEFAULT NULL'); break; + case 'postgresql': $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name text DEFAULT NULL'); } diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php new file mode 100644 index 00000000..237db932 --- /dev/null +++ b/app/DoctrineMigrations/Version20161001072726.php @@ -0,0 +1,63 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); + + // remove all FK from entry_tag + $query = $this->connection->query("SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage WHERE TABLE_NAME = '".$this->getTable('entry_tag')."' AND CONSTRAINT_NAME LIKE 'FK_%' AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'"); + $query->execute(); + + foreach ($query->fetchAll() as $fk) { + $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); + } + + $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_tag FOREIGN KEY (tag_id) REFERENCES '.$this->getTable('tag').' (id) ON DELETE CASCADE'); + + // remove entry FK from annotation + $query = $this->connection->query("SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage WHERE TABLE_NAME = '".$this->getTable('annotation')."' AND CONSTRAINT_NAME LIKE 'FK_%' and COLUMN_NAME = 'entry_id' AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'"); + $query->execute(); + + foreach ($query->fetchAll() as $fk) { + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); + } + + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + throw new SkipMigrationException('Too complex ...'); + } +} diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php new file mode 100644 index 00000000..5cce55a5 --- /dev/null +++ b/app/DoctrineMigrations/Version20161022134138.php @@ -0,0 +1,77 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); + + $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); + + $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('tag').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('user').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `text` `text` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CHANGE `quote` `quote` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `title` `title` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE '.$this->getTable('entry').' CHANGE `content` `content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + } +} diff --git a/app/DoctrineMigrations/Version20161024212538.php b/app/DoctrineMigrations/Version20161024212538.php new file mode 100644 index 00000000..f8e927e4 --- /dev/null +++ b/app/DoctrineMigrations/Version20161024212538.php @@ -0,0 +1,45 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); + + $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD user_id INT(11) DEFAULT NULL'); + $this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD CONSTRAINT FK_clients_user_clients FOREIGN KEY (user_id) REFERENCES '.$this->getTable('user').' (id) ON DELETE CASCADE'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + + } +} diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php new file mode 100644 index 00000000..c7364428 --- /dev/null +++ b/app/DoctrineMigrations/Version20161031132655.php @@ -0,0 +1,44 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $this->addSql("INSERT INTO \"".$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); + } + + /** + * @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("DELETE FROM \"".$this->getTable('craue_config_setting')."\" WHERE name = 'download_images_enabled';"); + } +} diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml index 3e11d675..7c323783 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml @@ -29,3 +29,4 @@ piwik_enabled: Aktiver Piwik demo_mode_enabled: "Aktiver demo-indstilling? (anvendes kun til wallabags offentlige demo)" demo_mode_username: "Demobruger" # share_public: Allow public url for entries +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml index c74b5c1f..438eb74a 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml @@ -29,3 +29,4 @@ piwik_enabled: Piwik aktivieren demo_mode_enabled: "Test-Modus aktivieren? (nur für die öffentliche wallabag-Demo genutzt)" demo_mode_username: "Test-Benutzer" share_public: Erlaube eine öffentliche URL für Einträge +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml index 77c09db4..c2f2b3fb 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml @@ -29,3 +29,4 @@ 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 +download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml index baa83849..76feea50 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml @@ -29,3 +29,4 @@ piwik_enabled: Activar Piwik demo_mode_enabled: "Activar modo demo (sólo usado para la demo de wallabag)" demo_mode_username: "Nombre de usuario demo" # share_public: Allow public url for entries +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml index b394977e..30df0086 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml @@ -29,3 +29,4 @@ modify_settings: "اعمال" # 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 +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml index 31a80880..a60341b3 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml @@ -29,3 +29,4 @@ piwik_enabled: Activer Piwik demo_mode_enabled: "Activer le mode démo ? (utiliser uniquement pour la démo publique de wallabag)" demo_mode_username: "Utilisateur de la démo" share_public: Autoriser une URL publique pour les articles +download_images_enabled: Télécharger les images en local diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml index ba038556..3ad5f7d0 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml @@ -29,3 +29,4 @@ piwik_enabled: Abilita Piwik demo_mode_enabled: "Abilita modalità demo ? (usato solo per la demo pubblica di wallabag)" demo_mode_username: "Utente Demo" # share_public: Allow public url for entries +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml index 55249e33..fd83b437 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml @@ -29,3 +29,4 @@ piwik_enabled: Activar Piwik demo_mode_enabled: "Activar lo mode demostracion ? (utilizar solament per la demostracion publica de wallabag)" demo_mode_username: "Utilizaire de la demostracion" # share_public: Allow public url for entries +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml index 42cc5b52..3a63eebb 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml @@ -29,3 +29,4 @@ piwik_enabled: Włacz Piwik demo_mode_enabled: "Włacz tryb demo? (używany wyłącznie dla publicznej demonstracji Wallabag)" demo_mode_username: "Użytkownik Demonstracyjny" share_public: Zezwalaj na publiczny adres url dla wpisow +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml index 8e72b955..4fb42e98 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml @@ -29,3 +29,4 @@ modify_settings: "aplică" # 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 +# download_images_enabled: Download images locally diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml index 55f70843..ebfadf29 100644 --- a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml +++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml @@ -29,3 +29,4 @@ # 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 +# download_images_enabled: Download images locally diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js index ab30deb1..55de090c 100644 --- a/app/Resources/static/themes/_global/js/tools.js +++ b/app/Resources/static/themes/_global/js/tools.js @@ -1,5 +1,8 @@ const $ = require('jquery'); +/* Allows inline call qr-code call */ +import jrQrcode from 'jr-qrcode'; // eslint-disable-line + function supportsLocalStorage() { try { return 'localStorage' in window && window.localStorage !== null; diff --git a/app/config/config.yml b/app/config/config.yml index 81d1728a..7f24244d 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -78,7 +78,7 @@ doctrine: dbname: "%database_name%" user: "%database_user%" password: "%database_password%" - charset: UTF8 + charset: "%database_charset%" path: "%database_path%" unix_socket: "%database_socket%" server_version: 5.6 @@ -115,12 +115,26 @@ swiftmailer: fos_rest: param_fetcher_listener: true body_listener: true - format_listener: true view: + mime_types: + csv: + - 'text/csv' + - 'text/plain' + pdf: + - 'application/pdf' + epub: + - 'application/epub+zip' + mobi: + - 'application/x-mobipocket-ebook' view_response_listener: 'force' formats: xml: true - json : true + json: true + txt: true + csv: true + pdf: true + epub: true + mobi: true templating_formats: html: true force_redirects: @@ -129,10 +143,21 @@ fos_rest: default_engine: twig routing_loader: default_format: json + format_listener: + enabled: true + rules: + - { path: "^/api/entries/([0-9]+)/export.(.*)", priorities: ['epub', 'mobi', 'pdf', 'txt', 'csv'], fallback_format: false, prefer_extension: false } + - { path: "^/api", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false } + - { path: "^/annotations", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false } + # for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener + # so we need to add custom rule for custom api export but also for all other routes of the application... + - { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false } nelmio_api_doc: sandbox: enabled: false + cache: + enabled: true name: wallabag API documentation nelmio_cors: diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 3eab6fb2..f5e2c25e 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -28,7 +28,7 @@ doctrine: dbname: "%test_database_name%" user: "%test_database_user%" password: "%test_database_password%" - charset: UTF8 + charset: "%test_database_charset%" path: "%test_database_path%" orm: metadata_cache_driver: diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index ece4903a..7a22cb98 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -19,16 +19,18 @@ parameters: database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" database_table_prefix: wallabag_ database_socket: null + # with MySQL, use "utf8mb4" if you got problem with content with emojis + database_charset: utf8 - mailer_transport: smtp - mailer_host: 127.0.0.1 - mailer_user: ~ - mailer_password: ~ + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: ~ + mailer_password: ~ - locale: en + locale: en # A secret key that's used to generate certain security-related tokens - secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv + secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv # two factor stuff twofactor_auth: true diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml index 2943b27a..5f2e25bb 100644 --- a/app/config/parameters_test.yml +++ b/app/config/parameters_test.yml @@ -6,3 +6,4 @@ parameters: test_database_user: null test_database_password: null test_database_path: '%kernel.root_dir%/../data/db/wallabag_test.sqlite' + test_database_charset: utf8 diff --git a/app/config/routing_rest.yml b/app/config/routing_rest.yml index 52d395dd..29f4ab14 100644 --- a/app/config/routing_rest.yml +++ b/app/config/routing_rest.yml @@ -1,4 +1,3 @@ Rest_Wallabag: - type : rest - resource: "@WallabagApiBundle/Resources/config/routing_rest.yml" - + type : rest + resource: "@WallabagApiBundle/Resources/config/routing_rest.yml" diff --git a/app/config/services.yml b/app/config/services.yml index a57ef0f3..9a1ce80b 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -32,13 +32,13 @@ services: - { name: twig.extension } wallabag.locale_listener: - class: Wallabag\CoreBundle\EventListener\LocaleListener + class: Wallabag\CoreBundle\Event\Listener\LocaleListener arguments: ["%kernel.default_locale%"] tags: - { name: kernel.event_subscriber } wallabag.user_locale_listener: - class: Wallabag\CoreBundle\EventListener\UserLocaleListener + class: Wallabag\CoreBundle\Event\Listener\UserLocaleListener arguments: ["@session"] tags: - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin } diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml index d8512845..bca2d466 100644 --- a/app/config/tests/parameters_test.mysql.yml +++ b/app/config/tests/parameters_test.mysql.yml @@ -6,3 +6,4 @@ parameters: test_database_user: root test_database_password: ~ test_database_path: ~ + test_database_charset: utf8mb4 diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml index 41383868..3e18d4a0 100644 --- a/app/config/tests/parameters_test.pgsql.yml +++ b/app/config/tests/parameters_test.pgsql.yml @@ -6,3 +6,4 @@ parameters: test_database_user: travis test_database_password: ~ test_database_path: ~ + test_database_charset: utf8 diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml index 1952e3a6..b8a5f41a 100644 --- a/app/config/tests/parameters_test.sqlite.yml +++ b/app/config/tests/parameters_test.sqlite.yml @@ -6,3 +6,4 @@ parameters: test_database_user: ~ test_database_password: ~ test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite" + test_database_charset: utf8 diff --git a/composer.json b/composer.json index 79de337b..e7b30fa1 100644 --- a/composer.json +++ b/composer.json @@ -54,11 +54,11 @@ "sensio/framework-extra-bundle": "^3.0.2", "incenteev/composer-parameter-handler": "^2.0", "nelmio/cors-bundle": "~1.4.0", - "friendsofsymfony/rest-bundle": "~1.4", - "jms/serializer-bundle": "~1.0", + "friendsofsymfony/rest-bundle": "~2.1", + "jms/serializer-bundle": "~1.1", "nelmio/api-doc-bundle": "~2.7", "mgargano/simplehtmldom": "~1.5", - "tecnickcom/tcpdf": "~6.2", + "tecnickcom/tc-lib-pdf": "dev-master", "simplepie/simplepie": "~1.3.1", "willdurand/hateoas-bundle": "~1.0", "htmlawed/htmlawed": "~1.1.19", @@ -82,7 +82,8 @@ "white-october/pagerfanta-bundle": "^1.0", "php-amqplib/rabbitmq-bundle": "^1.8", "predis/predis": "^1.0", - "javibravo/simpleue": "^1.0" + "javibravo/simpleue": "^1.0", + "symfony/dom-crawler": "^3.1" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2", diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst index f74924df..e7055a14 100644 --- a/docs/en/user/configuration.rst +++ b/docs/en/user/configuration.rst @@ -50,6 +50,8 @@ User information You can change your name, your email address and enable ``Two factor authentication``. +If the wallabag instance has more than one enabled user, you can delete your account here. **Take care, we delete all your data**. + Two factor authentication ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/en/user/parameters.rst b/docs/en/user/parameters.rst index 6cbd5ae4..c35cf3b8 100644 --- a/docs/en/user/parameters.rst +++ b/docs/en/user/parameters.rst @@ -12,6 +12,7 @@ What is the meaning of the parameters? "database_path", "``""%kernel.root_dir%/../data/db/wallabag.sqlite""``", "only for SQLite, define where to put the database file. Leave it empty for other database" "database_table_prefix", "wallabag_", "all wallabag's tables will be prefixed with that string. You can include a ``_`` for clarity" "database_socket", "null", "If your database is using a socket instead of tcp, put the path of the socket (other connection parameters will then be ignored)" + "database_charset", "utf8mb4", "For PostgreSQL & SQLite you should use utf8, for MySQL use utf8mb4 which handle emoji" .. csv-table:: Configuration to send emails from wallabag :header: "name", "default", "description" diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst index 8bfe66f5..90eece11 100644 --- a/docs/fr/user/configuration.rst +++ b/docs/fr/user/configuration.rst @@ -51,6 +51,8 @@ Mon compte Vous pouvez ici modifier votre nom, votre adresse email et activer la ``Double authentification``. +Si l'instance de wallabag compte plus d'un utilisateur actif, vous pouvez supprimer ici votre compte. **Attention, nous supprimons toutes vos données**. + Double authentification (2FA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/package.json b/package.json index 20afb425..e8cf58e5 100644 --- a/package.json +++ b/package.json @@ -99,5 +99,8 @@ "stylelint": "^7.3.1", "stylelint-config-standard": "^13.0.2", "through": "^2.3.8" + }, + "dependencies": { + "jr-qrcode": "^1.0.5" } } diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index ad083e31..c13a034f 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -3,9 +3,8 @@ namespace Wallabag\AnnotationBundle\Controller; use FOS\RestBundle\Controller\FOSRestController; -use Nelmio\ApiDocBundle\Annotation\ApiDoc; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Wallabag\AnnotationBundle\Entity\Annotation; use Wallabag\CoreBundle\Entity\Entry; @@ -15,42 +14,35 @@ class WallabagAnnotationController extends FOSRestController /** * Retrieve annotations for an entry. * - * @ApiDoc( - * requirements={ - * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} - * } - * ) + * @param Entry $entry + * + * @see Wallabag\ApiBundle\Controller\WallabagRestController * - * @return Response + * @return JsonResponse */ public function getAnnotationsAction(Entry $entry) { $annotationRows = $this - ->getDoctrine() - ->getRepository('WallabagAnnotationBundle:Annotation') - ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); + ->getDoctrine() + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); $total = count($annotationRows); $annotations = ['total' => $total, 'rows' => $annotationRows]; $json = $this->get('serializer')->serialize($annotations, 'json'); - return $this->renderJsonResponse($json); + return (new JsonResponse())->setJson($json); } /** * Creates a new annotation. * - * @param Entry $entry + * @param Request $request + * @param Entry $entry * - * @ApiDoc( - * requirements={ - * {"name"="ranges", "dataType"="array", "requirement"="\w+", "description"="The range array for the annotation"}, - * {"name"="quote", "dataType"="string", "required"=false, "description"="Optional, quote for the annotation"}, - * {"name"="text", "dataType"="string", "required"=true, "description"=""}, - * } - * ) + * @return JsonResponse * - * @return Response + * @see Wallabag\ApiBundle\Controller\WallabagRestController */ public function postAnnotationAction(Request $request, Entry $entry) { @@ -75,21 +67,20 @@ class WallabagAnnotationController extends FOSRestController $json = $this->get('serializer')->serialize($annotation, 'json'); - return $this->renderJsonResponse($json); + return (new JsonResponse())->setJson($json); } /** * Updates an annotation. * - * @ApiDoc( - * requirements={ - * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} - * } - * ) + * @see Wallabag\ApiBundle\Controller\WallabagRestController * * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") * - * @return Response + * @param Annotation $annotation + * @param Request $request + * + * @return JsonResponse */ public function putAnnotationAction(Annotation $annotation, Request $request) { @@ -104,21 +95,19 @@ class WallabagAnnotationController extends FOSRestController $json = $this->get('serializer')->serialize($annotation, 'json'); - return $this->renderJsonResponse($json); + return (new JsonResponse())->setJson($json); } /** * Removes an annotation. * - * @ApiDoc( - * requirements={ - * {"name"="annotation", "dataType"="string", "requirement"="\w+", "description"="The annotation ID"} - * } - * ) + * @see Wallabag\ApiBundle\Controller\WallabagRestController * * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") * - * @return Response + * @param Annotation $annotation + * + * @return JsonResponse */ public function deleteAnnotationAction(Annotation $annotation) { @@ -128,19 +117,6 @@ class WallabagAnnotationController extends FOSRestController $json = $this->get('serializer')->serialize($annotation, 'json'); - return $this->renderJsonResponse($json); - } - - /** - * Send a JSON Response. - * We don't use the Symfony JsonRespone, because it takes an array as parameter instead of a JSON string. - * - * @param string $json - * - * @return Response - */ - private function renderJsonResponse($json, $code = 200) - { - return new Response($json, $code, ['application/json']); + return (new JsonResponse())->setJson($json); } } diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php index c48d8731..0838f5aa 100644 --- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php +++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php @@ -82,7 +82,7 @@ class Annotation * @Exclude * * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations") - * @ORM\JoinColumn(name="entry_id", referencedColumnName="id") + * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade") */ private $entry; diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 5f7da70e..8d3f07ee 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -50,7 +50,8 @@ class AnnotationRepository extends EntityRepository { return $this->createQueryBuilder('a') ->andWhere('a.id = :annotationId')->setParameter('annotationId', $annotationId) - ->getQuery()->getSingleResult() + ->getQuery() + ->getSingleResult() ; } @@ -67,7 +68,8 @@ class AnnotationRepository extends EntityRepository return $this->createQueryBuilder('a') ->where('a.entry = :entryId')->setParameter('entryId', $entryId) ->andwhere('a.user = :userId')->setParameter('userId', $userId) - ->getQuery()->getResult() + ->getQuery() + ->getResult() ; } @@ -106,4 +108,18 @@ class AnnotationRepository extends EntityRepository ->getQuery() ->getSingleResult(); } + + /** + * Remove all annotations for a user id. + * Used when a user want to reset all informations. + * + * @param int $userId + */ + public function removeAllByUserId($userId) + { + $this->getEntityManager() + ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId') + ->setParameter('userId', $userId) + ->execute(); + } } diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index 5a36a260..550c0608 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -19,7 +19,7 @@ class DeveloperController extends Controller */ public function indexAction() { - $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); + $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findByUser($this->getUser()->getId()); return $this->render('@WallabagCore/themes/common/Developer/index.html.twig', [ 'clients' => $clients, @@ -38,7 +38,7 @@ class DeveloperController extends Controller public function createClientAction(Request $request) { $em = $this->getDoctrine()->getManager(); - $client = new Client(); + $client = new Client($this->getUser()); $clientForm = $this->createForm(ClientType::class, $client); $clientForm->handleRequest($request); @@ -75,6 +75,10 @@ class DeveloperController extends Controller */ public function deleteClientAction(Client $client) { + if (null === $this->getUser() || $client->getUser()->getId() != $this->getUser()->getId()) { + throw $this->createAccessDeniedException('You can not access this client.'); + } + $em = $this->getDoctrine()->getManager(); $em->remove($client); $em->flush(); diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 24fa7b3b..b3622c62 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -10,6 +10,8 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\CoreBundle\Event\EntrySavedEvent; +use Wallabag\CoreBundle\Event\EntryDeletedEvent; class EntryRestController extends WallabagRestController { @@ -200,9 +202,11 @@ class EntryRestController extends WallabagRestController $em = $this->getDoctrine()->getManager(); $em->persist($entry); - $em->flush(); + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + $json = $this->get('serializer')->serialize($entry, 'json'); return (new JsonResponse())->setJson($json); @@ -279,6 +283,9 @@ class EntryRestController extends WallabagRestController $em->remove($entry); $em->flush(); + // entry deleted, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); + $json = $this->get('serializer')->serialize($entry, 'json'); return (new JsonResponse())->setJson($json); diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index e927a890..544c1ea9 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -8,6 +8,20 @@ use Wallabag\CoreBundle\Entity\Entry; class WallabagRestController extends FOSRestController { + /** + * Retrieve version number. + * + * @ApiDoc() + * + * @return JsonResponse + */ + public function getVersionAction() + { + $version = $this->container->getParameter('wallabag_core.version'); + $json = $this->get('serializer')->serialize($version, 'json'); + return (new JsonResponse())->setJson($json); + } + protected function validateAuthentication() { if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index f7898ac8..427a4c7f 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php @@ -4,6 +4,7 @@ namespace Wallabag\ApiBundle\Entity; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\Client as BaseClient; +use Wallabag\UserBundle\Entity\User; /** * @ORM\Table("oauth2_clients") @@ -35,9 +36,15 @@ class Client extends BaseClient */ protected $accessTokens; - public function __construct() + /** + * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") + */ + private $user; + + public function __construct(User $user) { parent::__construct(); + $this->user = $user; } /** @@ -63,4 +70,12 @@ class Client extends BaseClient return $this; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } } diff --git a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml index c1af9e02..8e1886ac 100644 --- a/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml +++ b/src/Wallabag/ApiBundle/Resources/config/routing_rest.yml @@ -1,9 +1,14 @@ -entries: +entry: type: rest - resource: "WallabagApiBundle:EntryRest" + resource: "WallabagApiBundle:EntryRest" name_prefix: api_ -tags: +tag: type: rest - resource: "WallabagApiBundle:TagRest" + resource: "WallabagApiBundle:TagRest" + name_prefix: api_ + +misc: + type: rest + resource: "WallabagApiBundle:WallabagRest" name_prefix: api_ diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 857a8b4c..9fe90357 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -40,7 +40,7 @@ class InstallCommand extends ContainerAwareCommand { $this ->setName('wallabag:install') - ->setDescription('Wallabag installer.') + ->setDescription('wallabag installer.') ->addOption( 'reset', null, @@ -55,7 +55,7 @@ class InstallCommand extends ContainerAwareCommand $this->defaultInput = $input; $this->defaultOutput = $output; - $output->writeln('Installing Wallabag...'); + $output->writeln('Installing wallabag...'); $output->writeln(''); $this @@ -65,7 +65,7 @@ class InstallCommand extends ContainerAwareCommand ->setupConfig() ; - $output->writeln('Wallabag has been successfully installed.'); + $output->writeln('wallabag has been successfully installed.'); $output->writeln('Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000'); } @@ -77,7 +77,7 @@ class InstallCommand extends ContainerAwareCommand // testing if database driver exists $fulfilled = true; - $label = 'PDO Driver'; + $label = 'PDO Driver (%s)'; $status = 'OK!'; $help = ''; @@ -87,7 +87,7 @@ class InstallCommand extends ContainerAwareCommand $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; } - $rows[] = [$label, $status, $help]; + $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help]; // testing if connection to the database can be etablished $label = 'Database connection'; @@ -95,7 +95,8 @@ class InstallCommand extends ContainerAwareCommand $help = ''; try { - $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); + $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection(); + $conn->connect(); } catch (\Exception $e) { if (false === strpos($e->getMessage(), 'Unknown database') && false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) { @@ -107,6 +108,21 @@ class InstallCommand extends ContainerAwareCommand $rows[] = [$label, $status, $help]; + // now check if MySQL isn't too old to handle utf8mb4 + if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { + $version = $conn->query('select version()')->fetchColumn(); + $minimalVersion = '5.5.4'; + + if (false === version_compare($version, $minimalVersion, '>')) { + $fulfilled = false; + $rows[] = [ + 'Database version', + 'ERROR!', + 'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).', + ]; + } + } + foreach ($this->functionExists as $functionRequired) { $label = ''.$functionRequired.''; $status = 'OK!'; @@ -131,7 +147,7 @@ class InstallCommand extends ContainerAwareCommand throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.'); } - $this->defaultOutput->writeln('Success! Your system can run Wallabag properly.'); + $this->defaultOutput->writeln('Success! Your system can run wallabag properly.'); $this->defaultOutput->writeln(''); @@ -354,7 +370,7 @@ class InstallCommand extends ContainerAwareCommand ], [ 'name' => 'wallabag_url', - 'value' => 'http://v2.wallabag.org', + 'value' => '', 'section' => 'misc', ], [ @@ -382,6 +398,11 @@ class InstallCommand extends ContainerAwareCommand 'value' => 'wallabag', 'section' => 'misc', ], + [ + 'name' => 'download_images_enabled', + 'value' => '0', + 'section' => 'misc', + ], ]; foreach ($settings as $setting) { diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 91cdcae5..d40efcd7 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\TaggingRule; use Wallabag\CoreBundle\Form\Type\ConfigType; @@ -148,6 +149,10 @@ class ConfigController extends Controller 'token' => $config->getRssToken(), ], 'twofactor_auth' => $this->getParameter('twofactor_auth'), + 'wallabag_url' => $this->get('craue_config')->get('wallabag_url'), + 'enabled_users' => $this->getDoctrine() + ->getRepository('WallabagUserBundle:User') + ->getSumEnabledUsers(), ]); } @@ -220,6 +225,80 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('config').'?tagging-rule='.$rule->getId().'#set5'); } + /** + * Remove all annotations OR tags OR entries for the current user. + * + * @Route("/reset/{type}", requirements={"id" = "annotations|tags|entries"}, name="config_reset") + * + * @return RedirectResponse + */ + public function resetAction($type) + { + $em = $this->getDoctrine()->getManager(); + + switch ($type) { + case 'annotations': + $this->getDoctrine() + ->getRepository('WallabagAnnotationBundle:Annotation') + ->removeAllByUserId($this->getUser()->getId()); + break; + + case 'tags': + $this->removeAllTagsByUserId($this->getUser()->getId()); + break; + + case 'entries': + // SQLite doesn't care about cascading remove, so we need to manually remove associated stuf + // otherwise they won't be removed ... + if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { + $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); + } + + // manually remove tags to avoid orphan tag + $this->removeAllTagsByUserId($this->getUser()->getId()); + + $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->removeAllByUserId($this->getUser()->getId()); + } + + $this->get('session')->getFlashBag()->add( + 'notice', + 'flashes.config.notice.'.$type.'_reset' + ); + + return $this->redirect($this->generateUrl('config').'#set3'); + } + + /** + * Remove all tags for a given user and cleanup orphan tags. + * + * @param int $userId + */ + private function removeAllTagsByUserId($userId) + { + $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId); + + if (empty($tags)) { + return; + } + + $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->removeTags($userId, $tags); + + // cleanup orphan tags + $em = $this->getDoctrine()->getManager(); + + foreach ($tags as $tag) { + if (count($tag->getEntries()) === 0) { + $em->remove($tag); + } + } + + $em->flush(); + } + /** * Validate that a rule can be edited/deleted by the current user. * @@ -251,4 +330,37 @@ class ConfigController extends Controller return $config; } + + /** + * Delete account for current user. + * + * @Route("/account/delete", name="delete_account") + * + * @param Request $request + * + * @throws AccessDeniedHttpException + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function deleteAccountAction(Request $request) + { + $enabledUsers = $this->getDoctrine() + ->getRepository('WallabagUserBundle:User') + ->getSumEnabledUsers(); + + if ($enabledUsers <= 1) { + throw new AccessDeniedHttpException(); + } + + $user = $this->getUser(); + + // logout current user + $this->get('security.token_storage')->setToken(null); + $request->getSession()->invalidate(); + + $em = $this->get('fos_user.user_manager'); + $em->deleteUser($user); + + return $this->redirect($this->generateUrl('fos_user_security_login')); + } } diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 97bb3d12..3f4eb17d 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -13,6 +13,8 @@ use Wallabag\CoreBundle\Form\Type\EntryFilterType; use Wallabag\CoreBundle\Form\Type\EditEntryType; use Wallabag\CoreBundle\Form\Type\NewEntryType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; +use Wallabag\CoreBundle\Event\EntrySavedEvent; +use Wallabag\CoreBundle\Event\EntryDeletedEvent; class EntryController extends Controller { @@ -81,6 +83,9 @@ class EntryController extends Controller $em->persist($entry); $em->flush(); + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + return $this->redirect($this->generateUrl('homepage')); } @@ -107,6 +112,9 @@ class EntryController extends Controller $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); + + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); } return $this->redirect($this->generateUrl('homepage')); @@ -343,6 +351,9 @@ class EntryController extends Controller $em->persist($entry); $em->flush(); + // entry saved, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); } @@ -431,6 +442,9 @@ class EntryController extends Controller UrlGeneratorInterface::ABSOLUTE_PATH ); + // entry deleted, dispatch event about it! + $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); + $em = $this->getDoctrine()->getManager(); $em->remove($entry); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 707f3bbe..a3e70fd0 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -90,15 +90,15 @@ class TagController extends Controller $flatTags = []; - foreach ($tags as $key => $tag) { + foreach ($tags as $tag) { $nbEntries = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') - ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']); + ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); $flatTags[] = [ - 'id' => $tag['id'], - 'label' => $tag['label'], - 'slug' => $tag['slug'], + 'id' => $tag->getId(), + 'label' => $tag->getLabel(), + 'slug' => $tag->getSlug(), 'nbEntries' => $nbEntries, ]; } diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index a5e1be65..d0085660 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -140,6 +140,11 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface 'value' => 'wallabag', 'section' => 'misc', ], + [ + 'name' => 'download_images_enabled', + 'value' => '0', + 'section' => 'misc', + ], ]; foreach ($settings as $setting) { @@ -158,6 +163,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface */ public function getOrder() { - return 50; + return 29; } } diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index f2da3f4d..dd0f7e67 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -19,7 +19,7 @@ use Wallabag\AnnotationBundle\Entity\Annotation; * * @XmlRoot("entry") * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository") - * @ORM\Table(name="`entry`") + * @ORM\Table(name="`entry`", options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}) * @ORM\HasLifecycleCallbacks() * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") */ @@ -190,10 +190,10 @@ class Entry * @ORM\JoinTable( * name="entry_tag", * joinColumns={ - * @ORM\JoinColumn(name="entry_id", referencedColumnName="id") + * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade") * }, * inverseJoinColumns={ - * @ORM\JoinColumn(name="tag_id", referencedColumnName="id") + * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="cascade") * } * ) */ diff --git a/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php b/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php new file mode 100644 index 00000000..e9061d04 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php @@ -0,0 +1,26 @@ +entry = $entry; + } + + public function getEntry() + { + return $this->entry; + } +} diff --git a/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php b/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php new file mode 100644 index 00000000..5fdb5221 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php @@ -0,0 +1,26 @@ +entry = $entry; + } + + public function getEntry() + { + return $this->entry; + } +} diff --git a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php b/src/Wallabag/CoreBundle/Event/Listener/LocaleListener.php similarity index 96% rename from src/Wallabag/CoreBundle/EventListener/LocaleListener.php rename to src/Wallabag/CoreBundle/Event/Listener/LocaleListener.php index a1c7e5ab..b435d99e 100644 --- a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php +++ b/src/Wallabag/CoreBundle/Event/Listener/LocaleListener.php @@ -1,6 +1,6 @@ em = $em; + $this->downloadImages = $downloadImages; + $this->enabled = $enabled; + $this->logger = $logger; + } + + public static function getSubscribedEvents() + { + return [ + EntrySavedEvent::NAME => 'onEntrySaved', + EntryDeletedEvent::NAME => 'onEntryDeleted', + ]; + } + + /** + * Download images and updated the data into the entry. + * + * @param EntrySavedEvent $event + */ + public function onEntrySaved(EntrySavedEvent $event) + { + if (!$this->enabled) { + $this->logger->debug('DownloadImagesSubscriber: disabled.'); + + return; + } + + $entry = $event->getEntry(); + + $html = $this->downloadImages($entry); + if (false !== $html) { + $this->logger->debug('DownloadImagesSubscriber: updated html.'); + + $entry->setContent($html); + } + + // update preview picture + $previewPicture = $this->downloadPreviewImage($entry); + if (false !== $previewPicture) { + $this->logger->debug('DownloadImagesSubscriber: update preview picture.'); + + $entry->setPreviewPicture($previewPicture); + } + + $this->em->persist($entry); + $this->em->flush(); + } + + /** + * Remove images related to the entry. + * + * @param EntryDeletedEvent $event + */ + public function onEntryDeleted(EntryDeletedEvent $event) + { + if (!$this->enabled) { + $this->logger->debug('DownloadImagesSubscriber: disabled.'); + + return; + } + + $this->downloadImages->removeImages($event->getEntry()->getId()); + } + + /** + * Download all images from the html. + * + * @todo If we want to add async download, it should be done in that method + * + * @param Entry $entry + * + * @return string|false False in case of async + */ + private function downloadImages(Entry $entry) + { + return $this->downloadImages->processHtml( + $entry->getId(), + $entry->getContent(), + $entry->getUrl() + ); + } + + /** + * Download the preview picture. + * + * @todo If we want to add async download, it should be done in that method + * + * @param Entry $entry + * + * @return string|false False in case of async + */ + private function downloadPreviewImage(Entry $entry) + { + return $this->downloadImages->processSingleImage( + $entry->getId(), + $entry->getPreviewPicture(), + $entry->getUrl() + ); + } +} diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php new file mode 100644 index 00000000..3b4c4cf9 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php @@ -0,0 +1,70 @@ +doctrine = $doctrine; + } + + /** + * @return array + */ + public function getSubscribedEvents() + { + return [ + 'preRemove', + ]; + } + + /** + * We removed everything related to the upcoming removed entry because SQLite can't handle it on it own. + * We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone). + * + * @param LifecycleEventArgs $args + */ + public function preRemove(LifecycleEventArgs $args) + { + $entity = $args->getEntity(); + + if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver || + !$entity instanceof Entry) { + return; + } + + $em = $this->doctrine->getManager(); + + if (null !== $entity->getTags()) { + foreach ($entity->getTags() as $tag) { + $entity->removeTag($tag); + } + } + + if (null !== $entity->getAnnotations()) { + foreach ($entity->getAnnotations() as $annotation) { + $em->remove($annotation); + } + } + + $em->flush(); + } +} diff --git a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php similarity index 97% rename from src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php rename to src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php index 0379ad6a..9013328f 100644 --- a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php @@ -1,6 +1,6 @@ graby = $graby; $this->tagger = $tagger; @@ -66,6 +66,7 @@ class ContentProxy $entry->setUrl($content['url'] ?: $url); $entry->setTitle($title); $entry->setContent($html); + $entry->setLanguage($content['language']); $entry->setMimetype($content['content_type']); $entry->setReadingTime(Utils::getReadingTime($html)); diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php new file mode 100644 index 00000000..c5298236 --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php @@ -0,0 +1,233 @@ +client = $client; + $this->baseFolder = $baseFolder; + $this->wallabagUrl = rtrim($wallabagUrl, '/'); + $this->logger = $logger; + $this->mimeGuesser = new MimeTypeExtensionGuesser(); + + $this->setFolder(); + } + + /** + * Setup base folder where all images are going to be saved. + */ + private function setFolder() + { + // if folder doesn't exist, attempt to create one and store the folder name in property $folder + if (!file_exists($this->baseFolder)) { + mkdir($this->baseFolder, 0777, true); + } + } + + /** + * Process the html and extract image from it, save them to local and return the updated html. + * + * @param int $entryId ID of the entry + * @param string $html + * @param string $url Used as a base path for relative image and folder + * + * @return string + */ + public function processHtml($entryId, $html, $url) + { + $crawler = new Crawler($html); + $result = $crawler + ->filterXpath('//img') + ->extract(array('src')); + + $relativePath = $this->getRelativePath($entryId); + + // download and save the image to the folder + foreach ($result as $image) { + $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath); + + if (false === $imagePath) { + continue; + } + + $html = str_replace($image, $imagePath, $html); + } + + return $html; + } + + /** + * Process a single image: + * - retrieve it + * - re-saved it (for security reason) + * - return the new local path. + * + * @param int $entryId ID of the entry + * @param string $imagePath Path to the image to retrieve + * @param string $url Url from where the image were found + * @param string $relativePath Relative local path to saved the image + * + * @return string Relative url to access the image from the web + */ + public function processSingleImage($entryId, $imagePath, $url, $relativePath = null) + { + if (null === $relativePath) { + $relativePath = $this->getRelativePath($entryId); + } + + $this->logger->debug('DownloadImages: working on image: '.$imagePath); + + $folderPath = $this->baseFolder.'/'.$relativePath; + + // build image path + $absolutePath = $this->getAbsoluteLink($url, $imagePath); + if (false === $absolutePath) { + $this->logger->error('DownloadImages: Can not determine the absolute path for that image, skipping.'); + + return false; + } + + try { + $res = $this->client->get($absolutePath); + } catch (\Exception $e) { + $this->logger->error('DownloadImages: Can not retrieve image, skipping.', ['exception' => $e]); + + return false; + } + + $ext = $this->mimeGuesser->guess($res->getHeader('content-type')); + $this->logger->debug('DownloadImages: Checking extension', ['ext' => $ext, 'header' => $res->getHeader('content-type')]); + if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { + $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping '.$imagePath); + + return false; + } + $hashImage = hash('crc32', $absolutePath); + $localPath = $folderPath.'/'.$hashImage.'.'.$ext; + + try { + $im = imagecreatefromstring($res->getBody()); + } catch (\Exception $e) { + $im = false; + } + + if (false === $im) { + $this->logger->error('DownloadImages: Error while regenerating image', ['path' => $localPath]); + + return false; + } + + switch ($ext) { + case 'gif': + $result = imagegif($im, $localPath); + $this->logger->debug('DownloadImages: Re-creating gif'); + break; + case 'jpeg': + case 'jpg': + $result = imagejpeg($im, $localPath, self::REGENERATE_PICTURES_QUALITY); + $this->logger->debug('DownloadImages: Re-creating jpg'); + break; + case 'png': + $result = imagepng($im, $localPath, ceil(self::REGENERATE_PICTURES_QUALITY / 100 * 9)); + $this->logger->debug('DownloadImages: Re-creating png'); + } + + imagedestroy($im); + + return $this->wallabagUrl.'/assets/images/'.$relativePath.'/'.$hashImage.'.'.$ext; + } + + /** + * Remove all images for the given entry id. + * + * @param int $entryId ID of the entry + */ + public function removeImages($entryId) + { + $relativePath = $this->getRelativePath($entryId); + $folderPath = $this->baseFolder.'/'.$relativePath; + + $finder = new Finder(); + $finder + ->files() + ->ignoreDotFiles(true) + ->in($folderPath); + + foreach ($finder as $file) { + @unlink($file->getRealPath()); + } + + @rmdir($folderPath); + } + + /** + * Generate the folder where we are going to save images based on the entry url. + * + * @param int $entryId ID of the entry + * + * @return string + */ + private function getRelativePath($entryId) + { + $hashId = hash('crc32', $entryId); + $relativePath = $hashId[0].'/'.$hashId[1].'/'.$hashId; + $folderPath = $this->baseFolder.'/'.$relativePath; + + if (!file_exists($folderPath)) { + mkdir($folderPath, 0777, true); + } + + $this->logger->debug('DownloadImages: Folder used for that Entry id', ['folder' => $folderPath, 'entryId' => $entryId]); + + return $relativePath; + } + + /** + * Make an $url absolute based on the $base. + * + * @see Graby->makeAbsoluteStr + * + * @param string $base Base url + * @param string $url Url to make it absolute + * + * @return false|string + */ + private function getAbsoluteLink($base, $url) + { + if (preg_match('!^https?://!i', $url)) { + // already absolute + return $url; + } + + $base = new \SimplePie_IRI($base); + + // remove '//' in URL path (causes URLs not to resolve properly) + if (isset($base->ipath)) { + $base->ipath = preg_replace('!//+!', '/', $base->ipath); + } + + if ($absolute = \SimplePie_IRI::absolutize($base, $url)) { + return $absolute->get_uri(); + } + + $this->logger->error('DownloadImages: Can not make an absolute link', ['base' => $base, 'url' => $url]); + + return false; + } +} diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index cd2b47b9..14616d88 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -329,4 +329,18 @@ class EntryRepository extends EntityRepository return $qb->getQuery()->getSingleScalarResult(); } + + /** + * Remove all entries for a user id. + * Used when a user want to reset all informations. + * + * @param int $userId + */ + public function removeAllByUserId($userId) + { + $this->getEntityManager() + ->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId') + ->setParameter('userId', $userId) + ->execute(); + } } diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index e76878d4..81445989 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -34,6 +34,9 @@ class TagRepository extends EntityRepository /** * Find all tags per user. + * Instead of just left joined on the Entry table, we select only id and group by id to avoid tag multiplication in results. + * Once we have all tags id, we can safely request them one by one. + * This'll still be fastest than the previous query. * * @param int $userId * @@ -41,15 +44,20 @@ class TagRepository extends EntityRepository */ public function findAllTags($userId) { - return $this->createQueryBuilder('t') - ->select('t.slug', 't.label', 't.id') + $ids = $this->createQueryBuilder('t') + ->select('t.id') ->leftJoin('t.entries', 'e') ->where('e.user = :userId')->setParameter('userId', $userId) - ->groupBy('t.slug') - ->addGroupBy('t.label') - ->addGroupBy('t.id') + ->groupBy('t.id') ->getQuery() ->getArrayResult(); + + $tags = []; + foreach ($ids as $id) { + $tags[] = $this->find($id); + } + + return $tags; } /** diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 90a2419e..9786ac27 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -30,7 +30,7 @@ services: - "@doctrine" wallabag_core.subscriber.table_prefix: - class: Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber + class: Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber arguments: - "%database_table_prefix%" tags: @@ -130,3 +130,31 @@ services: arguments: - '@twig' - '%kernel.debug%' + + wallabag_core.subscriber.sqlite_cascade_delete: + class: Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber + arguments: + - "@doctrine" + tags: + - { name: doctrine.event_subscriber } + + wallabag_core.subscriber.download_images: + class: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber + arguments: + - "@doctrine.orm.default_entity_manager" + - "@wallabag_core.entry.download_images" + - '@=service(''craue_config'').get(''download_images_enabled'')' + - "@logger" + tags: + - { name: kernel.event_subscriber } + + wallabag_core.entry.download_images: + class: Wallabag\CoreBundle\Helper\DownloadImages + arguments: + - "@wallabag_core.entry.download_images.client" + - "%kernel.root_dir%/../web/assets/images" + - '@=service(''craue_config'').get(''wallabag_url'')' + - "@logger" + + wallabag_core.entry.download_images.client: + class: GuzzleHttp\Client diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 6ca7e459..aeae6bcf 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -71,6 +71,7 @@ config: # 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Navn' email_label: 'Emailadresse' # twoFactorAuthentication_label: 'Two factor authentication' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Gammel adgangskode' new_password_label: 'Ny adgangskode' @@ -355,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." # firefox: # page_title: 'Import > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -458,8 +472,10 @@ flashes: rss_updated: 'RSS-oplysninger opdateret' # tagging_rules_updated: 'Tagging rules updated' # tagging_rules_deleted: 'Tagging rule deleted' - # user_added: 'User "%username%" added' # rss_token_updated: 'RSS token updated' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: # entry_already_saved: 'Entry already saved on %date%' @@ -489,3 +505,8 @@ flashes: notice: # client_created: 'New client created.' # client_deleted: 'Client deleted' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 8fd1d82a..2105d02d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -71,6 +71,7 @@ config: 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Name' email_label: 'E-Mail-Adresse' twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Altes Kennwort' new_password_label: 'Neues Kennwort' @@ -355,6 +368,7 @@ import: how_to: 'Bitte wähle deinen Readability Export aus und klicke den unteren Button für das Hochladen und Importieren dessen.' worker: enabled: "Der Import erfolgt asynchron. Sobald der Import gestartet ist, wird diese Aufgabe extern abgearbeitet. Der aktuelle Service dafür ist:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Aus Firefox importieren' description: "Dieser Import wird all deine Lesezeichen aus Firefox importieren. Gehe zu deinen Lesezeichen (Strg+Shift+O), dann auf \"Importen und Sichern\", wähle \"Sichern…\". Du erhälst eine .json Datei." @@ -458,8 +472,10 @@ flashes: rss_updated: 'RSS-Informationen aktualisiert' tagging_rules_updated: 'Tagging-Regeln aktualisiert' tagging_rules_deleted: 'Tagging-Regel gelöscht' - user_added: 'Benutzer "%username%" erstellt' rss_token_updated: 'RSS-Token aktualisiert' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'Eintrag bereits am %date% gespeichert' @@ -489,3 +505,8 @@ flashes: notice: client_created: 'Neuer Client erstellt.' client_deleted: 'Client gelöscht' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 02f56535..2bb95728 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -71,6 +71,7 @@ config: 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 + android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Name' email_label: 'Email' twoFactorAuthentication_label: 'Two factor authentication' + delete: + title: Delete my account (a.k.a danger zone) + description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + confirm: Are you really sure? (THIS CAN'T BE UNDONE) + button: Delete my account + reset: + title: Reset area (a.k.a danger zone) + description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + annotations: Remove ALL annotations + tags: Remove ALL tags + entries: Remove ALL entries + confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Current password' new_password_label: 'New password' @@ -355,6 +368,7 @@ import: how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Import > Firefox' description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -459,6 +473,9 @@ flashes: tagging_rules_updated: 'Tagging rules updated' tagging_rules_deleted: 'Tagging rule deleted' rss_token_updated: 'RSS token updated' + annotations_reset: Annotations reset + tags_reset: Tags reset + entries_reset: Entries reset entry: notice: entry_already_saved: 'Entry already saved on %date%' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 42ec8183..ca3db487 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -71,6 +71,7 @@ config: 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Nombre' email_label: 'Direccion e-mail' twoFactorAuthentication_label: 'Autentificación de dos factores' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Contraseña actual' new_password_label: 'Nueva contraseña' @@ -355,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Importar > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -458,8 +472,10 @@ flashes: rss_updated: 'La configuración de los feeds RSS ha sido actualizada' tagging_rules_updated: 'Regla de etiquetado borrada' tagging_rules_deleted: 'Regla de etiquetado actualizada' - user_added: 'Usuario "%username%" añadido' rss_token_updated: 'RSS token actualizado' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'Entrada ya guardada por %fecha%' @@ -489,3 +505,8 @@ flashes: notice: client_created: 'Nuevo cliente creado.' client_deleted: 'Cliente suprimido' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index f82167df..1914215a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -71,6 +71,7 @@ config: 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم' 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم' pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب + # android_configuration: Configure your Android application form_rss: description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.' token_label: 'کد آر-اس-اس' @@ -88,6 +89,18 @@ config: name_label: 'نام' email_label: 'نشانی ایمیل' twoFactorAuthentication_label: 'تأیید ۲مرحله‌ای' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'رمز قدیمی' new_password_label: 'رمز تازه' @@ -272,6 +285,7 @@ quickstart: paragraph_2: 'ادامه دهید!' configure: title: 'برنامه را تنظیم کنید' + # description: 'In order to have an application which suits you, have a look into the configuration of wallabag.' language: 'زبان و نمای برنامه را تغییر دهید' rss: 'خوراک آر-اس-اس را فعال کنید' tagging_rules: 'قانون‌های برچسب‌گذاری خودکار مقاله‌هایتان را تعریف کنید' @@ -354,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'درون‌ریزی > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -457,8 +472,10 @@ flashes: rss_updated: 'اطلاعات آر-اس-اس به‌روز شد' tagging_rules_updated: 'برچسب‌گذاری خودکار به‌روز شد' tagging_rules_deleted: 'قانون برچسب‌گذاری پاک شد' - user_added: 'کابر "%username%" افزوده شد' rss_token_updated: 'کد آر-اس-اس به‌روز شد' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'این مقاله در تاریخ %date% ذخیره شده بود' @@ -488,3 +505,8 @@ flashes: notice: # client_created: 'New client created.' # client_deleted: 'Client deleted' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 421cb8b5..60fa9a39 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -71,6 +71,7 @@ config: 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 + android_configuration: Configurez votre application Android 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" @@ -88,6 +89,18 @@ config: name_label: "Nom" email_label: "Adresse courriel" twoFactorAuthentication_label: "Double authentification" + delete: + title: Supprimer mon compte (attention danger !) + description: Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c'est IRRÉVERSIBLE). Vous serez ensuite déconnecté. + confirm: Vous êtes vraiment sûr ? (C'EST IRRÉVERSIBLE) + button: 'Supprimer mon compte' + reset: + title: Réinitialisation (attention danger !) + description: En cliquant sur les boutons ci-dessous vous avez la possibilité de supprimer certaines informations de votre compte. Attention, ces actions sont IRRÉVERSIBLES ! + annotations: Supprimer TOUTES les annotations + tags: Supprimer TOUS les tags + entries: Supprimer TOUS les articles + confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRRÉVERSIBLE) form_password: old_password_label: "Mot de passe actuel" new_password_label: "Nouveau mot de passe" @@ -355,6 +368,7 @@ import: how_to: "Choisissez le fichier de votre export Readability et cliquez sur le bouton ci-dessous pour l’importer." worker: enabled: "Les imports sont asynchrones. Une fois l’import commencé un worker externe traitera les messages un par un. Le service activé est :" + download_images_warning: "Vous avez configuré le téléchagement des images pour vos articles. Combiné à l'import classique, cette opération peut être très très longue (voire échouer). Nous vous conseillons vivement d'activer les imports asynchrones." firefox: page_title: "Import > Firefox" description: "Cet outil va vous permettre d’importer tous vos marques-pages de Firefox. Ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json.

" @@ -458,8 +472,10 @@ flashes: rss_updated: "La configuration des flux RSS a bien été mise à jour" tagging_rules_updated: "Règles mises à jour" tagging_rules_deleted: "Règle supprimée" - user_added: "Utilisateur \"%username%\" ajouté" rss_token_updated: "Jeton RSS mis à jour" + annotations_reset: Annotations supprimées + tags_reset: Tags supprimés + entries_reset: Articles supprimés entry: notice: entry_already_saved: "Article déjà sauvergardé le %date%" @@ -489,3 +505,8 @@ flashes: notice: client_created: "Nouveau client %name% créé" client_deleted: "Client %name% supprimé" + user: + notice: + added: 'Utilisateur "%username%" ajouté' + updated: 'Utilisateur "%username%" mis à jour' + deleted: 'Utilisateur "%username%" supprimé' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index d679ef00..7f401684 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -71,6 +71,7 @@ config: 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Nome' email_label: 'E-mail' twoFactorAuthentication_label: 'Two factor authentication' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Password corrente' new_password_label: 'Nuova password' @@ -355,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Importa da > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -458,8 +472,10 @@ flashes: rss_updated: 'Informazioni RSS aggiornate' tagging_rules_updated: 'Regole di tagging aggiornate' tagging_rules_deleted: 'Regola di tagging aggiornate' - user_added: 'Utente "%username%" aggiunto' rss_token_updated: 'RSS token aggiornato' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'Contenuto già salvato in data %date%' @@ -489,3 +505,8 @@ flashes: notice: client_created: 'Nuovo client creato.' client_deleted: 'Client eliminato' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index af0fba0d..c3282b0e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -25,13 +25,13 @@ menu: internal_settings: 'Configuracion interna' import: 'Importar' howto: 'Ajuda' - developer: 'Desvolopador' + developer: 'Desvolopaire' logout: 'Desconnexion' about: 'A prepaus' search: 'Cercar' save_link: 'Enregistrar un novèl article' back_to_unread: 'Tornar als articles pas legits' - # users_management: 'Users management' + users_management: 'Gestion dels utilizaires' top: add_new_entry: 'Enregistrar un novèl article' search: 'Cercar' @@ -46,7 +46,7 @@ footer: social: 'Social' powered_by: 'propulsat per' about: 'A prepaus' - # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! + stats: "Dempuèi %user_creation% avètz legit %nb_archives% articles. Es a l'entorn de %per_day% per jorn !" config: page_title: 'Configuracion' @@ -71,6 +71,7 @@ config: 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Nom' email_label: 'Adreça de corrièl' twoFactorAuthentication_label: 'Dobla autentificacion' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Senhal actual' new_password_label: 'Senhal novèl' @@ -96,7 +109,7 @@ config: if_label: 'se' then_tag_as_label: 'alara atribuir las etiquetas' delete_rule_label: 'suprimir' - # edit_rule_label: 'edit' + edit_rule_label: 'modificar' rule_label: 'Règla' tags_label: 'Etiquetas' faq: @@ -209,7 +222,7 @@ entry: is_public_label: 'Public' save_label: 'Enregistrar' public: - # shared_by_wallabag: "This article has been shared by wallabag" + shared_by_wallabag: "Aqueste article es estat partejat per wallabag" about: page_title: 'A prepaus' @@ -265,14 +278,14 @@ howto: quickstart: page_title: 'Per ben començar' - # more: 'More…' + more: 'Mai…' intro: title: 'Benvenguda sus wallabag !' paragraph_1: "Anem vos guidar per far lo torn de la proprietat e vos presentar unas fonccionalitats que vos poirián interessar per vos apropriar aquesta aisina." paragraph_2: 'Seguètz-nos ' configure: - title: "Configuratz l'aplicacio" - # description: 'In order to have an application which suits you, have a look into the configuration of wallabag.' + title: "Configuratz l'aplicacion" + description: "Per fin d'aver una aplicacion que vos va ben, anatz veire la configuracion de wallabag." language: "Cambiatz la lenga e l'estil de l'aplicacion" rss: 'Activatz los fluxes RSS' tagging_rules: 'Escrivètz de règlas per classar automaticament vòstres articles' @@ -286,7 +299,7 @@ quickstart: import: 'Configurar los impòrt' first_steps: title: 'Primièrs passes' - # description: "Now wallabag is well configured, it's time to archive the web. You can click on the top right sign + to add a link." + description: "Ara wallabag es ben configurat, es lo moment d'archivar lo web. Podètz clicar sul signe + a man drecha amont per ajustar un ligam." new_article: 'Ajustatz vòstre primièr article' unread_articles: 'E racaptatz-lo !' migrate: @@ -298,14 +311,14 @@ quickstart: readability: 'Migrar dempuèi Readability' instapaper: 'Migrar dempuèi Instapaper' developer: - title: 'Pels desvolopadors' - # description: 'We also thought to the developers: Docker, API, translations, etc.' + title: 'Pels desvolopaires' + description: 'Avèm tanben pensat als desvolopaires : Docker, API, traduccions, etc.' create_application: 'Crear vòstra aplicacion tèrça' - # use_docker: 'Use Docker to install wallabag' + use_docker: 'Utilizar Docker per installar wallabag' docs: title: 'Documentacion complèta' - # description: "There are so much features in wallabag. Don't hesitate to read the manual to know them and to learn how to use them." - annotate: 'Anotatar vòstre article' + description: "I a un fum de fonccionalitats dins wallabag. Esitetz pas a legir lo manual per las conéisser e aprendre a las utilizar." + annotate: 'Anotar vòstre article' export: 'Convertissètz vòstres articles en ePub o en PDF' search_filters: "Aprenètz a utilizar lo motor de recèrca e los filtres per retrobar l'article que vos interèssa" fetching_errors: "Qué far se mon article es pas recuperat coma cal ?" @@ -355,6 +368,7 @@ import: how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." worker: enabled: "L'importacion se fa de manièra asincròna. Un còp l'importacion lançada, una aisina externa s'ocuparà dels messatges un per un. Lo servici actual es : " + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Importar > Firefox' description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -390,7 +404,7 @@ developer: warn_message_2: "Se suprimissètz un client, totas las aplicacions que l'emplegan foncionaràn pas mai amb vòstre compte wallabag." action: 'Suprimir aqueste client' client: - page_title: 'Desvlopador > Novèl client' + page_title: 'Desvolopaire > Novèl client' page_description: "Anatz crear un novèl client. Mercés de cumplir l'url de redireccion cap a vòstra aplicacion." form: name_label: "Nom del client" @@ -398,7 +412,7 @@ developer: save_label: 'Crear un novèl client' action_back: 'Retorn' client_parameter: - page_title: 'Desvolopador > Los paramètres de vòstre client' + page_title: 'Desvolopaire > Los paramètres de vòstre client' page_description: 'Vaquí los paramètres de vòstre client' field_name: 'Nom del client' field_id: 'ID Client' @@ -406,7 +420,7 @@ developer: back: 'Retour' read_howto: 'Legir "cossí crear ma primièra aplicacion"' howto: - page_title: 'Desvolopador > Cossí crear ma primièra aplicacion' + page_title: 'Desvolopaire > Cossí crear ma primièra aplicacion' description: paragraph_1: "Las comandas seguentas utilizan la bibliotèca HTTPie. Asseguratz-vos que siasqueòu installadas abans de l'utilizar." paragraph_2: "Vos cal un geton per escambiar entre vòstra aplicacion e l'API de wallabar." @@ -419,31 +433,31 @@ developer: back: 'Retorn' user: - # page_title: Users management - # new_user: Create a new user - # edit_user: Edit an existing user - # description: "Here you can manage all users (create, edit and delete)" - # list: - # actions: Actions - # edit_action: Edit - # yes: Yes - # no: No - # create_new_one: Create a new user + page_title: 'Gestion dels utilizaires' + new_user: 'Crear un novèl utilizaire' + edit_user: 'Modificar un utilizaire existent' + description: "Aquí podètz gerir totes los utilizaires (crear, modificar e suprimir)" + list: + actions: 'Accions' + edit_action: 'Modificar' + yes: 'Òc' + no: 'Non' + create_new_one: 'Crear un novèl utilizaire' form: username_label: "Nom d'utilizaire" - # name_label: 'Name' + name_label: 'Nom' password_label: 'Senhal' repeat_new_password_label: 'Confirmatz vòstre novèl senhal' plain_password_label: 'Senhal en clar' email_label: 'Adreça de corrièl' - # enabled_label: 'Enabled' - # locked_label: 'Locked' - # last_login_label: 'Last login' - # twofactor_label: Two factor authentication - # save: Save - # delete: Delete - # delete_confirm: Are you sure? - # back_to_list: Back to list + enabled_label: 'Actiu' + locked_label: 'Varrolhat' + last_login_label: 'Darrièra connexion' + twofactor_label: 'Autentificacion doble-factor' + save: 'Enregistrar' + delete: 'Suprimir' + delete_confirm: 'Sètz segur ?' + back_to_list: 'Tornar a la lista' error: # page_title: An error occurred @@ -458,8 +472,10 @@ flashes: rss_updated: 'La configuracion dels fluxes RSS es ben estada mesa a jorn' tagging_rules_updated: 'Règlas misa a jorn' tagging_rules_deleted: 'Règla suprimida' - user_added: 'Utilizaire "%username%" apondut' rss_token_updated: 'Geton RSS mes a jorn' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'Article ja salvargardat lo %date%' @@ -470,12 +486,12 @@ flashes: entry_reloaded_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat" entry_archived: 'Article marcat coma legit' entry_unarchived: 'Article marcat coma pas legit' - entry_starred: 'Article apondut dins los favorits' + entry_starred: 'Article ajustat dins los favorits' entry_unstarred: 'Article quitat dels favorits' entry_deleted: 'Article suprimit' tag: notice: - tag_added: 'Etiqueta aponduda' + tag_added: 'Etiqueta ajustada' import: notice: failed: "L'importacion a fracassat, mercés de tornar ensajar" @@ -489,3 +505,8 @@ flashes: notice: client_created: 'Novèl client creat' client_deleted: 'Client suprimit' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index bf47b58a..87731faf 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -71,6 +71,7 @@ config: 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' + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Nazwa' email_label: 'Adres email' twoFactorAuthentication_label: 'Autoryzacja dwuetapowa' + delete: + title: Usuń moje konto (niebezpieczna strefa !) + description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany. + confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć) + button: Usuń moje konto + reset: + title: Reset (niebezpieczna strefa) + description: Poniższe przyciski pozwalają usunąć pewne informacje z twojego konta. Uważaj te operacje są NIEODWRACALNE. + annotations: Usuń WSZYSTKIE adnotacje + tags: Usuń WSZYSTKIE tagi + entries: usuń WSZYTSTKIE wpisy + confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć) form_password: old_password_label: 'Stare hasło' new_password_label: 'Nowe hasło' @@ -355,6 +368,7 @@ import: how_to: 'Wybierz swój plik eksportu z Readability i kliknij poniższy przycisk, aby go załadować.' worker: enabled: "Import jest wykonywany asynchronicznie. Od momentu rozpoczęcia importu, zewnętrzna usługa może zajmować się na raz tylko jednym zadaniem. Bieżącą usługą jest:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'Import > Firefox' description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. Idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json." @@ -446,7 +460,7 @@ user: back_to_list: Powrót do listy error: - # page_title: An error occurred + page_title: Wystąpił błąd flashes: config: @@ -458,8 +472,10 @@ flashes: rss_updated: 'Informacje RSS zaktualizowane' tagging_rules_updated: 'Reguły tagowania zaktualizowane' tagging_rules_deleted: 'Reguła tagowania usunięta' - user_added: 'Użytkownik "%username%" dodany' rss_token_updated: 'Token kanału RSS zaktualizowany' + annotations_reset: Zresetuj adnotacje + tags_reset: Zresetuj tagi + entries_reset: Zresetuj wpisy entry: notice: entry_already_saved: 'Wpis już został dodany %date%' @@ -489,3 +505,8 @@ flashes: notice: client_created: 'Nowy klient utworzony.' client_deleted: 'Klient usunięty' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index f10dc9aa..c1c60430 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -451,7 +451,6 @@ flashes: config_saved: 'Configiração salva. Alguns parâmetros podem ser considerados depois da desconexão.' password_updated: 'Senha atualizada' password_not_updated_demo: 'Em modo de demonstração, você não pode alterar a senha deste usuário.' - user_updated: 'Informação atualizada' rss_updated: 'Informação de RSS atualizada' tagging_rules_updated: 'Regras de tags atualizadas' tagging_rules_deleted: 'Regra de tag apagada' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 875c82e8..50f1b6a2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -71,6 +71,7 @@ config: # 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 + # android_configuration: Configure your Android application 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' @@ -88,6 +89,18 @@ config: name_label: 'Nume' email_label: 'E-mail' # twoFactorAuthentication_label: 'Two factor authentication' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Parola veche' new_password_label: 'Parola nouă' @@ -355,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." # firefox: # page_title: 'Import > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -458,8 +472,10 @@ flashes: rss_updated: 'Informație RSS actualizată' # tagging_rules_updated: 'Tagging rules updated' # tagging_rules_deleted: 'Tagging rule deleted' - # user_added: 'User "%username%" added' # rss_token_updated: 'RSS token updated' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: # entry_already_saved: 'Entry already saved on %date%' @@ -489,3 +505,8 @@ flashes: notice: # client_created: 'New client created.' # client_deleted: 'Client deleted' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index f50f629a..07939ebc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -71,6 +71,7 @@ config: # 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 + # android_configuration: Configure your Android application 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)' @@ -88,6 +89,18 @@ config: name_label: 'İsim' email_label: 'E-posta' twoFactorAuthentication_label: 'İki adımlı doğrulama' + delete: + # title: Delete my account (a.k.a danger zone) + # description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out. + # confirm: Are you really sure? (THIS CAN'T BE UNDONE) + # button: Delete my account + reset: + # title: Reset area (a.k.a danger zone) + # description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE. + # annotations: Remove ALL annotations + # tags: Remove ALL tags + # entries: Remove ALL entries + # confirm: Are you really really sure? (THIS CAN'T BE UNDONE) form_password: old_password_label: 'Eski şifre' new_password_label: 'Yeni şifre' @@ -96,6 +109,7 @@ config: # if_label: 'if' # then_tag_as_label: 'then tag as' # delete_rule_label: 'delete' + # edit_rule_label: 'edit' rule_label: 'Kural' tags_label: 'Etiketler' faq: @@ -354,6 +368,7 @@ import: # how_to: 'Please select your Readability export and click on the below button to upload and import it.' worker: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We strongly recommend to enable asynchronous import to avoid errors." firefox: page_title: 'İçe Aktar > Firefox' # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." @@ -457,8 +472,10 @@ flashes: rss_updated: 'RSS bilgiler güncellendi' tagging_rules_updated: 'Tagging rules updated' tagging_rules_deleted: 'Tagging rule deleted' - user_added: 'User "%username%" added' rss_token_updated: 'RSS token updated' + # annotations_reset: Annotations reset + # tags_reset: Tags reset + # entries_reset: Entries reset entry: notice: entry_already_saved: 'Entry already saved on %date%' @@ -488,3 +505,8 @@ flashes: notice: # client_created: 'New client created.' # client_deleted: 'Client deleted' + user: + notice: + # added: 'User "%username%" added' + # updated: 'User "%username%" updated' + # deleted: 'User "%username%" deleted' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index ff7ef73a..ec3b23c8 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig @@ -54,6 +54,16 @@ https://getpocket.com/developer/docs/authentication

+ +
+

{{ 'config.form_settings.android_configuration'|trans }}

+ Touch here to prefill your Android application + + +
{{ form_rest(form.config) }} @@ -146,10 +156,41 @@ {% endif %} +

{{ 'config.reset.title'|trans }}

+
+

{{ 'config.reset.description'|trans }}

+ +
+ {{ form_widget(form.user._token) }} {{ form_widget(form.user.save) }} + {% if enabled_users > 1 %} +

{{ 'config.form_user.delete.title'|trans }}

+ +

{{ 'config.form_user.delete.description'|trans }}

+ + {{ 'config.form_user.delete.button'|trans }} + + {% endif %} +

{{ 'config.tab_menu.password'|trans }}

{{ form_start(form.pwd) }} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index 19faddc0..f69d158f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig @@ -71,6 +71,18 @@ +
+
+
{{ 'config.form_settings.android_configuration'|trans }}
+ Touch here to prefill your Android application + +
+ +
+ {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} {{ form_rest(form.config) }} @@ -167,6 +179,34 @@ {{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} {{ form_widget(form.user._token) }} + +


+ +
+
{{ 'config.reset.title'|trans }}
+

{{ 'config.reset.description'|trans }}

+ + {{ 'config.reset.annotations'|trans }} + + + {{ 'config.reset.tags'|trans }} + + + {{ 'config.reset.entries'|trans }} + +
+ + {% if enabled_users > 1 %} +


+ +
+
{{ 'config.form_user.delete.title'|trans }}
+

{{ 'config.form_user.delete.description'|trans }}

+ +
+ {% endif %}
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index d1325338..13f3dcb9 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -14,10 +14,10 @@ class ImportCommand extends ContainerAwareCommand { $this ->setName('wallabag:import') - ->setDescription('Import entries from a JSON export from a wallabag v1 instance') + ->setDescription('Import entries from a JSON export') ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') - ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: wallabag v1, v2, firefox or chrome', 'v1') + ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, readability, firefox or chrome', 'v1') ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) ; } @@ -42,32 +42,38 @@ class ImportCommand extends ContainerAwareCommand switch ($input->getOption('importer')) { case 'v2': - $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); + $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); break; case 'firefox': - $wallabag = $this->getContainer()->get('wallabag_import.firefox.import'); + $import = $this->getContainer()->get('wallabag_import.firefox.import'); break; case 'chrome': - $wallabag = $this->getContainer()->get('wallabag_import.chrome.import'); + $import = $this->getContainer()->get('wallabag_import.chrome.import'); + break; + case 'readability': + $import = $this->getContainer()->get('wallabag_import.readability.import'); + break; + case 'instapaper': + $import = $this->getContainer()->get('wallabag_import.instapaper.import'); break; case 'instapaper': $wallabag = $this->getContainer()->get('wallabag_import.instapaper.import'); break; case 'v1': default: - $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); + $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); break; } - $wallabag->setMarkAsRead($input->getOption('markAsRead')); - $wallabag->setUser($user); + $import->setMarkAsRead($input->getOption('markAsRead')); + $import->setUser($user); - $res = $wallabag + $res = $import ->setFilepath($input->getArgument('filepath')) ->import(); if (true === $res) { - $summary = $wallabag->getSummary(); + $summary = $import->getSummary(); $output->writeln(''.$summary['imported'].' imported'); $output->writeln(''.$summary['skipped'].' already saved'); } diff --git a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php index b893ea29..aa7ff914 100644 --- a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php +++ b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php @@ -9,6 +9,8 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Wallabag\CoreBundle\Event\EntrySavedEvent; abstract class AbstractConsumer { @@ -17,11 +19,12 @@ abstract class AbstractConsumer protected $import; protected $logger; - public function __construct(EntityManager $em, UserRepository $userRepository, AbstractImport $import, LoggerInterface $logger = null) + public function __construct(EntityManager $em, UserRepository $userRepository, AbstractImport $import, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) { $this->em = $em; $this->userRepository = $userRepository; $this->import = $import; + $this->eventDispatcher = $eventDispatcher; $this->logger = $logger ?: new NullLogger(); } @@ -59,6 +62,9 @@ abstract class AbstractConsumer try { $this->em->flush(); + // entry saved, dispatch event about it! + $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + // clear only affected entities $this->em->clear(Entry::class); $this->em->clear(Tag::class); diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index 764b390a..1d4a6e27 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -10,12 +10,15 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\UserBundle\Entity\User; use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Wallabag\CoreBundle\Event\EntrySavedEvent; abstract class AbstractImport implements ImportInterface { protected $em; protected $logger; protected $contentProxy; + protected $eventDispatcher; protected $producer; protected $user; protected $markAsRead; @@ -23,11 +26,12 @@ abstract class AbstractImport implements ImportInterface protected $importedEntries = 0; protected $queuedEntries = 0; - public function __construct(EntityManager $em, ContentProxy $contentProxy) + public function __construct(EntityManager $em, ContentProxy $contentProxy, EventDispatcherInterface $eventDispatcher) { $this->em = $em; $this->logger = new NullLogger(); $this->contentProxy = $contentProxy; + $this->eventDispatcher = $eventDispatcher; } public function setLogger(LoggerInterface $logger) @@ -104,6 +108,7 @@ abstract class AbstractImport implements ImportInterface protected function parseEntries($entries) { $i = 1; + $entryToBeFlushed = []; foreach ($entries as $importedEntry) { if ($this->markAsRead) { @@ -116,10 +121,21 @@ abstract class AbstractImport implements ImportInterface continue; } + // store each entry to be flushed so we can trigger the entry.saved event for each of them + // entry.saved needs the entry to be persisted in db because it needs it id to generate + // images (at least) + $entryToBeFlushed[] = $entry; + // flush every 20 entries if (($i % 20) === 0) { $this->em->flush(); + foreach ($entryToBeFlushed as $entry) { + $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + } + + $entryToBeFlushed = []; + // clear only affected entities $this->em->clear(Entry::class); $this->em->clear(Tag::class); @@ -128,6 +144,12 @@ abstract class AbstractImport implements ImportInterface } $this->em->flush(); + + if (!empty($entryToBeFlushed)) { + foreach ($entryToBeFlushed as $entry) { + $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + } + } } /** diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 2ca1683b..8bf7d92e 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -5,6 +5,7 @@ namespace Wallabag\ImportBundle\Import; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\UserBundle\Entity\User; use Wallabag\CoreBundle\Helper\ContentProxy; +use Wallabag\CoreBundle\Event\EntrySavedEvent; abstract class BrowserImport extends AbstractImport { @@ -81,6 +82,7 @@ abstract class BrowserImport extends AbstractImport protected function parseEntries($entries) { $i = 1; + $entryToBeFlushed = []; foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { @@ -93,14 +95,29 @@ abstract class BrowserImport extends AbstractImport continue; } + // @see AbstractImport + $entryToBeFlushed[] = $entry; + // flush every 20 entries if (($i % 20) === 0) { $this->em->flush(); + + foreach ($entryToBeFlushed as $entry) { + $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + } + + $entryToBeFlushed = []; } ++$i; } $this->em->flush(); + + if (!empty($entryToBeFlushed)) { + foreach ($entryToBeFlushed as $entry) { + $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); + } + } } /** diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 327e2500..33093480 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -2,8 +2,6 @@ namespace Wallabag\ImportBundle\Import; -use Psr\Log\NullLogger; -use Doctrine\ORM\EntityManager; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use Wallabag\CoreBundle\Entity\Entry; @@ -16,13 +14,6 @@ class PocketImport extends AbstractImport const NB_ELEMENTS = 5000; - public function __construct(EntityManager $em, ContentProxy $contentProxy) - { - $this->em = $em; - $this->contentProxy = $contentProxy; - $this->logger = new NullLogger(); - } - /** * Only used for test purpose. * diff --git a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml index 70b8a0d4..a5af5282 100644 --- a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml +++ b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml @@ -6,6 +6,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.pocket.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.readability: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -13,6 +14,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.readability.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.instapaper: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -20,6 +22,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.instapaper.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.wallabag_v1: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -27,6 +30,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.wallabag_v1.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.wallabag_v2: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -34,6 +38,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.wallabag_v2.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.firefox: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -41,6 +46,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.firefox.import" + - "@event_dispatcher" - "@logger" wallabag_import.consumer.amqp.chrome: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer @@ -48,4 +54,5 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.chrome.import" + - "@event_dispatcher" - "@logger" diff --git a/src/Wallabag/ImportBundle/Resources/config/redis.yml b/src/Wallabag/ImportBundle/Resources/config/redis.yml index 0a81e1b5..5ced4c83 100644 --- a/src/Wallabag/ImportBundle/Resources/config/redis.yml +++ b/src/Wallabag/ImportBundle/Resources/config/redis.yml @@ -18,6 +18,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.readability.import" + - "@event_dispatcher" - "@logger" # instapaper @@ -38,6 +39,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.instapaper.import" + - "@event_dispatcher" - "@logger" # pocket @@ -58,6 +60,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.pocket.import" + - "@event_dispatcher" - "@logger" # wallabag v1 @@ -78,6 +81,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.wallabag_v1.import" + - "@event_dispatcher" - "@logger" # wallabag v2 @@ -98,6 +102,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.wallabag_v2.import" + - "@event_dispatcher" - "@logger" # firefox @@ -118,6 +123,7 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.firefox.import" + - "@event_dispatcher" - "@logger" # chrome @@ -138,4 +144,5 @@ services: - "@doctrine.orm.entity_manager" - "@wallabag_user.user_repository" - "@wallabag_import.chrome.import" + - "@event_dispatcher" - "@logger" diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index d600be0f..64822963 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml @@ -20,6 +20,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setClient, [ "@wallabag_import.pocket.client" ] ] - [ setLogger, [ "@logger" ]] @@ -31,6 +32,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: @@ -41,6 +43,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: @@ -51,6 +54,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: @@ -61,6 +65,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: @@ -71,6 +76,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: @@ -80,6 +86,7 @@ services: arguments: - "@doctrine.orm.entity_manager" - "@wallabag_core.content_proxy" + - "@event_dispatcher" calls: - [ setLogger, [ "@logger" ]] tags: diff --git a/src/Wallabag/ImportBundle/Resources/views/Chrome/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Chrome/index.html.twig index ead828c6..93b08540 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Chrome/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Chrome/index.html.twig @@ -6,6 +6,8 @@
+ {% include 'WallabagImportBundle:Import:_information.html.twig' %} +
{{ import.description|trans|raw }}

{{ 'import.chrome.how_to'|trans }}

diff --git a/src/Wallabag/ImportBundle/Resources/views/Firefox/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Firefox/index.html.twig index f975da3f..ced3f008 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Firefox/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Firefox/index.html.twig @@ -6,6 +6,8 @@
+ {% include 'WallabagImportBundle:Import:_information.html.twig' %} +
{{ import.description|trans|raw }}

{{ 'import.firefox.how_to'|trans }}

diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/_information.html.twig similarity index 55% rename from src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig rename to src/Wallabag/ImportBundle/Resources/views/Import/_information.html.twig index 2390a41f..48bbcfe7 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/_information.html.twig @@ -1,8 +1,15 @@ {% set redis = craue_setting('import_with_redis') %} {% set rabbit = craue_setting('import_with_rabbitmq') %} +{% set downloadImages = craue_setting('download_images_enabled') %} {% if redis or rabbit %}
{{ 'import.worker.enabled'|trans }} {% if rabbit %}RabbitMQ{% elseif redis %}Redis{% endif %}
{% endif %} + +{% if not redis and not rabbit and downloadImages %} +
+ {{ 'import.worker.download_images_warning'|trans|raw }} +
+{% endif %} diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index 6ea5e0f4..b1ec40a6 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig @@ -6,6 +6,8 @@
+ {% include 'WallabagImportBundle:Import:_information.html.twig' %} + {{ 'import.page_description'|trans }}
    {% for import in imports %} diff --git a/src/Wallabag/ImportBundle/Resources/views/Instapaper/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Instapaper/index.html.twig index 5789361f..28165d19 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Instapaper/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Instapaper/index.html.twig @@ -6,7 +6,7 @@
    - {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} + {% include 'WallabagImportBundle:Import:_information.html.twig' %}
    {{ import.description|trans }}
    diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 6195fa07..536e3d1a 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig @@ -6,7 +6,7 @@
    - {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} + {% include 'WallabagImportBundle:Import:_information.html.twig' %} {% if not has_consumer_key %}
    diff --git a/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig index 74653b0f..737b0adf 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig @@ -6,7 +6,7 @@
    - {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} + {% include 'WallabagImportBundle:Import:_information.html.twig' %}
    {{ import.description|trans }}
    diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig index 0b19bc34..974b2c73 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig @@ -6,7 +6,7 @@
    - {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} + {% include 'WallabagImportBundle:Import:_information.html.twig' %}
    {{ import.description|trans }}
    diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index d98ae76a..3a167de7 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php @@ -11,6 +11,7 @@ use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\Annotation\Expose; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\UserInterface; +use Wallabag\ApiBundle\Entity\Client; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Entry; @@ -84,6 +85,11 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf */ private $trusted; + /** + * @ORM\OneToMany(targetEntity="Wallabag\ApiBundle\Entity\Client", mappedBy="user", cascade={"remove"}) + */ + protected $clients; + public function __construct() { parent::__construct(); @@ -240,4 +246,24 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf return false; } + + /** + * @param Client $client + * + * @return User + */ + public function addClient(Client $client) + { + $this->clients[] = $client; + + return $this; + } + + /** + * @return ArrayCollection + */ + public function getClients() + { + return $this->clients; + } } diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php index 009c4881..445edb3c 100644 --- a/src/Wallabag/UserBundle/Repository/UserRepository.php +++ b/src/Wallabag/UserBundle/Repository/UserRepository.php @@ -38,4 +38,18 @@ class UserRepository extends EntityRepository ->getQuery() ->getSingleResult(); } + + /** + * Count how many users are enabled. + * + * @return int + */ + public function getSumEnabledUsers() + { + return $this->createQueryBuilder('u') + ->select('count(u)') + ->andWhere('u.expired = false') + ->getQuery() + ->getSingleScalarResult(); + } } diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index a8ee721b..164a25ec 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -22,7 +22,7 @@ services: arguments: - WallabagUserBundle:User - wallabag_user.create_config: + wallabag_user.listener.create_config: class: Wallabag\UserBundle\EventListener\CreateConfigListener arguments: - "@doctrine.orm.entity_manager" diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 70849f74..81f9e9ec 100644 --- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php @@ -3,35 +3,80 @@ namespace Tests\AnnotationBundle\Controller; use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase; +use Wallabag\AnnotationBundle\Entity\Annotation; +use Wallabag\CoreBundle\Entity\Entry; class AnnotationControllerTest extends WallabagAnnotationTestCase { - public function testGetAnnotations() + /** + * This data provider allow to tests annotation from the : + * - API POV (when user use the api to manage annotations) + * - and User POV (when user use the web interface - using javascript - to manage annotations). + */ + public function dataForEachAnnotations() { - $annotation = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagAnnotationBundle:Annotation') - ->findOneByUsername('admin'); + return [ + ['/api/annotations'], + ['annotations'], + ]; + } + + /** + * Test fetching annotations for an entry. + * + * @dataProvider dataForEachAnnotations + */ + public function testGetAnnotations($prefixUrl) + { + $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); + + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUserName('admin'); + $entry = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUsernameAndNotArchived('admin'); - if (!$annotation) { - $this->markTestSkipped('No content found in db.'); + $annotation = new Annotation($user); + $annotation->setEntry($entry); + $annotation->setText('This is my annotation /o/'); + $annotation->setQuote('content'); + + $em->persist($annotation); + $em->flush(); + + if ('annotations' === $prefixUrl) { + $this->logInAs('admin'); } - $this->logInAs('admin'); - $crawler = $this->client->request('GET', 'annotations/'.$annotation->getEntry()->getId().'.json'); + $this->client->request('GET', $prefixUrl.'/'.$entry->getId().'.json'); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals(1, $content['total']); + $this->assertGreaterThanOrEqual(1, $content['total']); $this->assertEquals($annotation->getText(), $content['rows'][0]['text']); + + // we need to re-fetch the annotation becase after the flush, it has been "detached" from the entity manager + $annotation = $em->getRepository('WallabagAnnotationBundle:Annotation')->findAnnotationById($annotation->getId()); + $em->remove($annotation); + $em->flush(); } - public function testSetAnnotation() + /** + * Test creating an annotation for an entry. + * + * @dataProvider dataForEachAnnotations + */ + public function testSetAnnotation($prefixUrl) { - $this->logInAs('admin'); + $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); - $entry = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') + if ('annotations' === $prefixUrl) { + $this->logInAs('admin'); + } + + /** @var Entry $entry */ + $entry = $em ->getRepository('WallabagCoreBundle:Entry') ->findOneByUsernameAndNotArchived('admin'); @@ -41,7 +86,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase 'quote' => 'my quote', 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31], ]); - $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', [], [], $headers, $content); + $this->client->request('POST', $prefixUrl.'/'.$entry->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); @@ -52,6 +97,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->assertEquals('my annotation', $content['text']); $this->assertEquals('my quote', $content['quote']); + /** @var Annotation $annotation */ $annotation = $this->client->getContainer() ->get('doctrine.orm.entity_manager') ->getRepository('WallabagAnnotationBundle:Annotation') @@ -60,20 +106,35 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->assertEquals('my annotation', $annotation->getText()); } - public function testEditAnnotation() + /** + * Test editing an existing annotation. + * + * @dataProvider dataForEachAnnotations + */ + public function testEditAnnotation($prefixUrl) { - $annotation = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagAnnotationBundle:Annotation') - ->findOneByUsername('admin'); + $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); - $this->logInAs('admin'); + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUserName('admin'); + $entry = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUsernameAndNotArchived('admin'); + + $annotation = new Annotation($user); + $annotation->setEntry($entry); + $annotation->setText('This is my annotation /o/'); + $annotation->setQuote('my quote'); + + $em->persist($annotation); + $em->flush(); $headers = ['CONTENT_TYPE' => 'application/json']; $content = json_encode([ 'text' => 'a modified annotation', ]); - $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); + $this->client->request('PUT', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); @@ -83,35 +144,56 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase $this->assertEquals('a modified annotation', $content['text']); $this->assertEquals('my quote', $content['quote']); - $annotationUpdated = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') + /** @var Annotation $annotationUpdated */ + $annotationUpdated = $em ->getRepository('WallabagAnnotationBundle:Annotation') ->findOneById($annotation->getId()); $this->assertEquals('a modified annotation', $annotationUpdated->getText()); + + $em->remove($annotationUpdated); + $em->flush(); } - public function testDeleteAnnotation() + /** + * Test deleting an annotation. + * + * @dataProvider dataForEachAnnotations + */ + public function testDeleteAnnotation($prefixUrl) { - $annotation = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') - ->getRepository('WallabagAnnotationBundle:Annotation') - ->findOneByUsername('admin'); + $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); - $this->logInAs('admin'); + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUserName('admin'); + $entry = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUsernameAndNotArchived('admin'); + + $annotation = new Annotation($user); + $annotation->setEntry($entry); + $annotation->setText('This is my annotation /o/'); + $annotation->setQuote('my quote'); + + $em->persist($annotation); + $em->flush(); + + if ('annotations' === $prefixUrl) { + $this->logInAs('admin'); + } $headers = ['CONTENT_TYPE' => 'application/json']; $content = json_encode([ 'text' => 'a modified annotation', ]); - $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content); + $this->client->request('DELETE', $prefixUrl.'/'.$annotation->getId().'.json', [], [], $headers, $content); $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertEquals('a modified annotation', $content['text']); + $this->assertEquals('This is my annotation /o/', $content['text']); - $annotationDeleted = $this->client->getContainer() - ->get('doctrine.orm.entity_manager') + $annotationDeleted = $em ->getRepository('WallabagAnnotationBundle:Annotation') ->findOneById($annotation->getId()); diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php index 82790a5c..ef3f1324 100644 --- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php +++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php @@ -8,7 +8,7 @@ use Symfony\Component\BrowserKit\Cookie; abstract class WallabagAnnotationTestCase extends WebTestCase { /** - * @var Client + * @var \Symfony\Bundle\FrameworkBundle\Client */ protected $client = null; @@ -35,7 +35,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase } /** - * @return Client + * @return \Symfony\Bundle\FrameworkBundle\Client */ protected function createAuthorizedClient() { @@ -49,7 +49,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase $firewallName = $container->getParameter('fos_user.firewall_name'); $this->user = $userManager->findUserBy(['username' => 'admin']); - $loginManager->loginUser($firewallName, $this->user); + $loginManager->logInUser($firewallName, $this->user); // save the login token into the session and put it in a cookie $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index 95befa9c..6659443b 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -82,11 +82,24 @@ class DeveloperControllerTest extends WallabagCoreTestCase public function testRemoveClient() { - $this->logInAs('admin'); $client = $this->getClient(); $em = $client->getContainer()->get('doctrine.orm.entity_manager'); - $nbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + // Try to remove an admin's client with a wrong user + $this->logInAs('bob'); + $client->request('GET', '/developer'); + $this->assertContains('no_client', $client->getResponse()->getContent()); + + // get an ID of a admin's client + $this->logInAs('admin'); + $nbClients = $em->getRepository('WallabagApiBundle:Client')->findByUser($this->getLoggedInUserId()); + + $this->logInAs('bob'); + $client->request('GET', '/developer/client/delete/'.$nbClients[0]->getId()); + $this->assertEquals(403, $client->getResponse()->getStatusCode()); + + // Try to remove the admin's client with the good user + $this->logInAs('admin'); $crawler = $client->request('GET', '/developer'); $link = $crawler @@ -98,7 +111,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $client->click($link); $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); + $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findByUser($this->getLoggedInUserId()); $this->assertGreaterThan(count($newNbClients), count($nbClients)); } } diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 825f8f7a..566e9493 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -30,12 +30,55 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertEquals($entry->getUserEmail(), $content['user_email']); $this->assertEquals($entry->getUserId(), $content['user_id']); - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); + } + + public function testExportEntry() + { + $entry = $this->client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneBy(['user' => 1, 'isArchived' => false]); + + if (!$entry) { + $this->markTestSkipped('No content found in db.'); + } + + $this->client->request('GET', '/api/entries/'.$entry->getId().'/export.epub'); + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + // epub format got the content type in the content + $this->assertContains('application/epub', $this->client->getResponse()->getContent()); + $this->assertEquals('application/epub+zip', $this->client->getResponse()->headers->get('Content-Type')); + + // re-auth client for mobi + $client = $this->createAuthorizedClient(); + $client->request('GET', '/api/entries/'.$entry->getId().'/export.mobi'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertEquals('application/x-mobipocket-ebook', $client->getResponse()->headers->get('Content-Type')); + + // re-auth client for pdf + $client = $this->createAuthorizedClient(); + $client->request('GET', '/api/entries/'.$entry->getId().'/export.pdf'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertContains('PDF-', $client->getResponse()->getContent()); + $this->assertEquals('application/pdf', $client->getResponse()->headers->get('Content-Type')); + + // re-auth client for pdf + $client = $this->createAuthorizedClient(); + $client->request('GET', '/api/entries/'.$entry->getId().'/export.txt'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertContains('text/plain', $client->getResponse()->headers->get('Content-Type')); + + // re-auth client for pdf + $client = $this->createAuthorizedClient(); + $client->request('GET', '/api/entries/'.$entry->getId().'/export.csv'); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $this->assertContains('application/csv', $client->getResponse()->headers->get('Content-Type')); } public function testGetOneEntryWrongUser() @@ -68,12 +111,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertEquals(1, $content['page']); $this->assertGreaterThanOrEqual(1, $content['pages']); - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetEntriesWithFullOptions() @@ -115,12 +153,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('since=1443274283', $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetStarredEntries() @@ -148,12 +181,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('sort=updated', $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetArchiveEntries() @@ -180,12 +208,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('archive=1', $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetTaggedEntries() @@ -212,12 +235,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('tags='.urlencode('foo,bar'), $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetDatedEntries() @@ -244,12 +262,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('since=1443274283', $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testGetDatedSupEntries() @@ -277,12 +290,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertContains('since='.($future->getTimestamp() + 1000), $content['_links'][$link]['href']); } - $this->assertTrue( - $this->client->getResponse()->headers->contains( - 'Content-Type', - 'application/json' - ) - ); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); } public function testDeleteEntry() diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 1954c654..8d0644d1 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -3,6 +3,11 @@ namespace Tests\Wallabag\CoreBundle\Controller; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; +use Wallabag\CoreBundle\Entity\Config; +use Wallabag\UserBundle\Entity\User; +use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\AnnotationBundle\Entity\Annotation; class ConfigControllerTest extends WallabagCoreTestCase { @@ -570,4 +575,264 @@ class ConfigControllerTest extends WallabagCoreTestCase $config->set('demo_mode_enabled', 0); $config->set('demo_mode_username', 'wallabag'); } + + public function testDeleteUserButtonVisibility() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/config'); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('config.form_user.delete.button', $body[0]); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUsername('empty'); + $user->setExpired(1); + $em->persist($user); + + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUsername('bob'); + $user->setExpired(1); + $em->persist($user); + + $em->flush(); + + $crawler = $client->request('GET', '/config'); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertNotContains('config.form_user.delete.button', $body[0]); + + $client->request('GET', '/account/delete'); + $this->assertEquals(403, $client->getResponse()->getStatusCode()); + + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUsername('empty'); + $user->setExpired(0); + $em->persist($user); + + $user = $em + ->getRepository('WallabagUserBundle:User') + ->findOneByUsername('bob'); + $user->setExpired(0); + $em->persist($user); + + $em->flush(); + } + + public function testDeleteAccount() + { + $client = $this->getClient(); + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + + $user = new User(); + $user->setName('Wallace'); + $user->setEmail('wallace@wallabag.org'); + $user->setUsername('wallace'); + $user->setPlainPassword('wallace'); + $user->setEnabled(true); + $user->addRole('ROLE_SUPER_ADMIN'); + + $em->persist($user); + + $config = new Config($user); + + $config->setTheme('material'); + $config->setItemsPerPage(30); + $config->setReadingSpeed(1); + $config->setLanguage('en'); + $config->setPocketConsumerKey('xxxxx'); + + $em->persist($config); + $em->flush(); + + $this->logInAs('wallace'); + $loggedInUserId = $this->getLoggedInUserId(); + + // create entry to check after user deletion + // that this entry is also deleted + $crawler = $client->request('GET', '/new'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('form[name=entry]')->form(); + $data = [ + 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', + ]; + + $client->submit($form, $data); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->request('GET', '/config'); + + $deleteLink = $crawler->filter('.delete-account')->last()->link(); + + $client->click($deleteLink); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $user = $em + ->getRepository('WallabagUserBundle:User') + ->createQueryBuilder('u') + ->where('u.username = :username')->setParameter('username', 'wallace') + ->getQuery() + ->getOneOrNullResult() + ; + + $this->assertNull($user); + + $entries = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUser($loggedInUserId); + + $this->assertEmpty($entries); + } + + public function testReset() + { + $this->logInAs('empty'); + $client = $this->getClient(); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + + $user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser(); + + $tag = new Tag(); + $tag->setLabel('super'); + $em->persist($tag); + + $entry = new Entry($user); + $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); + $entry->setContent('Youhou'); + $entry->setTitle('Youhou'); + $entry->addTag($tag); + $em->persist($entry); + + $entry2 = new Entry($user); + $entry2->setUrl('http://www.lemonde.de/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); + $entry2->setContent('Youhou'); + $entry2->setTitle('Youhou'); + $entry2->addTag($tag); + $em->persist($entry2); + + $annotation = new Annotation($user); + $annotation->setText('annotated'); + $annotation->setQuote('annotated'); + $annotation->setRanges([]); + $annotation->setEntry($entry); + $em->persist($annotation); + + $em->flush(); + + // reset annotations + $crawler = $client->request('GET', '/config#set3'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $crawler = $client->click($crawler->selectLink('config.reset.annotations')->link()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('flashes.config.notice.annotations_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + + $annotationsReset = $em + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findAnnotationsByPageId($entry->getId(), $user->getId()); + + $this->assertEmpty($annotationsReset, 'Annotations were reset'); + + // reset tags + $crawler = $client->request('GET', '/config#set3'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $crawler = $client->click($crawler->selectLink('config.reset.tags')->link()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('flashes.config.notice.tags_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + + $tagReset = $em + ->getRepository('WallabagCoreBundle:Tag') + ->countAllTags($user->getId()); + + $this->assertEquals(0, $tagReset, 'Tags were reset'); + + // reset entries + $crawler = $client->request('GET', '/config#set3'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + + $entryReset = $em + ->getRepository('WallabagCoreBundle:Entry') + ->countAllEntriesByUsername($user->getId()); + + $this->assertEquals(0, $entryReset, 'Entries were reset'); + } + + public function testResetEntriesCascade() + { + $this->logInAs('empty'); + $client = $this->getClient(); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + + $user = static::$kernel->getContainer()->get('security.token_storage')->getToken()->getUser(); + + $tag = new Tag(); + $tag->setLabel('super'); + $em->persist($tag); + + $entry = new Entry($user); + $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); + $entry->setContent('Youhou'); + $entry->setTitle('Youhou'); + $entry->addTag($tag); + $em->persist($entry); + + $annotation = new Annotation($user); + $annotation->setText('annotated'); + $annotation->setQuote('annotated'); + $annotation->setRanges([]); + $annotation->setEntry($entry); + $em->persist($annotation); + + $em->flush(); + + $crawler = $client->request('GET', '/config#set3'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $crawler = $client->click($crawler->selectLink('config.reset.entries')->link()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('flashes.config.notice.entries_reset', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + + $entryReset = $em + ->getRepository('WallabagCoreBundle:Entry') + ->countAllEntriesByUsername($user->getId()); + + $this->assertEquals(0, $entryReset, 'Entries were reset'); + + $tagReset = $em + ->getRepository('WallabagCoreBundle:Tag') + ->countAllTags($user->getId()); + + $this->assertEquals(0, $tagReset, 'Tags were reset'); + + $annotationsReset = $em + ->getRepository('WallabagAnnotationBundle:Annotation') + ->findAnnotationsByPageId($entry->getId(), $user->getId()); + + $this->assertEmpty($annotationsReset, 'Annotations were reset'); + } } diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 05113650..4ab06dbf 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -836,4 +836,64 @@ class EntryControllerTest extends WallabagCoreTestCase $client->request('GET', '/share/'.$content->getUuid()); $this->assertEquals(404, $client->getResponse()->getStatusCode()); } + + public function testNewEntryWithDownloadImagesEnabled() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; + $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); + + $crawler = $client->request('GET', '/new'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('form[name=entry]')->form(); + + $data = [ + 'entry[url]' => $url, + ]; + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $em = $client->getContainer() + ->get('doctrine.orm.entity_manager'); + + $entry = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId($url, $this->getLoggedInUserId()); + + $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); + $this->assertEquals($url, $entry->getUrl()); + $this->assertContains('Perpignan', $entry->getTitle()); + $this->assertContains('/d9bc0fcd.jpeg', $entry->getContent()); + + $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); + } + + /** + * @depends testNewEntryWithDownloadImagesEnabled + */ + public function testRemoveEntryWithDownloadImagesEnabled() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; + $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId($url, $this->getLoggedInUserId()); + + $client->request('GET', '/delete/'.$content->getId()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); + } } diff --git a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php similarity index 96% rename from tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php rename to tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php index 078bb69a..84a54d3a 100644 --- a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php @@ -1,6 +1,6 @@ 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + + $res = $download->processHtml(123, '
    ', 'http://imgur.com/gallery/WxtWY'); + + $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/c638b4c2.png', $res); + } + + public function testProcessHtmlWithBadImage() + { + $client = new Client(); + + $mock = new Mock([ + new Response(200, ['content-type' => 'application/json'], Stream::factory('')), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $res = $download->processHtml(123, '
    ', 'http://imgur.com/gallery/WxtWY'); + + $this->assertContains('http://i.imgur.com/T9qgcHc.jpg', $res, 'Image were not replace because of content-type'); + } + + public function singleImage() + { + return [ + ['image/pjpeg', 'jpeg'], + ['image/jpeg', 'jpeg'], + ['image/png', 'png'], + ['image/gif', 'gif'], + ]; + } + + /** + * @dataProvider singleImage + */ + public function testProcessSingleImage($header, $extension) + { + $client = new Client(); + + $mock = new Mock([ + new Response(200, ['content-type' => $header], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); + + $this->assertContains('/assets/images/9/b/9b0ead26/ebe60399.'.$extension, $res); + } + + public function testProcessSingleImageWithBadUrl() + { + $client = new Client(); + + $mock = new Mock([ + new Response(404, []), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $res = $download->processSingleImage(123, 'T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); + + $this->assertFalse($res, 'Image can not be found, so it will not be replaced'); + } + + public function testProcessSingleImageWithBadImage() + { + $client = new Client(); + + $mock = new Mock([ + new Response(200, ['content-type' => 'image/png'], Stream::factory('')), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $res = $download->processSingleImage(123, 'http://i.imgur.com/T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); + + $this->assertFalse($res, 'Image can not be loaded, so it will not be replaced'); + } + + public function testProcessSingleImageFailAbsolute() + { + $client = new Client(); + + $mock = new Mock([ + new Response(200, ['content-type' => 'image/png'], Stream::factory(file_get_contents(__DIR__.'/../fixtures/unnamed.png'))), + ]); + + $client->getEmitter()->attach($mock); + + $logHandler = new TestHandler(); + $logger = new Logger('test', array($logHandler)); + + $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', 'http://wallabag.io/', $logger); + $res = $download->processSingleImage(123, '/i.imgur.com/T9qgcHc.jpg', 'imgur.com/gallery/WxtWY'); + + $this->assertFalse($res, 'Absolute image can not be determined, so it will not be replaced'); + } +} diff --git a/tests/Wallabag/CoreBundle/fixtures/unnamed.png b/tests/Wallabag/CoreBundle/fixtures/unnamed.png new file mode 100644 index 00000000..e6dd9caa Binary files /dev/null and b/tests/Wallabag/CoreBundle/fixtures/unnamed.png differ diff --git a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php index a3263771..856954a6 100644 --- a/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/AMQPEntryConsumerTest.php @@ -112,10 +112,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn($entry); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->once()) + ->method('dispatch'); + $consumer = new AMQPEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $message = new AMQPMessage($body); @@ -157,10 +166,19 @@ JSON; ->disableOriginalConstructor() ->getMock(); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new AMQPEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $message = new AMQPMessage($body); @@ -212,10 +230,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn(null); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new AMQPEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $message = new AMQPMessage($body); diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php index 01a92ad2..3b92f759 100644 --- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php +++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php @@ -111,10 +111,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn($entry); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->once()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body); @@ -156,10 +165,19 @@ JSON; ->disableOriginalConstructor() ->getMock(); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body); @@ -211,10 +229,19 @@ JSON; ->with(json_decode($body, true)) ->willReturn(null); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->never()) + ->method('dispatch'); + $consumer = new RedisEntryConsumer( $em, $userRepository, - $import + $import, + $dispatcher ); $res = $consumer->manage($body); diff --git a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php index 1e52615c..6b3adda4 100644 --- a/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ChromeImportTest.php @@ -18,7 +18,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getChromeImport($unsetUser = false) + private function getChromeImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new ChromeImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new ChromeImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $chromeImport = $this->getChromeImport(); + $chromeImport = $this->getChromeImport(false, 1); $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class ChromeImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $chromeImport = $this->getChromeImport(); + $chromeImport = $this->getChromeImport(false, 1); $chromeImport->setFilepath(__DIR__.'/../fixtures/chrome-bookmarks'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php index 007dda6a..b516fbc5 100644 --- a/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/FirefoxImportTest.php @@ -18,7 +18,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getFirefoxImport($unsetUser = false) + private function getFirefoxImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new FirefoxImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new FirefoxImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $firefoxImport = $this->getFirefoxImport(); + $firefoxImport = $this->getFirefoxImport(false, 2); $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class FirefoxImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $firefoxImport = $this->getFirefoxImport(); + $firefoxImport = $this->getFirefoxImport(false, 1); $firefoxImport->setFilepath(__DIR__.'/../fixtures/firefox-bookmarks.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php index 75900bd7..e262a808 100644 --- a/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/InstapaperImportTest.php @@ -18,7 +18,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getInstapaperImport($unsetUser = false) + private function getInstapaperImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $import = new InstapaperImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $import = new InstapaperImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $instapaperImport = $this->getInstapaperImport(); + $instapaperImport = $this->getInstapaperImport(false, 3); $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class InstapaperImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $instapaperImport = $this->getInstapaperImport(); + $instapaperImport = $this->getInstapaperImport(false, 1); $instapaperImport->setFilepath(__DIR__.'/../fixtures/instapaper-export.csv'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index 9ec7935c..141ece36 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php @@ -24,7 +24,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase protected $contentProxy; protected $logHandler; - private function getPocketImport($consumerKey = 'ConsumerKey') + private function getPocketImport($consumerKey = 'ConsumerKey', $dispatched = 0) { $this->user = new User(); @@ -55,10 +55,15 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase ->method('getScheduledEntityInsertions') ->willReturn([]); - $pocket = new PocketImport( - $this->em, - $this->contentProxy - ); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $pocket = new PocketImport($this->em, $this->contentProxy, $dispatcher); $pocket->setUser($this->user); $this->logHandler = new TestHandler(); @@ -252,7 +257,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $client->getEmitter()->attach($mock); - $pocketImport = $this->getPocketImport(); + $pocketImport = $this->getPocketImport('ConsumerKey', 1); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -339,7 +344,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $client->getEmitter()->attach($mock); - $pocketImport = $this->getPocketImport(); + $pocketImport = $this->getPocketImport('ConsumerKey', 2); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() @@ -591,7 +596,7 @@ JSON; $client->getEmitter()->attach($mock); - $pocketImport = $this->getPocketImport(); + $pocketImport = $this->getPocketImport('ConsumerKey', 1); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') ->disableOriginalConstructor() diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php index d98cd486..d1bbe648 100644 --- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php @@ -18,7 +18,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getReadabilityImport($unsetUser = false) + private function getReadabilityImport($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -30,7 +30,15 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new ReadabilityImport($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new ReadabilityImport($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -54,7 +62,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $readabilityImport = $this->getReadabilityImport(); + $readabilityImport = $this->getReadabilityImport(false, 24); $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -87,7 +95,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $readabilityImport = $this->getReadabilityImport(); + $readabilityImport = $this->getReadabilityImport(false, 1); $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php index 82dc4c7e..4dbced60 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV1ImportTest.php @@ -18,7 +18,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getWallabagV1Import($unsetUser = false) + private function getWallabagV1Import($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -44,7 +44,15 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new WallabagV1Import($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new WallabagV1Import($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -68,7 +76,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $wallabagV1Import = $this->getWallabagV1Import(); + $wallabagV1Import = $this->getWallabagV1Import(false, 3); $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -101,7 +109,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $wallabagV1Import = $this->getWallabagV1Import(); + $wallabagV1Import = $this->getWallabagV1Import(false, 3); $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index bea89efb..0e50b8b2 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php @@ -18,7 +18,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase protected $logHandler; protected $contentProxy; - private function getWallabagV2Import($unsetUser = false) + private function getWallabagV2Import($unsetUser = false, $dispatched = 0) { $this->user = new User(); @@ -44,7 +44,15 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $wallabag = new WallabagV2Import($this->em, $this->contentProxy); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') + ->disableOriginalConstructor() + ->getMock(); + + $dispatcher + ->expects($this->exactly($dispatched)) + ->method('dispatch'); + + $wallabag = new WallabagV2Import($this->em, $this->contentProxy, $dispatcher); $this->logHandler = new TestHandler(); $logger = new Logger('test', [$this->logHandler]); @@ -68,7 +76,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase public function testImport() { - $wallabagV2Import = $this->getWallabagV2Import(); + $wallabagV2Import = $this->getWallabagV2Import(false, 2); $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -97,7 +105,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase public function testImportAndMarkAllAsRead() { - $wallabagV2Import = $this->getWallabagV2Import(); + $wallabagV2Import = $this->getWallabagV2Import(false, 2); $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') @@ -246,7 +254,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase public function testImportWithExceptionFromGraby() { - $wallabagV2Import = $this->getWallabagV2Import(); + $wallabagV2Import = $this->getWallabagV2Import(false, 2); $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') diff --git a/data/assets/.gitignore b/web/assets/images/.gitkeep similarity index 100% rename from data/assets/.gitignore rename to web/assets/images/.gitkeep diff --git a/web/bundles/wallabagcore/themes/baggy/js/baggy.min.js b/web/bundles/wallabagcore/themes/baggy/js/baggy.min.js index ddb564d8..a6e76bc0 100644 --- a/web/bundles/wallabagcore/themes/baggy/js/baggy.min.js +++ b/web/bundles/wallabagcore/themes/baggy/js/baggy.min.js @@ -1,19 +1,20 @@ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g li > a").removeClass("active-current"),e("#links > li > a").removeClass("current"),e("[id$=-arrow]").removeClass("arrow-down"),e("#content").removeClass("opacity03")}var j=e("#listmode"),k=e("#list-entries");e("#menu").click(function(){e("#links").toggleClass("menu--open");var a=e("#content");a.hasClass("opacity03")&&a.removeClass("opacity03")}),j.click(function(){1===e.cookie("listmode")?(e.removeCookie("listmode"),k.removeClass("listmode"),j.removeClass("tablemode"),j.addClass("listmode")):(e.cookie("listmode",1,{expires:365}),k.addClass("listmode"),j.removeClass("listmode"),j.addClass("tablemode"))}),1===e.cookie("listmode")&&(k.addClass("listmode"),j.removeClass("listmode"),j.addClass("tablemode")),e("#nav-btn-add-tag").on("click",function(){return e(".nav-panel-add-tag").toggle(100),e(".nav-panel-menu").addClass("hidden"),e("#tag_label").focus(),!1}),e("div").is("#filters")&&(e("#button_filters").show(),e("#clear_form_filters").on("click",function(){return e("#filters input").val(""),e("#filters :checked").removeAttr("checked"),!1})),e("article").length&&!function(){var a=new f.App;a.include(f.ui.main,{element:document.querySelector("article")});var b=JSON.parse(e("#annotationroutes").html());a.include(f.storage.http,b),a.start().then(function(){a.annotations.load({entry:b.entryId})}),e(window).scroll(function(){var a=e(window).scrollTop(),d=e(document).height(),f=a/d,g=Math.round(100*f)/100;(0,c.savePercent)(b.entryId,g)}),(0,c.retrievePercent)(b.entryId),e(window).resize(function(){(0,c.retrievePercent)(b.entryId)})}();var l=window.location.href;l.match("&closewin=true")&&window.close(),e("a.closeMessage").on("click",function(){return e(void 0).parents("div.messages").slideUp(300,function(){e(void 0).remove()}),!1}),e("#search-form").hide(),e("#bagit-form").hide(),e("#filters").hide(),e("#download-form").hide(),e("#search").click(function(){i(),a(),e("#searchfield").focus()}),e(".filter-btn").click(function(){i(),b()}),e(".download-btn").click(function(){i(),g()}),e("#bagit").click(function(){i(),h(),e("#plainurl").focus()}),e("#search-form-close").click(function(){a()}),e("#filter-form-close").click(function(){b()}),e("#download-form-close").click(function(){g()}),e("#bagit-form-close").click(function(){h()});var m=e("#bagit-form-form");m.submit(function(a){e("body").css("cursor","wait"),e("#add-link-result").empty(),e.ajax({type:m.attr("method"),url:m.attr("action"),data:m.serialize(),success:function(){e("#add-link-result").html("Done!"),e("#plainurl").val(""),e("#plainurl").blur(""),e("body").css("cursor","auto")},error:function(){e("#add-link-result").html("Failed!"),e("body").css("cursor","auto")}}),a.preventDefault()}),e('article a[href^="http"]').after(function(){return''}),e(".add-to-wallabag-link-after").click(function(a){(0,d.toggleSaveLinkForm)(e(void 0).attr("href"),a),a.preventDefault()})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../_global/js/tools":1,"./uiTools":3,annotator:4,jquery:31,"jquery-ui-browserify":29,"jquery.cookie":30}],3:[function(a,b,c){"use strict";function d(a,b){e("#add-link-result").empty();var c=e("#bagit"),d=e("#bagit-form");c.toggleClass("active-current"),0===c.length&&("undefined"!==b&&b?d.css({position:"absolute",top:b.pageY,left:b.pageX-200}):d.css({position:"relative",top:"auto",left:"auto"}));var f=e("#search-form"),g=e("#plainurl");0!==f.length&&(e("#search").removeClass("current"),e("#search-arrow").removeClass("arrow-down"),f.hide()),d.toggle(),e("#content").toggleClass("opacity03"),"undefined"!==a&&a&&g.val(a),g.focus()}Object.defineProperty(c,"__esModule",{value:!0});var e=a("jquery");c.toggleSaveLinkForm=d},{jquery:31}],4:[function(a,b,c){(function(b){"use strict";var d=a("insert-css"),e=a("./css/annotator.css");d(e);var f=a("./src/app"),g=a("./src/util");c.App=f.App,c.authz=a("./src/authz"),c.identity=a("./src/identity"),c.notification=a("./src/notification"),c.storage=a("./src/storage"),c.ui=a("./src/ui"),c.util=g,c.ext={};var h=b.wgxpath;"undefined"!=typeof h&&null!==h&&"function"==typeof h.install&&h.install();var i=b.annotator;c.noConflict=function(){return b.annotator=i,this}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./css/annotator.css":5,"./src/app":7,"./src/authz":8,"./src/identity":9,"./src/notification":10,"./src/storage":12,"./src/ui":13,"./src/util":24,"insert-css":27}],5:[function(a,b,c){b.exports='.annotator-filter *,.annotator-notice,.annotator-widget *{font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;font-weight:400;text-align:left;margin:0;padding:0;background:0 0;-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none;-moz-box-shadow:none;-webkit-box-shadow:none;-o-box-shadow:none;box-shadow:none;color:#909090}.annotator-adder{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAAAwCAYAAAD+WvNWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMj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3hX3dt3woumY5/F2SGwoB9joLNWdf2+eR/edCPAxp/fQd0SJ4ttFkMY4KxWCx5Op0u4pNPPlkvi/YV4ZcvX04IuWd/DNAnPxOMYG/J4zg+4lrhFz75B495geAB4s+6+vVbln72PB3l33ztgE/+ZYOfCJie8/GX6v06h8wnyzMDveu9/CqRp4vtxBNM43/5y1/ueMO5I/gl8QRRLp/NfiD4mXiC2oq6U3rXxBOFVUzmY1tcr/Lq6CjxdERxTfwd8Qcrno4orom/I/5gxdMhAlIQkXwF064CLzwI4lERUUD891M8KiIKiP9OxNNhAvISEVFZDpevaJIHRTwKIvKb/0EQj4KI/Oa/U/F0qIA03JnS+wdKPD7cmSL/gyQeH+5Mkb8jxHOnWZiWiOTBLVH6/kEtbmHIglui9P2DWtzCWH3534r8HSUcd/l/AQYA7PGYKl3+RK0AAAAASUVORK5CYII=);background-repeat:no-repeat}.annotator-editor a:after,.annotator-filter .annotator-filter-navigation button:after,.annotator-filter .annotator-filter-property .annotator-filter-clear,.annotator-resize,.annotator-viewer .annotator-controls a,.annotator-viewer .annotator-controls button,.annotator-widget:after{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAEiCAYAAAD0w4JOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlv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pk6des3BwaGyTiC0yachISHX9+zZk4Qq3qtrxuYEmQWJO3v2bEzv3r2/qWui1R6y5Hl4f72vWTgjY0n78UoDZp2rplKpHCCd6gIiB+44evTod1NSUhZb21Yvd+jQYZROp9tZWVlZVlxcnKU03aFo2di8du/evVa88MQqEP58IZ0Itxakhkyj1R51AkkWDui1QzXvWw0SAWmVyjeWguq9vx70XCIkxjD6T3E4ZGlSUlK+1Rrt3buXFpPSmtFbyEimQdRWgRo0aPA2O6b/X6+DXAQs4Hm0EYXZw4CF1Qnk5uZWGhgY+CnaK9KqjM3W1rZ62LBhVydMmDDdw8PjqMWNlJubewL5UWZiYmIo/WPTmgRCiJBLIc2tBdTHo/+3tMaS1IZnRknLX23qpNLBgwddk5OT93p5edG/nFtLtTTbIOPi4uif4TXl5eUFBw4cWOfo6EgfWTS1GiRa7vnzmjVrKD9qXyeQaAuzBCS37OxnyAykf3utCiPck9U8tEIzEpASa15qaHkHLfloY860UL3314Pk4pG7u4ex+7QYhT60bA6Jh2yAlGZkpBu1bOlGn6HtF52P4Z587duVk6xpM1a1cSLIEchJkYazzG0jWuxOCTstfKMv6OhLMlquF8vuDzcH1I5BaKO1o/tEk3jC0sUcUyD69RvckwWDHIuStIDSHjKE3actwlgYoRXj/2HH9GYkfGlInyreEZ3/jXuyoFlWIy8RRBgAxJ+WCRD6cPdfxgzyI3ZMHwPu4Z6sgKaPLO+z6ze5J0usPzMVIYWPKZ0YuJr1lPB91ihImjmhlj5bfI118SlIHkRIRqeYAxFchNZiX+EMP6ScImq7WpuSi5SwTHYyc4u7rFEvWuS09TH79wz6nwADANCoQA3w0fcjAAAAAElFTkSuQmCC);background-repeat:no-repeat}.annotator-hl{background:#FFFF0A;background:rgba(255,255,10,.3);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4DFFFF0A, endColorstr=#4DFFFF0A)"}.annotator-hl-temporary{background:#007CFF;background:rgba(0,124,255,.3);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4D007CFF, endColorstr=#4D007CFF)"}.annotator-wrapper{position:relative}.annotator-adder,.annotator-notice,.annotator-outer{z-index:1020}.annotator-adder,.annotator-notice,.annotator-outer,.annotator-widget{position:absolute;font-size:10px;line-height:1}.annotator-hide{display:none;visibility:hidden}.annotator-adder{margin-top:-48px;margin-left:-24px;width:48px;height:48px;background-position:left top}.annotator-adder:hover{background-position:center top}.annotator-adder:active{background-position:center right}.annotator-adder button{display:block;width:36px;height:41px;margin:0 auto;border:none;background:0 0;text-indent:-999em;cursor:pointer}.annotator-outer{width:0;height:0}.annotator-widget{margin:0;padding:0;bottom:15px;left:-18px;min-width:265px;background-color:#FBFBFB;background-color:rgba(251,251,251,.98);border:1px solid #7A7A7A;border:1px solid rgba(122,122,122,.6);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,.2);-moz-box-shadow:0 5px 15px rgba(0,0,0,.2);-o-box-shadow:0 5px 15px rgba(0,0,0,.2);box-shadow:0 5px 15px rgba(0,0,0,.2)}.annotator-invert-x .annotator-widget{left:auto;right:-18px}.annotator-invert-y .annotator-widget{bottom:auto;top:8px}.annotator-widget strong{font-weight:700}.annotator-widget .annotator-item,.annotator-widget .annotator-listing{padding:0;margin:0;list-style:none}.annotator-widget:after{content:"";display:block;width:18px;height:10px;background-position:0 0;position:absolute;bottom:-10px;left:8px}.annotator-invert-x .annotator-widget:after{left:auto;right:8px}.annotator-invert-y .annotator-widget:after{background-position:0 -15px;bottom:auto;top:-9px}.annotator-editor .annotator-item input,.annotator-editor .annotator-item textarea,.annotator-widget .annotator-item{position:relative;font-size:12px}.annotator-viewer .annotator-item{border-top:2px solid #7A7A7A;border-top:2px solid rgba(122,122,122,.2)}.annotator-widget .annotator-item:first-child{border-top:none}.annotator-editor .annotator-item,.annotator-viewer div{border-top:1px solid #858585;border-top:1px solid rgba(133,133,133,.11)}.annotator-viewer div{padding:6px}.annotator-viewer .annotator-item ol,.annotator-viewer .annotator-item ul{padding:4px 16px}.annotator-editor .annotator-item:first-child textarea,.annotator-viewer div:first-of-type{padding-top:12px;padding-bottom:12px;color:#3c3c3c;font-size:13px;font-style:italic;line-height:1.3;border-top:none}.annotator-viewer .annotator-controls{position:relative;top:5px;right:5px;padding-left:5px;opacity:0;-webkit-transition:opacity .2s ease-in;-moz-transition:opacity .2s ease-in;-o-transition:opacity .2s ease-in;transition:opacity .2s ease-in;float:right}.annotator-viewer li .annotator-controls.annotator-visible,.annotator-viewer li:hover .annotator-controls{opacity:1}.annotator-viewer .annotator-controls a,.annotator-viewer .annotator-controls button{cursor:pointer;display:inline-block;width:13px;height:13px;margin-left:2px;border:none;opacity:.2;text-indent:-900em;background-color:transparent;outline:0}.annotator-viewer .annotator-controls a:focus,.annotator-viewer .annotator-controls a:hover,.annotator-viewer .annotator-controls button:focus,.annotator-viewer .annotator-controls button:hover{opacity:.9}.annotator-viewer .annotator-controls a:active,.annotator-viewer .annotator-controls button:active{opacity:1}.annotator-viewer .annotator-controls button[disabled]{display:none}.annotator-viewer .annotator-controls .annotator-edit{background-position:0 -60px}.annotator-viewer .annotator-controls .annotator-delete{background-position:0 -75px}.annotator-viewer .annotator-controls .annotator-link{background-position:0 -270px}.annotator-editor .annotator-item{position:relative}.annotator-editor .annotator-item label{top:0;display:inline;cursor:pointer;font-size:12px}.annotator-editor .annotator-item input,.annotator-editor .annotator-item textarea{display:block;min-width:100%;padding:10px 8px;border:none;margin:0;color:#3c3c3c;background:0 0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;resize:none}.annotator-editor .annotator-item textarea::-webkit-scrollbar{height:8px;width:8px}.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece{margin:13px 0 3px;background-color:#e5e5e5;-webkit-border-radius:4px}.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical{height:25px;background-color:#ccc;-webkit-border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.1)}.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal{width:25px;background-color:#ccc;-webkit-border-radius:4px}.annotator-editor .annotator-item:first-child textarea{min-height:5.5em;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;-o-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.annotator-editor .annotator-item input:focus,.annotator-editor .annotator-item textarea:focus{background-color:#f3f3f3;outline:0}.annotator-editor .annotator-item input[type=checkbox],.annotator-editor .annotator-item input[type=radio]{width:auto;min-width:0;padding:0;display:inline;margin:0 4px 0 0;cursor:pointer}.annotator-editor .annotator-checkbox{padding:8px 6px}.annotator-editor .annotator-controls,.annotator-filter,.annotator-filter .annotator-filter-navigation button{text-align:right;padding:3px;border-top:1px solid #d4d4d4;background-color:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),color-stop(.6,#dcdcdc),to(#d2d2d2));background-image:-moz-linear-gradient(to bottom,#f5f5f5,#dcdcdc 60%,#d2d2d2);background-image:-webkit-linear-gradient(to bottom,#f5f5f5,#dcdcdc 60%,#d2d2d2);background-image:linear-gradient(to bottom,#f5f5f5,#dcdcdc 60%,#d2d2d2);-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.7),inset -1px 0 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.7),inset -1px 0 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-o-box-shadow:inset 1px 0 0 rgba(255,255,255,.7),inset -1px 0 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);box-shadow:inset 1px 0 0 rgba(255,255,255,.7),inset -1px 0 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-webkit-border-radius:0 0 5px 5px;-moz-border-radius:0 0 5px 5px;-o-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px}.annotator-editor.annotator-invert-y .annotator-controls{border-top:none;border-bottom:1px solid #b4b4b4;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;-o-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.annotator-editor a,.annotator-filter .annotator-filter-property label{position:relative;display:inline-block;padding:0 6px 0 22px;color:#363636;text-shadow:0 1px 0 rgba(255,255,255,.75);text-decoration:none;line-height:24px;font-size:12px;font-weight:700;border:1px solid #a2a2a2;background-color:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),color-stop(.5,#d2d2d2),color-stop(.5,#bebebe),to(#d2d2d2));background-image:-moz-linear-gradient(to bottom,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);background-image:-webkit-linear-gradient(to bottom,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);background-image:linear-gradient(to bottom,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);-webkit-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);-moz-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);-o-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border-radius:5px}.annotator-editor a:after{position:absolute;top:50%;left:5px;display:block;content:"";width:15px;height:15px;margin-top:-7px;background-position:0 -90px}.annotator-editor a.annotator-focus,.annotator-editor a:focus,.annotator-editor a:hover,.annotator-filter .annotator-filter-active label,.annotator-filter .annotator-filter-navigation button:hover{outline:0;border-color:#435aa0;background-color:#3865f9;background-image:-webkit-gradient(linear,left top,left bottom,from(#7691fb),color-stop(.5,#5075fb),color-stop(.5,#3865f9),to(#3665fa));background-image:-moz-linear-gradient(to bottom,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);background-image:-webkit-linear-gradient(to bottom,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);background-image:linear-gradient(to bottom,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.42)}.annotator-editor a:focus:after,.annotator-editor a:hover:after{margin-top:-8px;background-position:0 -105px}.annotator-editor a:active,.annotator-filter .annotator-filter-navigation button:active{border-color:#700c49;background-color:#d12e8e;background-image:-webkit-gradient(linear,left top,left bottom,from(#fc7cca),color-stop(.5,#e85db2),color-stop(.5,#d12e8e),to(#ff009c));background-image:-moz-linear-gradient(to bottom,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c);background-image:-webkit-linear-gradient(to bottom,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c);background-image:linear-gradient(to bottom,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c)}.annotator-editor a.annotator-save:after{background-position:0 -120px}.annotator-editor a.annotator-save.annotator-focus:after,.annotator-editor a.annotator-save:focus:after,.annotator-editor a.annotator-save:hover:after{margin-top:-8px;background-position:0 -135px}.annotator-editor .annotator-widget:after{background-position:0 -30px}.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls{background-color:#f2f2f2}.annotator-editor.annotator-invert-y .annotator-widget:after{background-position:0 -45px;height:11px}.annotator-resize{position:absolute;top:0;right:0;width:12px;height:12px;background-position:2px -150px}.annotator-invert-x .annotator-resize{right:auto;left:0;background-position:0 -195px}.annotator-invert-y .annotator-resize{top:auto;bottom:0;background-position:2px -165px}.annotator-invert-y.annotator-invert-x .annotator-resize{background-position:0 -180px}.annotator-notice{color:#fff;position:fixed;top:-54px;left:0;width:100%;font-size:14px;line-height:50px;text-align:center;background:#000;background:rgba(0,0,0,.9);border-bottom:4px solid #d4d4d4;-webkit-transition:top .4s ease-out;-moz-transition:top .4s ease-out;-o-transition:top .4s ease-out;transition:top .4s ease-out}.annotator-notice-success{border-color:#3665f9}.annotator-notice-error{border-color:#ff7e00}.annotator-notice p{margin:0}.annotator-notice a{color:#fff}.annotator-notice-show{top:0}.annotator-tags{margin-bottom:-2px}.annotator-tags .annotator-tag{display:inline-block;padding:0 8px;margin-bottom:2px;line-height:1.6;font-weight:700;background-color:#e6e6e6;-webkit-border-radius:8px;-moz-border-radius:8px;-o-border-radius:8px;border-radius:8px}.annotator-filter{z-index:1010;position:fixed;top:0;right:0;left:0;text-align:left;line-height:0;border:none;border-bottom:1px solid #878787;padding-left:10px;padding-right:10px;-webkit-border-radius:0;-moz-border-radius:0;-o-border-radius:0;border-radius:0;-webkit-box-shadow:inset 0 -1px 0 rgba(255,255,255,.3);-moz-box-shadow:inset 0 -1px 0 rgba(255,255,255,.3);-o-box-shadow:inset 0 -1px 0 rgba(255,255,255,.3);box-shadow:inset 0 -1px 0 rgba(255,255,255,.3)}.annotator-filter strong{font-size:12px;font-weight:700;color:#3c3c3c;text-shadow:0 1px 0 rgba(255,255,255,.7);position:relative;top:-9px}.annotator-filter .annotator-filter-navigation,.annotator-filter .annotator-filter-property{position:relative;display:inline-block;overflow:hidden;line-height:10px;padding:2px 0;margin-right:8px}.annotator-filter .annotator-filter-navigation button,.annotator-filter .annotator-filter-property label{text-align:left;display:block;float:left;line-height:20px;-webkit-border-radius:10px 0 0 10px;-moz-border-radius:10px 0 0 10px;-o-border-radius:10px 0 0 10px;border-radius:10px 0 0 10px}.annotator-filter .annotator-filter-property label{padding-left:8px}.annotator-filter .annotator-filter-property input{display:block;float:right;-webkit-appearance:none;border:1px solid #878787;border-left:none;padding:2px 4px;line-height:16px;min-height:16px;font-size:12px;width:150px;color:#333;background-color:#f8f8f8;-webkit-border-radius:0 10px 10px 0;-moz-border-radius:0 10px 10px 0;-o-border-radius:0 10px 10px 0;border-radius:0 10px 10px 0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);-o-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);box-shadow:inset 0 1px 1px rgba(0,0,0,.2)}.annotator-filter .annotator-filter-property input:focus{outline:0;background-color:#fff}.annotator-filter .annotator-filter-clear{position:absolute;right:3px;top:6px;border:none;text-indent:-900em;width:15px;height:15px;background-position:0 -90px;opacity:.4}.annotator-filter .annotator-filter-clear:focus,.annotator-filter .annotator-filter-clear:hover{opacity:.8}.annotator-filter .annotator-filter-clear:active{opacity:1}.annotator-filter .annotator-filter-navigation button{border:1px solid #a2a2a2;padding:0;text-indent:-900px;width:20px;min-height:22px;-webkit-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);-moz-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);-o-box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8);box-shadow:inset 0 0 5px rgba(255,255,255,.2),inset 0 0 1px rgba(255,255,255,.8)}.annotator-filter .annotator-filter-navigation button,.annotator-filter .annotator-filter-navigation button:focus,.annotator-filter .annotator-filter-navigation button:hover{color:transparent}.annotator-filter .annotator-filter-navigation button:after{position:absolute;top:8px;left:8px;content:"";display:block;width:9px;height:9px;background-position:0 -210px}.annotator-filter .annotator-filter-navigation button:hover:after{background-position:0 -225px}.annotator-filter .annotator-filter-navigation .annotator-filter-next{-webkit-border-radius:0 10px 10px 0;-moz-border-radius:0 10px 10px 0;-o-border-radius:0 10px 10px 0;border-radius:0 10px 10px 0;border-left:none}.annotator-filter .annotator-filter-navigation .annotator-filter-next:after{left:auto;right:7px;background-position:0 -240px}.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover:after{background-position:0 -255px}.annotator-hl-active{background:#FFFF0A;background:rgba(255,255,10,.8);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCFFFF0A, endColorstr=#CCFFFF0A)"}.annotator-hl-filtered{background-color:transparent}'; -},{}],6:[function(a,b,c){!function(a,c){"object"==typeof b&&"object"==typeof b.exports?b.exports=a.document?c(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return c(a)}:c(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=!!a&&"length"in a&&a.length,c=na.type(a);return"function"===c||na.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(na.isFunction(b))return na.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return na.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(xa.test(b))return na.filter(b,a,c);b=na.filter(b,a)}return na.grep(a,function(a){return na.inArray(a,b)>-1!==c})}function e(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function f(a){var b={};return na.each(a.match(Da)||[],function(a,c){b[c]=!0}),b}function g(){da.addEventListener?(da.removeEventListener("DOMContentLoaded",h),a.removeEventListener("load",h)):(da.detachEvent("onreadystatechange",h),a.detachEvent("onload",h))}function h(){(da.addEventListener||"load"===a.event.type||"complete"===da.readyState)&&(g(),na.ready())}function i(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(Ia,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:Ha.test(c)?na.parseJSON(c):c}catch(e){}na.data(a,b,c)}else c=void 0}return c}function j(a){var b;for(b in a)if(("data"!==b||!na.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function k(a,b,c,d){if(Ga(a)){var e,f,g=na.expando,h=a.nodeType,i=h?na.cache:a,j=h?a[g]:a[g]&&g;if(j&&i[j]&&(d||i[j].data)||void 0!==c||"string"!=typeof b)return j||(j=h?a[g]=ca.pop()||na.guid++:g),i[j]||(i[j]=h?{}:{toJSON:na.noop}),"object"!=typeof b&&"function"!=typeof b||(d?i[j]=na.extend(i[j],b):i[j].data=na.extend(i[j].data,b)),f=i[j],d||(f.data||(f.data={}),f=f.data),void 0!==c&&(f[na.camelCase(b)]=c),"string"==typeof b?(e=f[b],null==e&&(e=f[na.camelCase(b)])):e=f,e}}function l(a,b,c){if(Ga(a)){var d,e,f=a.nodeType,g=f?na.cache:a,h=f?a[na.expando]:na.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){na.isArray(b)?b=b.concat(na.map(b,na.camelCase)):b in d?b=[b]:(b=na.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;for(;e--;)delete d[b[e]];if(c?!j(d):!na.isEmptyObject(d))return}(c||(delete g[h].data,j(g[h])))&&(f?na.cleanData([a],!0):la.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}function m(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return na.css(a,b,"")},i=h(),j=c&&c[3]||(na.cssNumber[b]?"":"px"),k=(na.cssNumber[b]||"px"!==j&&+i)&&Ka.exec(na.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,na.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}function n(a){var b=Sa.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function o(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||na.nodeName(d,b)?f.push(d):na.merge(f,o(d,b));return void 0===b||b&&na.nodeName(a,b)?na.merge([a],f):f}function p(a,b){for(var c,d=0;null!=(c=a[d]);d++)na._data(c,"globalEval",!b||na._data(b[d],"globalEval"))}function q(a){Oa.test(a.type)&&(a.defaultChecked=a.checked)}function r(a,b,c,d,e){for(var f,g,h,i,j,k,l,m=a.length,r=n(b),s=[],t=0;m>t;t++)if(g=a[t],g||0===g)if("object"===na.type(g))na.merge(s,g.nodeType?[g]:g);else if(Ua.test(g)){for(i=i||r.appendChild(b.createElement("div")),j=(Pa.exec(g)||["",""])[1].toLowerCase(),l=Ta[j]||Ta._default,i.innerHTML=l[1]+na.htmlPrefilter(g)+l[2],f=l[0];f--;)i=i.lastChild;if(!la.leadingWhitespace&&Ra.test(g)&&s.push(b.createTextNode(Ra.exec(g)[0])),!la.tbody)for(g="table"!==j||Va.test(g)?""!==l[1]||Va.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;f--;)na.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k);for(na.merge(s,i.childNodes),i.textContent="";i.firstChild;)i.removeChild(i.firstChild);i=r.lastChild}else s.push(b.createTextNode(g));for(i&&r.removeChild(i),la.appendChecked||na.grep(o(s,"input"),q),t=0;g=s[t++];)if(d&&na.inArray(g,d)>-1)e&&e.push(g);else if(h=na.contains(g.ownerDocument,g),i=o(r.appendChild(g),"script"),h&&p(i),c)for(f=0;g=i[f++];)Qa.test(g.type||"")&&c.push(g);return i=null,r}function s(){return!0}function t(){return!1}function u(){try{return da.activeElement}catch(a){}}function v(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)v(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=t;else if(!e)return a;return 1===f&&(g=e,e=function(a){return na().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=na.guid++)),a.each(function(){na.event.add(this,b,e,d,c)})}function w(a,b){return na.nodeName(a,"table")&&na.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function x(a){return a.type=(null!==na.find.attr(a,"type"))+"/"+a.type,a}function y(a){var b=eb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function z(a,b){if(1===b.nodeType&&na.hasData(a)){var c,d,e,f=na._data(a),g=na._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)na.event.add(b,c,h[c][d])}g.data&&(g.data=na.extend({},g.data))}}function A(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!la.noCloneEvent&&b[na.expando]){e=na._data(b);for(d in e.events)na.removeEvent(b,d,e.handle);b.removeAttribute(na.expando)}"script"===c&&b.text!==a.text?(x(b).text=a.text,y(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),la.html5Clone&&a.innerHTML&&!na.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Oa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function B(a,b,c,d){b=fa.apply([],b);var e,f,g,h,i,j,k=0,l=a.length,m=l-1,n=b[0],p=na.isFunction(n);if(p||l>1&&"string"==typeof n&&!la.checkClone&&db.test(n))return a.each(function(e){var f=a.eq(e);p&&(b[0]=n.call(this,e,f.html())),B(f,b,c,d)});if(l&&(j=r(b,a[0].ownerDocument,!1,a,d),e=j.firstChild,1===j.childNodes.length&&(j=e),e||d)){for(h=na.map(o(j,"script"),x),g=h.length;l>k;k++)f=j,k!==m&&(f=na.clone(f,!0,!0),g&&na.merge(h,o(f,"script"))),c.call(a[k],f,k);if(g)for(i=h[h.length-1].ownerDocument,na.map(h,y),k=0;g>k;k++)f=h[k],Qa.test(f.type||"")&&!na._data(f,"globalEval")&&na.contains(i,f)&&(f.src?na._evalUrl&&na._evalUrl(f.src):na.globalEval((f.text||f.textContent||f.innerHTML||"").replace(fb,"")));j=e=null}return a}function C(a,b,c){for(var d,e=b?na.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||na.cleanData(o(d)),d.parentNode&&(c&&na.contains(d.ownerDocument,d)&&p(o(d,"script")),d.parentNode.removeChild(d));return a}function D(a,b){var c=na(b.createElement(a)).appendTo(b.body),d=na.css(c[0],"display");return c.detach(),d}function E(a){var b=da,c=jb[a];return c||(c=D(a,b),"none"!==c&&c||(ib=(ib||na("