From 485b168a9677d160b0c0426e4f282b9bd0c632c1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Sun, 26 Jan 2020 11:15:15 +0100 Subject: Process picwall rendering through Slim controller + UT --- application/container/ContainerBuilder.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index e2c78ccc..99c12334 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -7,6 +7,7 @@ namespace Shaarli\Container; use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; +use Shaarli\Formatter\FormatterFactory; use Shaarli\History; use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageBuilder; @@ -76,6 +77,10 @@ class ContainerBuilder return new PluginManager($container->conf); }; + $container['formatterFactory'] = function (ShaarliContainer $container): FormatterFactory { + return new FormatterFactory($container->conf, $container->loginManager->isLoggedIn()); + }; + return $container; } } -- cgit v1.2.3 From 8e47af2b3620c920116ec056173277c039163ec1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Thu, 23 Jan 2020 21:52:03 +0100 Subject: Process logout through Slim controller --- application/container/ContainerBuilder.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 99c12334..c5c4a2c3 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -11,6 +11,7 @@ use Shaarli\Formatter\FormatterFactory; use Shaarli\History; use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageBuilder; +use Shaarli\Render\PageCacheManager; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; @@ -34,19 +35,30 @@ class ContainerBuilder /** @var LoginManager */ protected $login; - public function __construct(ConfigManager $conf, SessionManager $session, LoginManager $login) - { + /** @var string */ + protected $webPath; + + public function __construct( + ConfigManager $conf, + SessionManager $session, + LoginManager $login, + string $webPath + ) { $this->conf = $conf; $this->session = $session; $this->login = $login; + $this->webPath = $webPath; } public function build(): ShaarliContainer { $container = new ShaarliContainer(); + $container['conf'] = $this->conf; $container['sessionManager'] = $this->session; $container['loginManager'] = $this->login; + $container['webPath'] = $this->webPath; + $container['plugins'] = function (ShaarliContainer $container): PluginManager { return new PluginManager($container->conf); }; @@ -81,6 +93,10 @@ class ContainerBuilder return new FormatterFactory($container->conf, $container->loginManager->isLoggedIn()); }; + $container['pageCacheManager'] = function (ShaarliContainer $container): PageCacheManager { + return new PageCacheManager($container->conf->get('resource.page_cache')); + }; + return $container; } } -- cgit v1.2.3 From c4d5be53c2ae503c00da3cfe6b28d0ce9d2ca7f5 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Sun, 17 May 2020 14:16:32 +0200 Subject: Process Daily RSS feed through Slim controller The daily RSS template has been entirely rewritten to handle the whole feed through the template engine. --- application/container/ContainerBuilder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index c5c4a2c3..199f3f67 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -94,7 +94,10 @@ class ContainerBuilder }; $container['pageCacheManager'] = function (ShaarliContainer $container): PageCacheManager { - return new PageCacheManager($container->conf->get('resource.page_cache')); + return new PageCacheManager( + $container->conf->get('resource.page_cache'), + $container->loginManager->isLoggedIn() + ); }; return $container; -- cgit v1.2.3 From 7b2ba6ef820335df682fbe3dcfaceef3a62cf4a5 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Mon, 18 May 2020 17:17:36 +0200 Subject: RSS/ATOM feeds: process through Slim controller --- application/container/ContainerBuilder.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 199f3f67..84406979 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -7,6 +7,7 @@ namespace Shaarli\Container; use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; +use Shaarli\Feed\FeedBuilder; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; use Shaarli\Plugin\PluginManager; @@ -100,6 +101,15 @@ class ContainerBuilder ); }; + $container['feedBuilder'] = function (ShaarliContainer $container): FeedBuilder { + return new FeedBuilder( + $container->bookmarkService, + $container->formatterFactory->getFormatter(), + $container->environment, + $container->loginManager->isLoggedIn() + ); + }; + return $container; } } -- cgit v1.2.3 From c22fa57a5505fe95fd01860e3d3dfbb089f869cd Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Sat, 6 Jun 2020 14:01:03 +0200 Subject: Handle shaare creation/edition/deletion through Slim controllers --- application/container/ContainerBuilder.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 84406979..85126246 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -10,11 +10,13 @@ use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; +use Shaarli\Http\HttpAccess; use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageBuilder; use Shaarli\Render\PageCacheManager; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; +use Shaarli\Thumbnailer; /** * Class ContainerBuilder @@ -110,6 +112,14 @@ class ContainerBuilder ); }; + $container['thumbnailer'] = function (ShaarliContainer $container): Thumbnailer { + return new Thumbnailer($container->conf); + }; + + $container['httpAccess'] = function (): HttpAccess { + return new HttpAccess(); + }; + return $container; } } -- cgit v1.2.3 From 9c75f877935fa6adec951a4d8d32b328aaab314f Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Sat, 13 Jun 2020 13:08:01 +0200 Subject: Use multi-level routes for existing controllers instead of 1 level everywhere Also prefix most admin routes with /admin/ --- application/container/ContainerBuilder.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 85126246..72a85710 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -38,19 +38,17 @@ class ContainerBuilder /** @var LoginManager */ protected $login; - /** @var string */ - protected $webPath; + /** @var string|null */ + protected $basePath = null; public function __construct( ConfigManager $conf, SessionManager $session, - LoginManager $login, - string $webPath + LoginManager $login ) { $this->conf = $conf; $this->session = $session; $this->login = $login; - $this->webPath = $webPath; } public function build(): ShaarliContainer @@ -60,7 +58,7 @@ class ContainerBuilder $container['conf'] = $this->conf; $container['sessionManager'] = $this->session; $container['loginManager'] = $this->login; - $container['webPath'] = $this->webPath; + $container['basePath'] = $this->basePath; $container['plugins'] = function (ShaarliContainer $container): PluginManager { return new PluginManager($container->conf); -- cgit v1.2.3 From e8a10f312a5c44314292402bb44e6ee2e71f3d5d Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Wed, 17 Jun 2020 15:55:31 +0200 Subject: Use NetscapeBookmarkUtils object instance instead of static calls --- application/container/ContainerBuilder.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 72a85710..a4fd6a0c 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -11,6 +11,7 @@ use Shaarli\Feed\FeedBuilder; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; use Shaarli\Http\HttpAccess; +use Shaarli\Netscape\NetscapeBookmarkUtils; use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageBuilder; use Shaarli\Render\PageCacheManager; @@ -118,6 +119,10 @@ class ContainerBuilder return new HttpAccess(); }; + $container['netscapeBookmarkUtils'] = function (ShaarliContainer $container): NetscapeBookmarkUtils { + return new NetscapeBookmarkUtils($container->bookmarkService, $container->conf, $container->history); + }; + return $container; } } -- cgit v1.2.3 From 1b8620b1ad4e2c647ff2d032c8e7c6687b6647a1 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Sat, 20 Jun 2020 15:14:24 +0200 Subject: Process plugins administration page through Slim controllers --- application/container/ContainerBuilder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index a4fd6a0c..ba91fe8b 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -88,7 +88,12 @@ class ContainerBuilder }; $container['pluginManager'] = function (ShaarliContainer $container): PluginManager { - return new PluginManager($container->conf); + $pluginManager = new PluginManager($container->conf); + + // FIXME! Configuration is already injected + $pluginManager->load($container->conf->get('general.enabled_plugins')); + + return $pluginManager; }; $container['formatterFactory'] = function (ShaarliContainer $container): FormatterFactory { -- cgit v1.2.3 From 1a8ac737e52cb25a5c346232ee398f5908cee7d7 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Mon, 6 Jul 2020 08:04:35 +0200 Subject: Process main page (linklist) through Slim controller Including a bunch of improvements on the container, and helper used across new controllers. --- application/container/ContainerBuilder.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index ba91fe8b..ccb87c3a 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -18,6 +18,8 @@ use Shaarli\Render\PageCacheManager; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; use Shaarli\Thumbnailer; +use Shaarli\Updater\Updater; +use Shaarli\Updater\UpdaterUtils; /** * Class ContainerBuilder @@ -128,6 +130,15 @@ class ContainerBuilder return new NetscapeBookmarkUtils($container->bookmarkService, $container->conf, $container->history); }; + $container['updater'] = function (ShaarliContainer $container): Updater { + return new Updater( + UpdaterUtils::read_updates_file($container->conf->get('resource.updates')), + $container->bookmarkService, + $container->conf, + $container->loginManager->isLoggedIn() + ); + }; + return $container; } } -- cgit v1.2.3 From c4ad3d4f061d05a01db25aa54dda830ba776792d Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur.hoareau@wizacha.com> Date: Tue, 7 Jul 2020 10:15:56 +0200 Subject: Process Shaarli install through Slim controller --- application/container/ContainerBuilder.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index ccb87c3a..593aafb7 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -15,6 +15,7 @@ use Shaarli\Netscape\NetscapeBookmarkUtils; use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageBuilder; use Shaarli\Render\PageCacheManager; +use Shaarli\Security\CookieManager; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; use Shaarli\Thumbnailer; @@ -38,6 +39,9 @@ class ContainerBuilder /** @var SessionManager */ protected $session; + /** @var CookieManager */ + protected $cookieManager; + /** @var LoginManager */ protected $login; @@ -47,11 +51,13 @@ class ContainerBuilder public function __construct( ConfigManager $conf, SessionManager $session, + CookieManager $cookieManager, LoginManager $login ) { $this->conf = $conf; $this->session = $session; $this->login = $login; + $this->cookieManager = $cookieManager; } public function build(): ShaarliContainer @@ -60,6 +66,7 @@ class ContainerBuilder $container['conf'] = $this->conf; $container['sessionManager'] = $this->session; + $container['cookieManager'] = $this->cookieManager; $container['loginManager'] = $this->login; $container['basePath'] = $this->basePath; -- cgit v1.2.3 From 3ee8351e438f13ccf36062ce956e0b4a4d5f4a29 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur.hoareau@wizacha.com> Date: Thu, 23 Jul 2020 16:41:32 +0200 Subject: Multiple small fixes --- application/container/ContainerBuilder.php | 1 - 1 file changed, 1 deletion(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 593aafb7..bfe93501 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -99,7 +99,6 @@ class ContainerBuilder $container['pluginManager'] = function (ShaarliContainer $container): PluginManager { $pluginManager = new PluginManager($container->conf); - // FIXME! Configuration is already injected $pluginManager->load($container->conf->get('general.enabled_plugins')); return $pluginManager; -- cgit v1.2.3 From 301c7ab1a079d937ab41c6f52b8804e5731008e6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Tue, 28 Jul 2020 20:46:11 +0200 Subject: Better support for notes permalink --- application/container/ContainerBuilder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index bfe93501..2e8c1ee3 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -105,7 +105,10 @@ class ContainerBuilder }; $container['formatterFactory'] = function (ShaarliContainer $container): FormatterFactory { - return new FormatterFactory($container->conf, $container->loginManager->isLoggedIn()); + return new FormatterFactory( + $container->conf, + $container->loginManager->isLoggedIn() + ); }; $container['pageCacheManager'] = function (ShaarliContainer $container): PageCacheManager { -- cgit v1.2.3 From 0c6fdbe12bbbb336348666b14b82096f24d5858b Mon Sep 17 00:00:00 2001 From: ArthurHoaro <arthur@hoa.ro> Date: Fri, 21 Aug 2020 10:50:44 +0200 Subject: Move error handling to dedicated controller instead of middleware --- application/container/ContainerBuilder.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'application/container/ContainerBuilder.php') diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 2e8c1ee3..4a1a6ea7 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php @@ -9,6 +9,7 @@ use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; use Shaarli\Formatter\FormatterFactory; +use Shaarli\Front\Controller\Visitor\ErrorController; use Shaarli\History; use Shaarli\Http\HttpAccess; use Shaarli\Netscape\NetscapeBookmarkUtils; @@ -148,6 +149,10 @@ class ContainerBuilder ); }; + $container['errorHandler'] = function (ShaarliContainer $container): ErrorController { + return new ErrorController($container); + }; + return $container; } } -- cgit v1.2.3