aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2025-02-05 14:37:08 +0100
committerHamza Mahjoubi <hamzamahjoubi221@gmail.com>2025-02-07 21:19:36 +0700
commit52da2a177bfa4d34c5e993930c5e5163e1681ccc (patch)
tree6033542a2cbc751e0df488eca88413bed59d5fe4
parent770912930fd3b4664b377f8e86fa587516d2292b (diff)
downloadnextcloud-server-backport/50666/stable27.tar.gz
nextcloud-server-backport/50666/stable27.zip
feat(theming): allow to disable standalone windowsbackport/50666/stable27
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>
-rw-r--r--apps/theming/lib/Controller/ThemingController.php2
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php16
-rw-r--r--config/config.sample.php8
3 files changed, 23 insertions, 3 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 260dec83947..77774b6dbbc 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -436,7 +436,7 @@ class ThemingController extends Controller {
'sizes' => '16x16'
]
],
- 'display' => 'standalone'
+ 'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
];
$response = new Http\JSONResponse($responseJS);
$response->cacheFor(3600);
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 4931a148b78..e0d5ab120c1 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -731,8 +731,15 @@ class ThemingControllerTest extends TestCase {
$expected->setContentSecurityPolicy($csp);
@$this->assertEquals($expected, $this->themingController->getImage('background'));
}
+ public static function dataGetManifest(): array {
+ return [
+ [true],
+ [false],
+ ];
+ }
- public function testGetManifest() {
+ /** @dataProvider dataGetManifest */
+ public function testGetManifest(bool $standalone) {
$this->config
->expects($this->once())
->method('getAppValue')
@@ -756,6 +763,11 @@ class ThemingControllerTest extends TestCase {
'touchicon',
'favicon',
);
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValueBool')
+ ->with('theming.standalone_window.enabled', true)
+ ->willReturn($standalone);
$response = new Http\JSONResponse([
'name' => 'Nextcloud',
'start_url' => 'localhost',
@@ -772,7 +784,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 ca52ec677c8..a49f6b01d33 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -1946,6 +1946,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