Skip to content

Commit e610016

Browse files
szaimenhamza221
authored andcommitted
feat(theming): allow to disable standalone windows
Co-authored-by: Ferdinand Thiessen <[email protected]> Signed-off-by: Simon L. <[email protected]> Signed-off-by: Hamza Mahjoubi <[email protected]>
1 parent 3e93249 commit e610016

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

Diff for: apps/theming/lib/Controller/ThemingController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ public function getManifest(string $app): JSONResponse {
474474
'sizes' => '16x16'
475475
]
476476
],
477-
'display' => 'standalone'
477+
'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
478478
];
479479
$response = new JSONResponse($responseJS);
480480
$response->cacheFor(3600);

Diff for: apps/theming/tests/Controller/ThemingControllerTest.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,15 @@ public function testGetLoginBackground() {
705705
@$this->assertEquals($expected, $this->themingController->getImage('background'));
706706
}
707707

708-
public function testGetManifest() {
708+
public static function dataGetManifest(): array {
709+
return [
710+
[true],
711+
[false],
712+
];
713+
}
714+
715+
/** @dataProvider dataGetManifest */
716+
public function testGetManifest(bool $standalone) {
709717
$this->config
710718
->expects($this->once())
711719
->method('getAppValue')
@@ -729,6 +737,11 @@ public function testGetManifest() {
729737
'touchicon',
730738
'favicon',
731739
);
740+
$this->config
741+
->expects($this->once())
742+
->method('getSystemValueBool')
743+
->with('theming.standalone_window.enabled', true)
744+
->willReturn($standalone);
732745
$response = new Http\JSONResponse([
733746
'name' => 'Nextcloud',
734747
'start_url' => 'localhost',
@@ -745,7 +758,7 @@ public function testGetManifest() {
745758
'sizes' => '16x16'
746759
]
747760
],
748-
'display' => 'standalone',
761+
'display' => $standalone ? 'standalone' : 'browser',
749762
'short_name' => 'Nextcloud',
750763
'theme_color' => null,
751764
'background_color' => null,

Diff for: config/config.sample.php

+8
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,14 @@
20792079
*/
20802080
'enforce_theme' => '',
20812081

2082+
2083+
/**
2084+
* This setting allows to disable the PWA functionality that allows browsers to open web applications in dedicated windows.
2085+
*
2086+
* Defaults to ``true``
2087+
*/
2088+
'theming.standalone_window.enabled' => true,
2089+
20822090
/**
20832091
* The default cipher for encrypting files. Currently supported are:
20842092
* - AES-256-CTR

0 commit comments

Comments
 (0)