diff options
author | Simon L <szaimen@e.mail.de> | 2025-02-05 14:37:08 +0100 |
---|---|---|
committer | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2025-02-07 21:58:26 +0700 |
commit | 79b22a42546147d5384058d98c27348e3f4bef7c (patch) | |
tree | c72f077385e621cd4518db99e730d3f7b61dc1eb | |
parent | 706cb712dc1ffda1ef59e435b45c90e5fb45e151 (diff) | |
download | nextcloud-server-backport/50666/stable29.tar.gz nextcloud-server-backport/50666/stable29.zip |
feat(theming): allow to disable standalone windowsbackport/50666/stable29
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Simon L. <szaimen@e.mail.de>
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 2 | ||||
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 17 | ||||
-rw-r--r-- | config/config.sample.php | 8 |
3 files changed, 24 insertions, 3 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 0dfc4ab9cb1..7e89c16ca97 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -508,7 +508,7 @@ class ThemingController extends Controller { 'sizes' => '16x16' ] ], - 'display' => 'standalone' + 'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser' ]; $response = new JSONResponse($responseJS); $response->cacheFor(3600); diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 481181780b5..25cac1d7f3c 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -745,7 +745,15 @@ class ThemingControllerTest extends TestCase { @$this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetManifest() { + public static function dataGetManifest(): array { + return [ + [true], + [false], + ]; + } + + /** @dataProvider dataGetManifest */ + public function testGetManifest(bool $standalone) { $this->config ->expects($this->once()) ->method('getAppValue') @@ -769,6 +777,11 @@ class ThemingControllerTest extends TestCase { 'touchicon', 'favicon', ); + $this->config + ->expects($this->once()) + ->method('getSystemValueBool') + ->with('theming.standalone_window.enabled', true) + ->willReturn($standalone); $response = new Http\JSONResponse([ 'name' => 'Nextcloud', 'start_url' => 'localhost', @@ -785,7 +798,7 @@ class ThemingControllerTest extends TestCase { 'sizes' => '16x16' ] ], - 'display' => 'standalone', + 'display' => $standalone ? 'standalone' : 'browser', 'short_name' => 'Nextcloud', 'theme_color' => null, 'background_color' => null, diff --git a/config/config.sample.php b/config/config.sample.php index 7422efa7cff..b6f89fcc8a5 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -2013,6 +2013,14 @@ $CONFIG = [ */ 'enforce_theme' => '', + +/** + * This setting allows to disable the PWA functionality that allows browsers to open web applications in dedicated windows. + * + * Defaults to ``true`` + */ +'theming.standalone_window.enabled' => true, + /** * The default cipher for encrypting files. Currently supported are: * - AES-256-CTR |