Merge pull request #50684 from nextcloud/backport/50666/stable27

[stable27] feat(theming): allow to disable standalone windows
This commit is contained in:
Andy Scherzinger 2025-02-07 19:41:22 +01:00 committed by GitHub
commit 48667779cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 3 deletions

View file

@ -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);

View file

@ -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,

View file

@ -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