aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/AppKernel.php24
-rwxr-xr-xapp/DoctrineMigrations/Version20180405182455.php51
-rw-r--r--app/DoctrineMigrations/Version20181128203230.php45
-rw-r--r--app/DoctrineMigrations/Version20181202073750.php76
-rw-r--r--app/DoctrineMigrations/Version20190117131816.php32
-rw-r--r--app/DoctrineMigrations/Version20190129120000.php147
-rw-r--r--app/DoctrineMigrations/Version20190401105353.php42
-rw-r--r--app/DoctrineMigrations/Version20190425115043.php58
-rw-r--r--app/DoctrineMigrations/Version20190510141130.php96
-rw-r--r--app/Resources/static/themes/_global/index.js37
-rw-r--r--app/Resources/static/themes/baggy/css/article.scss6
-rw-r--r--app/Resources/static/themes/baggy/css/layout.scss11
-rw-r--r--app/Resources/static/themes/baggy/css/pictos.scss2
-rw-r--r--app/Resources/static/themes/material/css/cards.scss11
-rwxr-xr-xapp/Resources/static/themes/material/index.js9
-rw-r--r--app/Resources/static/themes/material/js/tools.js14
-rw-r--r--app/autoload.php13
-rw-r--r--app/config/config.yml29
-rw-r--r--app/config/config_test.yml2
-rw-r--r--app/config/parameters.yml.dist13
-rw-r--r--app/config/parameters_test.yml1
-rw-r--r--app/config/routing.yml44
-rw-r--r--app/config/security.yml19
-rw-r--r--app/config/services.yml6
-rw-r--r--app/config/services_test.yml38
-rw-r--r--app/config/tests/parameters_test.mysql.yml1
-rw-r--r--app/config/tests/parameters_test.pgsql.yml1
-rw-r--r--app/config/tests/parameters_test.sqlite.yml1
28 files changed, 777 insertions, 52 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 40726f05..7d19e9ab 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -1,6 +1,7 @@
1<?php 1<?php
2 2
3use Symfony\Component\Config\Loader\LoaderInterface; 3use Symfony\Component\Config\Loader\LoaderInterface;
4use Symfony\Component\DependencyInjection\ContainerBuilder;
4use Symfony\Component\HttpKernel\Kernel; 5use Symfony\Component\HttpKernel\Kernel;
5 6
6class AppKernel extends Kernel 7class AppKernel extends Kernel
@@ -32,6 +33,7 @@ class AppKernel extends Kernel
32 new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), 33 new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
33 new FOS\JsRoutingBundle\FOSJsRoutingBundle(), 34 new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
34 new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(), 35 new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(),
36 new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
35 37
36 // wallabag bundles 38 // wallabag bundles
37 new Wallabag\CoreBundle\WallabagCoreBundle(), 39 new Wallabag\CoreBundle\WallabagCoreBundle(),
@@ -39,25 +41,32 @@ class AppKernel extends Kernel
39 new Wallabag\UserBundle\WallabagUserBundle(), 41 new Wallabag\UserBundle\WallabagUserBundle(),
40 new Wallabag\ImportBundle\WallabagImportBundle(), 42 new Wallabag\ImportBundle\WallabagImportBundle(),
41 new Wallabag\AnnotationBundle\WallabagAnnotationBundle(), 43 new Wallabag\AnnotationBundle\WallabagAnnotationBundle(),
42 new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
43 ]; 44 ];
44 45
45 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { 46 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
46 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 47 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
47 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 48 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
48 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 49 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
49 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
51 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
52 51
53 if ('test' === $this->getEnvironment()) { 52 if ('test' === $this->getEnvironment()) {
54 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle(); 53 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
55 } 54 }
55
56 if ('dev' === $this->getEnvironment()) {
57 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
58 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
59 }
56 } 60 }
57 61
58 return $bundles; 62 return $bundles;
59 } 63 }
60 64
65 public function getRootDir()
66 {
67 return __DIR__;
68 }
69
61 public function getCacheDir() 70 public function getCacheDir()
62 { 71 {
63 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); 72 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@@ -70,7 +79,8 @@ class AppKernel extends Kernel
70 79
71 public function registerContainerConfiguration(LoaderInterface $loader) 80 public function registerContainerConfiguration(LoaderInterface $loader)
72 { 81 {
73 $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); 82 $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
83
74 $loader->load(function ($container) { 84 $loader->load(function ($container) {
75 if ($container->getParameter('use_webpack_dev_server')) { 85 if ($container->getParameter('use_webpack_dev_server')) {
76 $container->loadFromExtension('framework', [ 86 $container->loadFromExtension('framework', [
@@ -86,5 +96,11 @@ class AppKernel extends Kernel
86 ]); 96 ]);
87 } 97 }
88 }); 98 });
99
100 $loader->load(function (ContainerBuilder $container) {
101 // $container->setParameter('container.autowiring.strict_mode', true);
102 // $container->setParameter('container.dumper.inline_class_loader', true);
103 $container->addObjectResource($this);
104 });
89 } 105 }
90} 106}
diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php
new file mode 100755
index 00000000..50fe97c7
--- /dev/null
+++ b/app/DoctrineMigrations/Version20180405182455.php
@@ -0,0 +1,51 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add archived_at column and set its value to updated_at for is_archived entries.
10 */
11class Version20180405182455 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $entryTable = $schema->getTable($this->getTable('entry'));
19
20 $this->skipIf($entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.');
21
22 $entryTable->addColumn('archived_at', 'datetime', [
23 'notnull' => false,
24 ]);
25 }
26
27 public function postUp(Schema $schema)
28 {
29 $entryTable = $schema->getTable($this->getTable('entry'));
30 $this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum');
31
32 $this->connection->executeQuery(
33 'UPDATE ' . $this->getTable('entry') . ' SET archived_at = updated_at WHERE is_archived = :is_archived',
34 [
35 'is_archived' => true,
36 ]
37 );
38 }
39
40 /**
41 * @param Schema $schema
42 */
43 public function down(Schema $schema)
44 {
45 $entryTable = $schema->getTable($this->getTable('entry'));
46
47 $this->skipIf(!$entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.');
48
49 $entryTable->dropColumn('archived_at');
50 }
51}
diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php
new file mode 100644
index 00000000..d1b09fc7
--- /dev/null
+++ b/app/DoctrineMigrations/Version20181128203230.php
@@ -0,0 +1,45 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Fix varchar field from vendor to work with utf8mb4.
10 */
11class Version20181128203230 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
19
20 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
21 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
22 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
23 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
24 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
25 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
26 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
27 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
28 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
29 }
30
31 public function down(Schema $schema)
32 {
33 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
34
35 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
36 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
37 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
38 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
39 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
40 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
41 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
42 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
43 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
44 }
45}
diff --git a/app/DoctrineMigrations/Version20181202073750.php b/app/DoctrineMigrations/Version20181202073750.php
new file mode 100644
index 00000000..5978291e
--- /dev/null
+++ b/app/DoctrineMigrations/Version20181202073750.php
@@ -0,0 +1,76 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add 2fa OTP stuff.
10 */
11final class Version20181202073750 extends WallabagMigration
12{
13 public function up(Schema $schema): void
14 {
15 switch ($this->connection->getDatabasePlatform()->getName()) {
16 case 'sqlite':
17 $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297');
18 $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF');
19 $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8');
20 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM ' . $this->getTable('user', true) . '');
21 $this->addSql('DROP TABLE ' . $this->getTable('user', true) . '');
22 $this->addSql('CREATE TABLE ' . $this->getTable('user', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, emailTwoFactor BOOLEAN NOT NULL, salt VARCHAR(255) DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array)
23 , googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array)
24 )');
25 $this->addSql('INSERT INTO ' . $this->getTable('user', true) . ' (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM __temp__' . $this->getTable('user', true) . '');
26 $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . '');
27 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $this->getTable('user', true) . ' (confirmation_token)');
28 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $this->getTable('user', true) . ' (email_canonical)');
29 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $this->getTable('user', true) . ' (username_canonical)');
30 break;
31 case 'mysql':
32 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL');
33 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL');
34 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted');
35 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\'');
36 break;
37 case 'postgresql':
38 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL');
39 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN twofactorauthentication TO emailTwoFactor');
40 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted');
41 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes TEXT DEFAULT NULL');
42 break;
43 }
44 }
45
46 public function down(Schema $schema): void
47 {
48 switch ($this->connection->getDatabasePlatform()->getName()) {
49 case 'sqlite':
50 $this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8');
51 $this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF');
52 $this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297');
53 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM "' . $this->getTable('user', true) . '"');
54 $this->addSql('DROP TABLE "' . $this->getTable('user', true) . '"');
55 $this->addSql('CREATE TABLE "' . $this->getTable('user', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL COLLATE BINARY, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, roles CLOB NOT NULL COLLATE BINARY, trusted CLOB DEFAULT NULL COLLATE BINARY)');
56 $this->addSql('INSERT INTO "' . $this->getTable('user', true) . '" (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM __temp__' . $this->getTable('user', true) . '');
57 $this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . '');
58 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "' . $this->getTable('user', true) . '" (username_canonical)');
59 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "' . $this->getTable('user', true) . '" (email_canonical)');
60 $this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "' . $this->getTable('user', true) . '" (confirmation_token)');
61 break;
62 case 'mysql':
63 $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret');
64 $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL');
65 $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` ADD trusted TEXT DEFAULT NULL');
66 $this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP backupCodes');
67 break;
68 case 'postgresql':
69 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP googleAuthenticatorSecret');
70 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN emailTwoFactor TO twofactorauthentication');
71 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD trusted TEXT DEFAULT NULL');
72 $this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP backupCodes');
73 break;
74 }
75 }
76}
diff --git a/app/DoctrineMigrations/Version20190117131816.php b/app/DoctrineMigrations/Version20190117131816.php
new file mode 100644
index 00000000..6548b9fa
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190117131816.php
@@ -0,0 +1,32 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add updated_at fields to site_credential table.
10 */
11final class Version20190117131816 extends WallabagMigration
12{
13 public function up(Schema $schema): void
14 {
15 $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
16
17 $this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
18
19 $siteCredentialTable->addColumn('updated_at', 'datetime', [
20 'notnull' => false,
21 ]);
22 }
23
24 public function down(Schema $schema): void
25 {
26 $siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
27
28 $this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
29
30 $siteCredentialTable->dropColumn('updated_at');
31 }
32}
diff --git a/app/DoctrineMigrations/Version20190129120000.php b/app/DoctrineMigrations/Version20190129120000.php
new file mode 100644
index 00000000..3632e762
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190129120000.php
@@ -0,0 +1,147 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add missing entries in craue_config_setting.
10 */
11final class Version20190129120000 extends WallabagMigration
12{
13 private $settings = [
14 [
15 'name' => 'carrot',
16 'value' => '1',
17 'section' => 'entry',
18 ],
19 [
20 'name' => 'share_diaspora',
21 'value' => '1',
22 'section' => 'entry',
23 ],
24 [
25 'name' => 'diaspora_url',
26 'value' => 'http://diasporapod.com',
27 'section' => 'entry',
28 ],
29 [
30 'name' => 'share_shaarli',
31 'value' => '1',
32 'section' => 'entry',
33 ],
34 [
35 'name' => 'shaarli_url',
36 'value' => 'http://myshaarli.com',
37 'section' => 'entry',
38 ],
39 [
40 'name' => 'share_mail',
41 'value' => '1',
42 'section' => 'entry',
43 ],
44 [
45 'name' => 'share_twitter',
46 'value' => '1',
47 'section' => 'entry',
48 ],
49 [
50 'name' => 'show_printlink',
51 'value' => '1',
52 'section' => 'entry',
53 ],
54 [
55 'name' => 'export_epub',
56 'value' => '1',
57 'section' => 'export',
58 ],
59 [
60 'name' => 'export_mobi',
61 'value' => '1',
62 'section' => 'export',
63 ],
64 [
65 'name' => 'export_pdf',
66 'value' => '1',
67 'section' => 'export',
68 ],
69 [
70 'name' => 'export_csv',
71 'value' => '1',
72 'section' => 'export',
73 ],
74 [
75 'name' => 'export_json',
76 'value' => '1',
77 'section' => 'export',
78 ],
79 [
80 'name' => 'export_txt',
81 'value' => '1',
82 'section' => 'export',
83 ],
84 [
85 'name' => 'export_xml',
86 'value' => '1',
87 'section' => 'export',
88 ],
89 [
90 'name' => 'piwik_enabled',
91 'value' => '0',
92 'section' => 'analytics',
93 ],
94 [
95 'name' => 'piwik_host',
96 'value' => 'v2.wallabag.org',
97 'section' => 'analytics',
98 ],
99 [
100 'name' => 'piwik_site_id',
101 'value' => '1',
102 'section' => 'analytics',
103 ],
104 [
105 'name' => 'demo_mode_enabled',
106 'value' => '0',
107 'section' => 'misc',
108 ],
109 [
110 'name' => 'demo_mode_username',
111 'value' => 'wallabag',
112 'section' => 'misc',
113 ],
114 [
115 'name' => 'wallabag_support_url',
116 'value' => 'https://www.wallabag.org/pages/support.html',
117 'section' => 'misc',
118 ],
119 ];
120
121 /**
122 * @param Schema $schema
123 */
124 public function up(Schema $schema)
125 {
126 foreach ($this->settings as $setting) {
127 $settingEnabled = $this->container
128 ->get('doctrine.orm.default_entity_manager')
129 ->getConnection()
130 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
131
132 if (false !== $settingEnabled) {
133 continue;
134 }
135
136 $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');");
137 }
138 }
139
140 /**
141 * @param Schema $schema
142 */
143 public function down(Schema $schema)
144 {
145 $this->skipIf(true, 'These settings are required and should not be removed.');
146 }
147}
diff --git a/app/DoctrineMigrations/Version20190401105353.php b/app/DoctrineMigrations/Version20190401105353.php
new file mode 100644
index 00000000..d27962db
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190401105353.php
@@ -0,0 +1,42 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Add hashed_url in entry.
10 */
11class Version20190401105353 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $entryTable = $schema->getTable($this->getTable('entry'));
19
20 $this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
21
22 $entryTable->addColumn('hashed_url', 'text', [
23 'length' => 40,
24 'notnull' => false,
25 ]);
26
27 $entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]);
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function down(Schema $schema)
34 {
35 $entryTable = $schema->getTable($this->getTable('entry'));
36
37 $this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
38
39 $entryTable->dropIndex('hashed_url_user_id');
40 $entryTable->dropColumn('hashed_url');
41 }
42}
diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php
new file mode 100644
index 00000000..4c5c49cc
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190425115043.php
@@ -0,0 +1,58 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Rename rss_token & rss_limit to feed_token & feed_limit.
10 */
11final class Version20190425115043 extends WallabagMigration
12{
13 public function up(Schema $schema): void
14 {
15 switch ($this->connection->getDatabasePlatform()->getName()) {
16 case 'sqlite':
17 $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
18 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true));
19 $this->addSql('DROP TABLE ' . $this->getTable('config', true));
20 $this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
21 $this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
22 $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
23 $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)');
24 break;
25 case 'mysql':
26 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL');
27 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL');
28 break;
29 case 'postgresql':
30 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token');
31 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit');
32 break;
33 }
34 }
35
36 public function down(Schema $schema): void
37 {
38 switch ($this->connection->getDatabasePlatform()->getName()) {
39 case 'sqlite':
40 $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
41 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM "' . $this->getTable('config', true) . '"');
42 $this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"');
43 $this->addSql('CREATE TABLE "' . $this->getTable('config', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, rss_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, rss_limit INTEGER DEFAULT NULL)');
44 $this->addSql('INSERT INTO "' . $this->getTable('config', true) . '" (id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
45 $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
46 $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)');
47 break;
48 case 'mysql':
49 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token');
50 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit');
51 break;
52 case 'postgresql':
53 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token');
54 $this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit');
55 break;
56 }
57 }
58}
diff --git a/app/DoctrineMigrations/Version20190510141130.php b/app/DoctrineMigrations/Version20190510141130.php
new file mode 100644
index 00000000..524aa452
--- /dev/null
+++ b/app/DoctrineMigrations/Version20190510141130.php
@@ -0,0 +1,96 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\SkipMigrationException;
6use Doctrine\DBAL\Schema\Schema;
7use Wallabag\CoreBundle\Doctrine\WallabagMigration;
8
9/**
10 * Enable cascade delete when deleting a user on:
11 * - oauth2_access_tokens
12 * - oauth2_clients
13 * - oauth2_refresh_tokens
14 * - oauth2_auth_codes.
15 */
16final class Version20190510141130 extends WallabagMigration
17{
18 public function up(Schema $schema): void
19 {
20 switch ($this->connection->getDatabasePlatform()->getName()) {
21 case 'sqlite':
22 $this->addSql('DROP INDEX IDX_368A4209A76ED395');
23 $this->addSql('DROP INDEX IDX_368A420919EB6921');
24 $this->addSql('DROP INDEX UNIQ_368A42095F37A13B');
25 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_access_tokens', true));
26 $this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true));
27 $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
28 $this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true));
29 $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true));
30 $this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)');
31 $this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)');
32
33 $this->addSql('DROP INDEX IDX_635D765EA76ED395');
34 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true));
35 $this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true));
36 $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
37 $this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true));
38 $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true));
39 $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)');
40
41 $this->addSql('DROP INDEX IDX_20C9FB24A76ED395');
42 $this->addSql('DROP INDEX IDX_20C9FB2419EB6921');
43 $this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B');
44 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true));
45 $this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true));
46 $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
47 $this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true));
48 $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true));
49 $this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)');
50 $this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)');
51
52 $this->addSql('DROP INDEX IDX_EE52E3FAA76ED395');
53 $this->addSql('DROP INDEX IDX_EE52E3FA19EB6921');
54 $this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B');
55 $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true));
56 $this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true));
57 $this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
58 $this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true));
59 $this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true));
60 $this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)');
61 $this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)');
62 break;
63 case 'mysql':
64 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395');
65 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE');
66
67 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client');
68 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id)');
69
70 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395');
71 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE');
72
73 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395');
74 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id) ON DELETE CASCADE');
75 break;
76 case 'postgresql':
77 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395');
78 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
79
80 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client');
81 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
82
83 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395');
84 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
85
86 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395');
87 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
88 break;
89 }
90 }
91
92 public function down(Schema $schema): void
93 {
94 throw new SkipMigrationException('Too complex ...');
95 }
96}
diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js
index ae598e56..9ad96fc0 100644
--- a/app/Resources/static/themes/_global/index.js
+++ b/app/Resources/static/themes/_global/index.js
@@ -70,4 +70,41 @@ $(document).ready(() => {
70 retrievePercent(x.entryId, true); 70 retrievePercent(x.entryId, true);
71 }); 71 });
72 } 72 }
73
74 document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => {
75 const current = item;
76 current.wallabag_edit_mode = false;
77 current.onclick = (event) => {
78 const target = event.currentTarget;
79
80 if (target.wallabag_edit_mode === false) {
81 $(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden');
82 $(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden');
83 target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus();
84 target.querySelector('.material-icons').innerHTML = 'done';
85
86 target.wallabag_edit_mode = true;
87 } else {
88 target.parentNode.querySelector('[data-handle=tag-rename-form]').submit();
89 }
90 };
91 });
92
93 // mimic radio button because emailTwoFactor is a boolean
94 $('#update_user_googleTwoFactor').on('change', () => {
95 $('#update_user_emailTwoFactor').prop('checked', false);
96 });
97
98 $('#update_user_emailTwoFactor').on('change', () => {
99 $('#update_user_googleTwoFactor').prop('checked', false);
100 });
101
102 // same mimic for super admin
103 $('#user_googleTwoFactor').on('change', () => {
104 $('#user_emailTwoFactor').prop('checked', false);
105 });
106
107 $('#user_emailTwoFactor').on('change', () => {
108 $('#user_googleTwoFactor').prop('checked', false);
109 });
73}); 110});
diff --git a/app/Resources/static/themes/baggy/css/article.scss b/app/Resources/static/themes/baggy/css/article.scss
index 9094ad55..d203ce31 100644
--- a/app/Resources/static/themes/baggy/css/article.scss
+++ b/app/Resources/static/themes/baggy/css/article.scss
@@ -85,7 +85,7 @@ blockquote {
85 color: #999; 85 color: #999;
86} 86}
87 87
88.icon-rss { 88.icon-feed {
89 background-color: #000; 89 background-color: #000;
90 color: #fff; 90 color: #fff;
91 padding: 0.2em 0.5em; 91 padding: 0.2em 0.5em;
@@ -101,8 +101,8 @@ blockquote {
101 margin-bottom: 0.5em; 101 margin-bottom: 0.5em;
102 } 102 }
103 103
104 .icon-rss:hover, 104 .icon-feed:hover,
105 .icon-rss:focus { 105 .icon-feed:focus {
106 background-color: #fff; 106 background-color: #fff;
107 color: #000; 107 color: #000;
108 text-decoration: none; 108 text-decoration: none;
diff --git a/app/Resources/static/themes/baggy/css/layout.scss b/app/Resources/static/themes/baggy/css/layout.scss
index cb14e62d..0293ebe5 100644
--- a/app/Resources/static/themes/baggy/css/layout.scss
+++ b/app/Resources/static/themes/baggy/css/layout.scss
@@ -295,6 +295,15 @@ div.pagination ul {
295 } 295 }
296} 296}
297 297
298.hide { 298.card-tag-form {
299 display: inline-block;
300}
301
302.card-tag-form input[type="text"] {
303 min-width: 20em;
304}
305
306.hide,
307.hidden {
299 display: none; 308 display: none;
300} 309}
diff --git a/app/Resources/static/themes/baggy/css/pictos.scss b/app/Resources/static/themes/baggy/css/pictos.scss
index 2ff01937..b6ebf311 100644
--- a/app/Resources/static/themes/baggy/css/pictos.scss
+++ b/app/Resources/static/themes/baggy/css/pictos.scss
@@ -136,7 +136,7 @@
136 content: "\ea3a"; 136 content: "\ea3a";
137} 137}
138 138
139.icon-rss::before { 139.icon-feed::before {
140 content: "\e808"; 140 content: "\e808";
141} 141}
142 142
diff --git a/app/Resources/static/themes/material/css/cards.scss b/app/Resources/static/themes/material/css/cards.scss
index 0cdc7457..9ae1be82 100644
--- a/app/Resources/static/themes/material/css/cards.scss
+++ b/app/Resources/static/themes/material/css/cards.scss
@@ -197,6 +197,17 @@ a.original:not(.waves-effect) {
197 flex-grow: 1; 197 flex-grow: 1;
198} 198}
199 199
200.card-tag-form {
201 display: flex;
202 min-width: 100px;
203 flex-grow: 1;
204}
205
206.card-tag-form input {
207 margin-bottom: 0;
208 height: 2rem;
209}
210
200.card-tag-rss { 211.card-tag-rss {
201 display: flex; 212 display: flex;
202} 213}
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js
index 96310d81..2926cad1 100755
--- a/app/Resources/static/themes/material/index.js
+++ b/app/Resources/static/themes/material/index.js
@@ -8,7 +8,7 @@ import 'materialize-css/dist/js/materialize';
8import '../_global/index'; 8import '../_global/index';
9 9
10/* Tools */ 10/* Tools */
11import { initExport, initFilters } from './js/tools'; 11import { initExport, initFilters, initRandom } from './js/tools';
12 12
13/* Import shortcuts */ 13/* Import shortcuts */
14import './js/shortcuts/main'; 14import './js/shortcuts/main';
@@ -32,8 +32,10 @@ $(document).ready(() => {
32 format: 'dd/mm/yyyy', 32 format: 'dd/mm/yyyy',
33 container: 'body', 33 container: 'body',
34 }); 34 });
35
35 initFilters(); 36 initFilters();
36 initExport(); 37 initExport();
38 initRandom();
37 39
38 const toggleNav = (toShow, toFocus) => { 40 const toggleNav = (toShow, toFocus) => {
39 $('.nav-panel-actions').hide(100); 41 $('.nav-panel-actions').hide(100);
@@ -48,25 +50,30 @@ $(document).ready(() => {
48 $('#tag_label').focus(); 50 $('#tag_label').focus();
49 return false; 51 return false;
50 }); 52 });
53
51 $('#nav-btn-add').on('click', () => { 54 $('#nav-btn-add').on('click', () => {
52 toggleNav('.nav-panel-add', '#entry_url'); 55 toggleNav('.nav-panel-add', '#entry_url');
53 return false; 56 return false;
54 }); 57 });
58
55 const materialAddForm = $('.nav-panel-add'); 59 const materialAddForm = $('.nav-panel-add');
56 materialAddForm.on('submit', () => { 60 materialAddForm.on('submit', () => {
57 materialAddForm.addClass('disabled'); 61 materialAddForm.addClass('disabled');
58 $('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur'); 62 $('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur');
59 }); 63 });
64
60 $('#nav-btn-search').on('click', () => { 65 $('#nav-btn-search').on('click', () => {
61 toggleNav('.nav-panel-search', '#search_entry_term'); 66 toggleNav('.nav-panel-search', '#search_entry_term');
62 return false; 67 return false;
63 }); 68 });
69
64 $('.close').on('click', (e) => { 70 $('.close').on('click', (e) => {
65 $(e.target).parent('.nav-panel-item').hide(100); 71 $(e.target).parent('.nav-panel-item').hide(100);
66 $('.nav-panel-actions').show(100); 72 $('.nav-panel-actions').show(100);
67 $('.nav-panels').css('background', 'transparent'); 73 $('.nav-panels').css('background', 'transparent');
68 return false; 74 return false;
69 }); 75 });
76
70 $(window).scroll(() => { 77 $(window).scroll(() => {
71 const s = $(window).scrollTop(); 78 const s = $(window).scrollTop();
72 const d = $(document).height(); 79 const d = $(document).height();
diff --git a/app/Resources/static/themes/material/js/tools.js b/app/Resources/static/themes/material/js/tools.js
index 39398fd8..0b3d3038 100644
--- a/app/Resources/static/themes/material/js/tools.js
+++ b/app/Resources/static/themes/material/js/tools.js
@@ -8,6 +8,7 @@ function initFilters() {
8 $('#clear_form_filters').on('click', () => { 8 $('#clear_form_filters').on('click', () => {
9 $('#filters input').val(''); 9 $('#filters input').val('');
10 $('#filters :checked').removeAttr('checked'); 10 $('#filters :checked').removeAttr('checked');
11
11 return false; 12 return false;
12 }); 13 });
13 } 14 }
@@ -21,4 +22,15 @@ function initExport() {
21 } 22 }
22} 23}
23 24
24export { initExport, initFilters }; 25function initRandom() {
26 // no display if export (ie: entries) not available
27 if ($('div').is('#export')) {
28 $('#button_random').show();
29 }
30}
31
32export {
33 initExport,
34 initFilters,
35 initRandom,
36};
diff --git a/app/autoload.php b/app/autoload.php
deleted file mode 100644
index c5f664dc..00000000
--- a/app/autoload.php
+++ /dev/null
@@ -1,13 +0,0 @@
1<?php
2
3use Composer\Autoload\ClassLoader;
4use Doctrine\Common\Annotations\AnnotationRegistry;
5
6/**
7 * @var ClassLoader
8 */
9$loader = require __DIR__ . '/../vendor/autoload.php';
10
11AnnotationRegistry::registerLoader([$loader, 'loadClass']);
12
13return $loader;
diff --git a/app/config/config.yml b/app/config/config.yml
index 8bef8312..078f277a 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -46,7 +46,6 @@ twig:
46doctrine: 46doctrine:
47 dbal: 47 dbal:
48 driver: "%database_driver%" 48 driver: "%database_driver%"
49 driver_class: "%database_driver_class%"
50 host: "%database_host%" 49 host: "%database_host%"
51 port: "%database_port%" 50 port: "%database_port%"
52 dbname: "%database_name%" 51 dbname: "%database_name%"
@@ -55,7 +54,6 @@ doctrine:
55 charset: "%database_charset%" 54 charset: "%database_charset%"
56 path: "%database_path%" 55 path: "%database_path%"
57 unix_socket: "%database_socket%" 56 unix_socket: "%database_socket%"
58 server_version: 5.6
59 57
60 orm: 58 orm:
61 auto_generate_proxy_classes: "%kernel.debug%" 59 auto_generate_proxy_classes: "%kernel.debug%"
@@ -79,10 +77,13 @@ doctrine_migrations:
79 77
80# Swiftmailer Configuration 78# Swiftmailer Configuration
81swiftmailer: 79swiftmailer:
82 transport: "%mailer_transport%" 80 transport: "%mailer_transport%"
83 host: "%mailer_host%" 81 username: "%mailer_user%"
84 username: "%mailer_user%" 82 password: "%mailer_password%"
85 password: "%mailer_password%" 83 host: "%mailer_host%"
84 port: "%mailer_port%"
85 encryption: "%mailer_encryption%"
86 auth_mode: "%mailer_auth_mode%"
86 spool: 87 spool:
87 type: memory 88 type: memory
88 89
@@ -197,10 +198,17 @@ fos_oauth_server:
197 refresh_token_lifetime: 1209600 198 refresh_token_lifetime: 1209600
198 199
199scheb_two_factor: 200scheb_two_factor:
200 trusted_computer: 201 trusted_device:
201 enabled: true 202 enabled: true
202 cookie_name: wllbg_trusted_computer 203 cookie_name: wllbg_trusted_computer
203 cookie_lifetime: 2592000 204 lifetime: 2592000
205
206 backup_codes:
207 enabled: "%twofactor_auth%"
208
209 google:
210 enabled: "%twofactor_auth%"
211 template: WallabagUserBundle:Authentication:form.html.twig
204 212
205 email: 213 email:
206 enabled: "%twofactor_auth%" 214 enabled: "%twofactor_auth%"
@@ -357,3 +365,8 @@ jms_serializer:
357 # see: https://github.com/schmittjoh/JMSSerializerBundle/pull/494 365 # see: https://github.com/schmittjoh/JMSSerializerBundle/pull/494
358 datetime: 366 datetime:
359 default_format: "Y-m-d\\TH:i:sO" # ATOM 367 default_format: "Y-m-d\\TH:i:sO" # ATOM
368
369# see https://github.com/symfony/symfony-standard/pull/1133
370sensio_framework_extra:
371 router:
372 annotations: false
diff --git a/app/config/config_test.yml b/app/config/config_test.yml
index fc067ff4..216f8431 100644
--- a/app/config/config_test.yml
+++ b/app/config/config_test.yml
@@ -1,6 +1,7 @@
1imports: 1imports:
2 - { resource: config_dev.yml } 2 - { resource: config_dev.yml }
3 - { resource: parameters_test.yml } 3 - { resource: parameters_test.yml }
4 - { resource: services_test.yml }
4 5
5framework: 6framework:
6 test: ~ 7 test: ~
@@ -23,7 +24,6 @@ swiftmailer:
23doctrine: 24doctrine:
24 dbal: 25 dbal:
25 driver: "%test_database_driver%" 26 driver: "%test_database_driver%"
26 driver_class: "%test_database_driver_class%"
27 host: "%test_database_host%" 27 host: "%test_database_host%"
28 port: "%test_database_port%" 28 port: "%test_database_port%"
29 dbname: "%test_database_name%" 29 dbname: "%test_database_name%"
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index 6b0cb8e8..13e2584f 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -11,8 +11,6 @@ parameters:
11 # database_password: %env.database_password% 11 # database_password: %env.database_password%
12 12
13 database_driver: pdo_mysql 13 database_driver: pdo_mysql
14 database_driver_class: ~
15 # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
16 database_host: 127.0.0.1 14 database_host: 127.0.0.1
17 database_port: ~ 15 database_port: ~
18 database_name: wallabag 16 database_name: wallabag
@@ -27,10 +25,13 @@ parameters:
27 25
28 domain_name: https://your-wallabag-url-instance.com 26 domain_name: https://your-wallabag-url-instance.com
29 27
30 mailer_transport: smtp 28 mailer_transport: smtp
31 mailer_host: 127.0.0.1 29 mailer_user: ~
32 mailer_user: ~ 30 mailer_password: ~
33 mailer_password: ~ 31 mailer_host: 127.0.0.1
32 mailer_port: false
33 mailer_encryption: ~
34 mailer_auth_mode: ~
34 35
35 locale: en 36 locale: en
36 37
diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml
index 64e51976..257d2ace 100644
--- a/app/config/parameters_test.yml
+++ b/app/config/parameters_test.yml
@@ -8,4 +8,3 @@ parameters:
8 test_database_path: "%env(TEST_DATABASE_PATH)%" 8 test_database_path: "%env(TEST_DATABASE_PATH)%"
9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" 9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
10 test_database_charset: utf8 10 test_database_charset: utf8
11 test_database_driver_class: ~
diff --git a/app/config/routing.yml b/app/config/routing.yml
index 0bd2d130..d4defca0 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -51,3 +51,47 @@ craue_config_settings_modify:
51 51
52fos_js_routing: 52fos_js_routing:
53 resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml" 53 resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
54
552fa_login:
56 path: /2fa
57 defaults:
58 _controller: "scheb_two_factor.form_controller:form"
59
602fa_login_check:
61 path: /2fa_check
62
63# redirect RSS feed to Atom
64rss_to_atom_unread:
65 path: /{username}/{token}/unread.xml
66 defaults:
67 _controller: FrameworkBundle:Redirect:redirect
68 route: unread_feed
69 permanent: true
70
71rss_to_atom_archive:
72 path: /{username}/{token}/archive.xml
73 defaults:
74 _controller: FrameworkBundle:Redirect:redirect
75 route: archive_feed
76 permanent: true
77
78rss_to_atom_starred:
79 path: /{username}/{token}/starred.xml
80 defaults:
81 _controller: FrameworkBundle:Redirect:redirect
82 route: starred_feed
83 permanent: true
84
85rss_to_atom_all:
86 path: /{username}/{token}/all.xml
87 defaults:
88 _controller: FrameworkBundle:Redirect:redirect
89 route: all_feed
90 permanent: true
91
92rss_to_atom_tags:
93 path: /{username}/{token}/tags/{slug}.xml
94 defaults:
95 _controller: FrameworkBundle:Redirect:redirect
96 route: tag_feed
97 permanent: true
diff --git a/app/config/security.yml b/app/config/security.yml
index 02afc9ea..760b2550 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -31,12 +31,15 @@ security:
31 fos_oauth: true 31 fos_oauth: true
32 stateless: true 32 stateless: true
33 anonymous: true 33 anonymous: true
34 provider: fos_userbundle
34 35
35 login_firewall: 36 login_firewall:
37 logout_on_user_change: true
36 pattern: ^/login$ 38 pattern: ^/login$
37 anonymous: ~ 39 anonymous: ~
38 40
39 secured_area: 41 secured_area:
42 logout_on_user_change: true
40 pattern: ^/ 43 pattern: ^/
41 form_login: 44 form_login:
42 provider: fos_userbundle 45 provider: fos_userbundle
@@ -53,17 +56,27 @@ security:
53 path: /logout 56 path: /logout
54 target: / 57 target: /
55 58
59 two_factor:
60 provider: fos_userbundle
61 auth_form_path: 2fa_login
62 check_path: 2fa_login_check
63
56 access_control: 64 access_control:
57 - { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY } 65 - { path: ^/api/(doc|version|info|user), roles: IS_AUTHENTICATED_ANONYMOUSLY }
58 - { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY }
59 - { path: ^/api/user, roles: IS_AUTHENTICATED_ANONYMOUSLY }
60 - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } 66 - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
67 # force role for logout otherwise when 2fa enable, you won't be able to logout
68 # https://github.com/scheb/two-factor-bundle/issues/168#issuecomment-430822478
69 - { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
61 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 70 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
62 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 71 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
63 - { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 72 - { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
73 - { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
64 - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 74 - { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
75 - { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY }
76 - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
65 - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY } 77 - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
66 - { path: ^/settings, roles: ROLE_SUPER_ADMIN } 78 - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
67 - { path: ^/annotations, roles: ROLE_USER } 79 - { path: ^/annotations, roles: ROLE_USER }
80 - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS }
68 - { path: ^/users, roles: ROLE_SUPER_ADMIN } 81 - { path: ^/users, roles: ROLE_SUPER_ADMIN }
69 - { path: ^/, roles: ROLE_USER } 82 - { path: ^/, roles: ROLE_USER }
diff --git a/app/config/services.yml b/app/config/services.yml
index 7b85d846..25bbe5dc 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -2,12 +2,6 @@ parameters:
2 lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber 2 lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
3 3
4services: 4services:
5 # used for tests
6 filesystem_cache:
7 class: Doctrine\Common\Cache\FilesystemCache
8 arguments:
9 - "%kernel.cache_dir%/doctrine/metadata"
10
11 twig.extension.text: 5 twig.extension.text:
12 class: Twig_Extensions_Extension_Text 6 class: Twig_Extensions_Extension_Text
13 tags: 7 tags:
diff --git a/app/config/services_test.yml b/app/config/services_test.yml
new file mode 100644
index 00000000..1b3aff63
--- /dev/null
+++ b/app/config/services_test.yml
@@ -0,0 +1,38 @@
1services:
2 # see https://github.com/symfony/symfony/issues/24543
3 fos_user.user_manager.test:
4 alias: fos_user.user_manager
5 public: true
6
7 fos_user.security.login_manager.test:
8 alias: fos_user.security.login_manager
9 public: true
10
11 wallabag_core.entry_repository.test:
12 alias: wallabag_core.entry_repository
13 public: true
14
15 wallabag_user.user_repository.test:
16 alias: wallabag_user.user_repository
17 public: true
18
19 filesystem_cache:
20 class: Doctrine\Common\Cache\FilesystemCache
21 arguments:
22 - "%kernel.cache_dir%/doctrine/metadata"
23
24 # fixtures
25 Wallabag\UserBundle\DataFixtures\:
26 resource: '../../src/Wallabag/UserBundle/DataFixtures/*'
27 tags: ['doctrine.fixture.orm']
28 autowire: true
29
30 Wallabag\CoreBundle\DataFixtures\:
31 resource: '../../src/Wallabag/CoreBundle/DataFixtures/*'
32 tags: ['doctrine.fixture.orm']
33 autowire: true
34
35 Wallabag\AnnotationBundle\DataFixtures\:
36 resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*'
37 tags: ['doctrine.fixture.orm']
38 autowire: true
diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml
index 0b7b82eb..36b227fb 100644
--- a/app/config/tests/parameters_test.mysql.yml
+++ b/app/config/tests/parameters_test.mysql.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_mysql 2 test_database_driver: pdo_mysql
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 3306 4 test_database_port: 3306
6 test_database_name: wallabag_test 5 test_database_name: wallabag_test
diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml
index ea249324..60f51df6 100644
--- a/app/config/tests/parameters_test.pgsql.yml
+++ b/app/config/tests/parameters_test.pgsql.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_pgsql 2 test_database_driver: pdo_pgsql
3 test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: wallabag_test 5 test_database_name: wallabag_test
diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml
index 64cd984b..2b92d579 100644
--- a/app/config/tests/parameters_test.sqlite.yml
+++ b/app/config/tests/parameters_test.sqlite.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_sqlite 2 test_database_driver: pdo_sqlite
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: ~ 5 test_database_name: ~