Skip to content

Commit 9fffdf2

Browse files
Merge pull request #50666 from nextcloud/enh/noid/allow-disable-pwas
feat(theming): allow to disable standalone windows
2 parents d05b5e3 + 0bd624d commit 9fffdf2

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
@@ -481,7 +481,7 @@ public function getManifest(string $app): JSONResponse {
481481
'sizes' => '16x16'
482482
]
483483
],
484-
'display' => 'standalone'
484+
'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
485485
];
486486
$response = new JSONResponse($responseJS);
487487
$response->cacheFor(3600);

apps/theming/tests/Controller/ThemingControllerTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,15 @@ public function testGetLoginBackground(): void {
713713
@$this->assertEquals($expected, $this->themingController->getImage('background'));
714714
}
715715

716-
public function testGetManifest(): void {
716+
public static function dataGetManifest(): array {
717+
return [
718+
[true],
719+
[false],
720+
];
721+
}
722+
723+
/** @dataProvider dataGetManifest */
724+
public function testGetManifest(bool $standalone): void {
717725
$this->config
718726
->expects($this->once())
719727
->method('getAppValue')
@@ -734,6 +742,11 @@ public function testGetManifest(): void {
734742
['theming.Icon.getTouchIcon', ['app' => 'core'], 'touchicon'],
735743
['theming.Icon.getFavicon', ['app' => 'core'], 'favicon'],
736744
]);
745+
$this->config
746+
->expects($this->once())
747+
->method('getSystemValueBool')
748+
->with('theming.standalone_window.enabled', true)
749+
->willReturn($standalone);
737750
$response = new JSONResponse([
738751
'name' => 'Nextcloud',
739752
'start_url' => 'localhost',
@@ -750,7 +763,7 @@ public function testGetManifest(): void {
750763
'sizes' => '16x16'
751764
]
752765
],
753-
'display' => 'standalone',
766+
'display' => $standalone ? 'standalone' : 'browser',
754767
'short_name' => 'Nextcloud',
755768
'theme_color' => null,
756769
'background_color' => null,

config/config.sample.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,14 @@
21292129
*/
21302130
'enforce_theme' => '',
21312131

2132+
2133+
/**
2134+
* This setting allows to disable the PWA functionality that allows browsers to open web applications in dedicated windows.
2135+
*
2136+
* Defaults to ``true``
2137+
*/
2138+
'theming.standalone_window.enabled' => true,
2139+
21322140
/**
21332141
* The default cipher for encrypting files. Currently supported are:
21342142
* - AES-256-CTR

0 commit comments

Comments
 (0)