From e858944de794a2ead351f04648b0328c4f6eb44b Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 19 Jul 2024 13:36:33 +0300 Subject: [PATCH] fix session restore --- src/Entity/Browser/Container/Page.php | 9 +++++++++ src/Entity/Browser/Container/Tab.php | 18 ++++++++++++++++-- src/Entity/Browser/Menu/Tab/Add.php | 5 ++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/Entity/Browser/Container/Page.php b/src/Entity/Browser/Container/Page.php index ca1fef56..bf9e74d0 100644 --- a/src/Entity/Browser/Container/Page.php +++ b/src/Entity/Browser/Container/Page.php @@ -94,6 +94,15 @@ class Page $this->content->refresh(); } + public function init( + ?string $request = null + ): void + { + $this->navbar->request->setValue( + $request + ); + } + public function open( ?string $request = null, bool $history = true diff --git a/src/Entity/Browser/Container/Tab.php b/src/Entity/Browser/Container/Tab.php index 3c2f94e5..d26d456d 100644 --- a/src/Entity/Browser/Container/Tab.php +++ b/src/Entity/Browser/Container/Tab.php @@ -37,7 +37,13 @@ class Tab foreach ($this->container->browser->database->getSession() as $session) { $this->appendPage( - $session->request + $session->request, + boolval( // open + parse_url( + $session->request, + PHP_URL_SCHEME + ) + ) ); } @@ -105,6 +111,7 @@ class Tab public function appendPage( ?string $request = null, + bool $open = true, bool $focus = true ): void { @@ -124,13 +131,20 @@ class Tab $this->_reorderable ); - if ($request) + if ($open) { $page->open( $request ); } + else + { + $page->init( + $request + ); + } + if ($focus) { // Focus on appended tab diff --git a/src/Entity/Browser/Menu/Tab/Add.php b/src/Entity/Browser/Menu/Tab/Add.php index d4a16fa8..68f89895 100644 --- a/src/Entity/Browser/Menu/Tab/Add.php +++ b/src/Entity/Browser/Menu/Tab/Add.php @@ -33,7 +33,10 @@ class Add 'activate', function() { - $this->tab->menu->browser->container->tab->appendPage(); + $this->tab->menu->browser->container->tab->appendPage( + null, + false + ); } ); }