diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php
index 1b16293a7f34c..53575a52e3a89 100644
--- a/apps/theming/lib/Controller/IconController.php
+++ b/apps/theming/lib/Controller/IconController.php
@@ -31,6 +31,7 @@
use OCA\Theming\IconBuilder;
use OCA\Theming\ImageManager;
use OCA\Theming\ThemingDefaults;
+use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
@@ -49,24 +50,17 @@ class IconController extends Controller {
private $imageManager;
/** @var FileAccessHelper */
private $fileAccessHelper;
+ /** @var IAppManager */
+ private $appManager;
- /**
- * IconController constructor.
- *
- * @param string $appName
- * @param IRequest $request
- * @param ThemingDefaults $themingDefaults
- * @param IconBuilder $iconBuilder
- * @param ImageManager $imageManager
- * @param FileAccessHelper $fileAccessHelper
- */
public function __construct(
$appName,
IRequest $request,
ThemingDefaults $themingDefaults,
IconBuilder $iconBuilder,
ImageManager $imageManager,
- FileAccessHelper $fileAccessHelper
+ FileAccessHelper $fileAccessHelper,
+ IAppManager $appManager
) {
parent::__construct($appName, $request);
@@ -74,6 +68,7 @@ public function __construct(
$this->iconBuilder = $iconBuilder;
$this->imageManager = $imageManager;
$this->fileAccessHelper = $fileAccessHelper;
+ $this->appManager = $appManager;
}
/**
@@ -86,6 +81,11 @@ public function __construct(
* @throws \Exception
*/
public function getThemedIcon(string $app, string $image): Response {
+ if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) {
+ $app = 'core';
+ $image = 'favicon.png';
+ }
+
$color = $this->themingDefaults->getColorPrimary();
try {
$iconFileName = $this->imageManager->getCachedImage('icon-' . $app . '-' . $color . str_replace('/', '_', $image));
@@ -112,6 +112,10 @@ public function getThemedIcon(string $app, string $image): Response {
* @throws \Exception
*/
public function getFavicon(string $app = 'core'): Response {
+ if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) {
+ $app = 'core';
+ }
+
$response = null;
$iconFile = null;
try {
@@ -151,6 +155,10 @@ public function getFavicon(string $app = 'core'): Response {
* @throws \Exception
*/
public function getTouchIcon(string $app = 'core'): Response {
+ if ($app !== 'core' && !$this->appManager->isEnabledForUser($app)) {
+ $app = 'core';
+ }
+
$response = null;
try {
$iconFile = $this->imageManager->getImage('favicon');
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index a323bac180ba9..260dec83947d2 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -386,6 +386,7 @@ public function getThemeStylesheet(string $themeId, bool $plain = false, bool $w
/**
* @NoCSRFRequired
* @PublicPage
+ * @BruteForceProtection(action=manifest)
*
* @return Http\JSONResponse
*/
@@ -397,6 +398,12 @@ public function getManifest($app) {
$startUrl = $this->urlGenerator->getBaseUrl();
$description = $this->themingDefaults->getSlogan();
} else {
+ if (!$this->appManager->isEnabledForUser($app)) {
+ $response = new Http\JSONResponse([], Http::STATUS_NOT_FOUND);
+ $response->throttle(['action' => 'manifest', 'app' => $app]);
+ return $response;
+ }
+
$info = $this->appManager->getAppInfo($app, false, $this->l10n->getLanguageCode());
$name = $info['name'] . ' - ' . $this->themingDefaults->getName();
$shortName = $info['name'];
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php
index 470709a3fab37..d2b52cf738a5b 100644
--- a/apps/theming/tests/Controller/IconControllerTest.php
+++ b/apps/theming/tests/Controller/IconControllerTest.php
@@ -33,6 +33,7 @@
use OCA\Theming\IconBuilder;
use OCA\Theming\ImageManager;
use OCA\Theming\ThemingDefaults;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
@@ -57,6 +58,8 @@ class IconControllerTest extends TestCase {
private $iconBuilder;
/** @var FileAccessHelper|\PHPUnit\Framework\MockObject\MockObject */
private $fileAccessHelper;
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
+ private $appManager;
/** @var ImageManager */
private $imageManager;
@@ -66,6 +69,7 @@ protected function setUp(): void {
$this->iconBuilder = $this->createMock(IconBuilder::class);
$this->imageManager = $this->createMock(ImageManager::class);
$this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
+ $this->appManager = $this->createMock(IAppManager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->timeFactory->expects($this->any())
@@ -80,7 +84,8 @@ protected function setUp(): void {
$this->themingDefaults,
$this->iconBuilder,
$this->imageManager,
- $this->fileAccessHelper
+ $this->fileAccessHelper,
+ $this->appManager,
);
parent::setUp();
diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php
index 69acb6be375ed..5add2bce3ea9e 100644
--- a/core/templates/layout.guest.php
+++ b/core/templates/layout.guest.php
@@ -20,7 +20,7 @@
-
+
diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php
index e5329716cc709..2c55240598c40 100644
--- a/core/templates/layout.public.php
+++ b/core/templates/layout.public.php
@@ -21,7 +21,7 @@
-
+
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 1a55c0ab64d9e..94a21092e1796 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -37,7 +37,7 @@
-
+