Skip to content

Commit 52da2a1

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 7709129 commit 52da2a1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

apps/theming/lib/Controller/ThemingController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public function getManifest($app) {
436436
'sizes' => '16x16'
437437
]
438438
],
439-
'display' => 'standalone'
439+
'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
440440
];
441441
$response = new Http\JSONResponse($responseJS);
442442
$response->cacheFor(3600);

apps/theming/tests/Controller/ThemingControllerTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,15 @@ public function testGetLoginBackground() {
731731
$expected->setContentSecurityPolicy($csp);
732732
@$this->assertEquals($expected, $this->themingController->getImage('background'));
733733
}
734+
public static function dataGetManifest(): array {
735+
return [
736+
[true],
737+
[false],
738+
];
739+
}
734740

735-
public function testGetManifest() {
741+
/** @dataProvider dataGetManifest */
742+
public function testGetManifest(bool $standalone) {
736743
$this->config
737744
->expects($this->once())
738745
->method('getAppValue')
@@ -756,6 +763,11 @@ public function testGetManifest() {
756763
'touchicon',
757764
'favicon',
758765
);
766+
$this->config
767+
->expects($this->once())
768+
->method('getSystemValueBool')
769+
->with('theming.standalone_window.enabled', true)
770+
->willReturn($standalone);
759771
$response = new Http\JSONResponse([
760772
'name' => 'Nextcloud',
761773
'start_url' => 'localhost',
@@ -772,7 +784,7 @@ public function testGetManifest() {
772784
'sizes' => '16x16'
773785
]
774786
],
775-
'display' => 'standalone',
787+
'display' => $standalone ? 'standalone' : 'browser',
776788
'short_name' => 'Nextcloud',
777789
'theme_color' => null,
778790
'background_color' => null,

config/config.sample.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,14 @@
19461946
*/
19471947
'enforce_theme' => '',
19481948

1949+
1950+
/**
1951+
* This setting allows to disable the PWA functionality that allows browsers to open web applications in dedicated windows.
1952+
*
1953+
* Defaults to ``true``
1954+
*/
1955+
'theming.standalone_window.enabled' => true,
1956+
19491957
/**
19501958
* The default cipher for encrypting files. Currently supported are:
19511959
* - AES-256-CTR

0 commit comments

Comments
 (0)