mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #28459 from nextcloud/enh/noid/improve-webmanifest-2
Allow to open any app in a standalone window
This commit is contained in:
commit
48b3a6bcdb
3 changed files with 28 additions and 4 deletions
|
|
@ -372,9 +372,29 @@ class ThemingController extends Controller {
|
|||
*/
|
||||
public function getManifest($app) {
|
||||
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
if ($app === 'core' || $app === 'settings') {
|
||||
$name = $this->themingDefaults->getName();
|
||||
$shortName = $this->themingDefaults->getName();
|
||||
$startUrl = $this->urlGenerator->getBaseUrl();
|
||||
$description = $this->themingDefaults->getSlogan();
|
||||
} else {
|
||||
$info = $this->appManager->getAppInfo($app);
|
||||
$name = $info['name'] . ' - ' . $this->themingDefaults->getName();
|
||||
$shortName = $info['name'];
|
||||
if (strpos($this->request->getRequestUri(), '/index.php/') !== false) {
|
||||
$startUrl = $this->urlGenerator->getBaseUrl() . '/index.php/apps/' . $app . '/';
|
||||
} else {
|
||||
$startUrl = $this->urlGenerator->getBaseUrl() . '/apps/' . $app . '/';
|
||||
}
|
||||
$description = $info['summary'];
|
||||
}
|
||||
$responseJS = [
|
||||
'name' => $this->themingDefaults->getName(),
|
||||
'start_url' => $this->urlGenerator->getBaseUrl(),
|
||||
'name' => $name,
|
||||
'short_name' => $shortName,
|
||||
'start_url' => $startUrl,
|
||||
'theme_color' => $this->themingDefaults->getColorPrimary(),
|
||||
'background_color' => $this->themingDefaults->getColorPrimary(),
|
||||
'description' => $description,
|
||||
'icons' =>
|
||||
[
|
||||
[
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
}
|
||||
} catch (AppPathNotFoundException $e) {
|
||||
}
|
||||
$route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest');
|
||||
$route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest', ['app' => $app ]);
|
||||
}
|
||||
if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image)) {
|
||||
$route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]);
|
||||
|
|
|
|||
|
|
@ -823,7 +823,11 @@ class ThemingControllerTest extends TestCase {
|
|||
'sizes' => '16x16'
|
||||
]
|
||||
],
|
||||
'display' => 'standalone'
|
||||
'display' => 'standalone',
|
||||
'short_name' => 'Nextcloud',
|
||||
'theme_color' => null,
|
||||
'background_color' => null,
|
||||
'description' => null
|
||||
]);
|
||||
$response->cacheFor(3600);
|
||||
$this->assertEquals($response, $this->themingController->getManifest('core'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue