Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorszaimen <szaimen@e.mail.de>2021-08-16 22:39:55 +0300
committerszaimen <szaimen@e.mail.de>2021-08-24 12:42:04 +0300
commit0758e0258d5adfccdb7b71ef61916fb939a7bf48 (patch)
tree1ee0fcbe406a8c7087c5befb980916a07f71fe07
parent4f0101837a5a52de3673b16b0d1e472c520ac26c (diff)
improve webmanifest
Signed-off-by: szaimen <szaimen@e.mail.de>
-rw-r--r--apps/theming/lib/Controller/ThemingController.php24
-rw-r--r--apps/theming/lib/ThemingDefaults.php2
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php6
3 files changed, 28 insertions, 4 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 1638f5bd957..270181e42d2 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -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' =>
[
[
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index ee0ad85cd06..1f44c237182 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -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]);
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index d07444f7c77..639574a5270 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -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'));