Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] feat(theming): allow to disable standalone windows #50687

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/theming/lib/Controller/ThemingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public function getManifest(string $app): JSONResponse {
'sizes' => '16x16'
]
],
'display' => 'standalone'
'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser'
];
$response = new JSONResponse($responseJS);
$response->cacheFor(3600);
Expand Down
17 changes: 15 additions & 2 deletions apps/theming/tests/Controller/ThemingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,15 @@ public function testGetLoginBackground() {
@$this->assertEquals($expected, $this->themingController->getImage('background'));
}

public function testGetManifest() {
public static function dataGetManifest(): array {
return [
[true],
[false],
];
}

/** @dataProvider dataGetManifest */
public function testGetManifest(bool $standalone) {
$this->config
->expects($this->once())
->method('getAppValue')
Expand All @@ -729,6 +737,11 @@ public function testGetManifest() {
'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',
Expand All @@ -745,7 +758,7 @@ public function testGetManifest() {
'sizes' => '16x16'
]
],
'display' => 'standalone',
'display' => $standalone ? 'standalone' : 'browser',
'short_name' => 'Nextcloud',
'theme_color' => null,
'background_color' => null,
Expand Down
8 changes: 8 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,14 @@
*/
'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
Expand Down
Loading