Skip to content

Commit 841bb61

Browse files
szaimenhamza221
authored andcommitted
feat(theming): allow to disable standalone windows
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>
1 parent 96937af commit 841bb61

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

apps/theming/lib/Controller/ThemingController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public function getManifest(string $app): JSONResponse {
508508
'sizes' => '16x16'
509509
]
510510
],
511-
'display' => 'standalone'
511+
'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
512512
];
513513
$response = new JSONResponse($responseJS);
514514
$response->cacheFor(3600);

apps/theming/tests/Controller/ThemingControllerTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,15 @@ public function testGetLoginBackground() {
745745
@$this->assertEquals($expected, $this->themingController->getImage('background'));
746746
}
747747

748-
public function testGetManifest() {
748+
public static function dataGetManifest(): array {
749+
return [
750+
[true],
751+
[false],
752+
];
753+
}
754+
755+
/** @dataProvider dataGetManifest */
756+
public function testGetManifest(bool $standalone) {
749757
$this->config
750758
->expects($this->once())
751759
->method('getAppValue')
@@ -769,6 +777,11 @@ public function testGetManifest() {
769777
'touchicon',
770778
'favicon',
771779
);
780+
$this->config
781+
->expects($this->once())
782+
->method('getSystemValueBool')
783+
->with('theming.standalone_window.enabled', true)
784+
->willReturn($standalone);
772785
$response = new Http\JSONResponse([
773786
'name' => 'Nextcloud',
774787
'start_url' => 'localhost',
@@ -785,7 +798,7 @@ public function testGetManifest() {
785798
'sizes' => '16x16'
786799
]
787800
],
788-
'display' => 'standalone',
801+
'display' => $standalone ? 'standalone' : 'browser',
789802
'short_name' => 'Nextcloud',
790803
'theme_color' => null,
791804
'background_color' => null,

config/config.sample.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,14 @@
20132013
*/
20142014
'enforce_theme' => '',
20152015

2016+
2017+
/**
2018+
* This setting allows to disable the PWA functionality that allows browsers to open web applications in dedicated windows.
2019+
*
2020+
* Defaults to ``true``
2021+
*/
2022+
'theming.standalone_window.enabled' => true,
2023+
20162024
/**
20172025
* The default cipher for encrypting files. Currently supported are:
20182026
* - AES-256-CTR

0 commit comments

Comments
 (0)