diff options
author | Simon L. <szaimen@e.mail.de> | 2025-02-05 14:37:08 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-02-06 10:46:11 +0000 |
commit | 4cc3c5f0e41c8836af880e9c1f24c301cad3e3e5 (patch) | |
tree | 9e338aebaed3c1f550cd10a83bcbff259e87193b | |
parent | fc71757ef31c2c5380f19e09d45e973eb56624cd (diff) | |
download | nextcloud-server-4cc3c5f0e41c8836af880e9c1f24c301cad3e3e5.tar.gz nextcloud-server-4cc3c5f0e41c8836af880e9c1f24c301cad3e3e5.zip |
feat(theming): allow to disable standalone windowsbackport/50666/stable31
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Simon L. <szaimen@e.mail.de>
-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 983a738ea70..c3f365a11b6 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -481,7 +481,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 3c283fcb697..3957141e87c 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -713,7 +713,15 @@ class ThemingControllerTest extends TestCase { @$this->assertEquals($expected, $this->themingController->getImage('background')); } - public function testGetManifest(): void { + public static function dataGetManifest(): array { + return [ + [true], + [false], + ]; + } + + /** @dataProvider dataGetManifest */ + public function testGetManifest(bool $standalone): void { $this->config ->expects($this->once()) ->method('getAppValue') @@ -734,6 +742,11 @@ class ThemingControllerTest extends TestCase { ['theming.Icon.getTouchIcon', ['app' => 'core'], 'touchicon'], ['theming.Icon.getFavicon', ['app' => 'core'], 'favicon'], ]); + $this->config + ->expects($this->once()) + ->method('getSystemValueBool') + ->with('theming.standalone_window.enabled', true) + ->willReturn($standalone); $response = new JSONResponse([ 'name' => 'Nextcloud', 'start_url' => 'localhost', @@ -750,7 +763,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 f30bd92adbc..bfda1609d75 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -2129,6 +2129,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 |