Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 47f4b85ef0 | |||
| 838dd55536 | |||
| 4e7d43bb5a |
@@ -11,6 +11,7 @@ use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Theming\IDefaults;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\DAV\ServerPlugin;
|
||||
use Sabre\HTTP\RequestInterface;
|
||||
@@ -22,23 +23,17 @@ class AppleProvisioningPlugin extends ServerPlugin {
|
||||
*/
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* @var \OC_Defaults
|
||||
*/
|
||||
protected $themingDefaults;
|
||||
|
||||
/**
|
||||
* AppleProvisioningPlugin constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
protected IUserSession $userSession,
|
||||
protected IURLGenerator $urlGenerator,
|
||||
\OC_Defaults $themingDefaults,
|
||||
protected IDefaults $themingDefaults,
|
||||
protected IRequest $request,
|
||||
protected IL10N $l10n,
|
||||
protected \Closure $uuidClosure,
|
||||
) {
|
||||
$this->themingDefaults = $themingDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ use OCP\Mail\IMailer;
|
||||
use OCP\Security\IHasher;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\Share\IProviderFactory;
|
||||
use OCP\Theming\IDefaults;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
@@ -93,7 +94,7 @@ class CapabilitiesTest extends \Test\TestCase {
|
||||
$this->createMock(IRootFolder::class),
|
||||
$this->createMock(IMailer::class),
|
||||
$this->createMock(IURLGenerator::class),
|
||||
$this->createMock(\OC_Defaults::class),
|
||||
$this->createMock(IDefaults::class),
|
||||
$this->createMock(IEventDispatcher::class),
|
||||
$this->createMock(IUserSession::class),
|
||||
$this->createMock(KnownUserService::class),
|
||||
|
||||
@@ -1,40 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Theming;
|
||||
|
||||
use OCA\Theming\AppInfo\Application;
|
||||
use OCA\Theming\Service\BackgroundService;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\AppFramework\Services\IAppConfig;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
use OCP\IAppConfig;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\ServerVersion;
|
||||
use OCP\Theming\IDefaults;
|
||||
|
||||
class ThemingDefaults extends \OC_Defaults {
|
||||
|
||||
private string $name;
|
||||
private string $title;
|
||||
private string $entity;
|
||||
private string $productName;
|
||||
private string $url;
|
||||
private string $backgroundColor;
|
||||
private string $primaryColor;
|
||||
private string $docBaseUrl;
|
||||
class ThemingDefaults implements IDefaults {
|
||||
private ?\OC_Theme $theme = null;
|
||||
private ?string $defaultSlogan = null;
|
||||
|
||||
private string $iTunesAppId;
|
||||
private string $iOSClientUrl;
|
||||
private string $AndroidClientUrl;
|
||||
private string $FDroidClientUrl;
|
||||
private string $defaultDocVersion;
|
||||
|
||||
/**
|
||||
* ThemingDefaults constructor.
|
||||
@@ -51,45 +50,69 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
private IAppManager $appManager,
|
||||
private INavigationManager $navigationManager,
|
||||
private BackgroundService $backgroundService,
|
||||
ServerVersion $serverVersion,
|
||||
) {
|
||||
parent::__construct();
|
||||
$themeName = $config->getSystemValueString('theme', '');
|
||||
if ($themeName === '') {
|
||||
if (is_dir(\OC::$SERVERROOT . '/themes/default')) {
|
||||
$themeName = 'default';
|
||||
}
|
||||
}
|
||||
$themePath = \OC::$SERVERROOT . '/themes/' . $themeName . '/defaults.php';
|
||||
if (file_exists($themePath)) {
|
||||
// prevent defaults.php from printing output
|
||||
ob_start();
|
||||
require_once $themePath;
|
||||
ob_end_clean();
|
||||
if (class_exists(\OC_Theme::class)) {
|
||||
$this->theme = new \OC_Theme();
|
||||
}
|
||||
}
|
||||
|
||||
$this->name = parent::getName();
|
||||
$this->title = parent::getTitle();
|
||||
$this->entity = parent::getEntity();
|
||||
$this->productName = parent::getProductName();
|
||||
$this->url = parent::getBaseUrl();
|
||||
$this->primaryColor = parent::getColorPrimary();
|
||||
$this->backgroundColor = parent::getColorBackground();
|
||||
$this->iTunesAppId = parent::getiTunesAppId();
|
||||
$this->iOSClientUrl = parent::getiOSClientUrl();
|
||||
$this->AndroidClientUrl = parent::getAndroidClientUrl();
|
||||
$this->FDroidClientUrl = parent::getFDroidClientUrl();
|
||||
$this->docBaseUrl = parent::getDocBaseUrl();
|
||||
$this->iTunesAppId = $this->getFromLegacyTheme(
|
||||
'getiTunesAppId',
|
||||
$config->getSystemValueString('customclient_ios_appid', '1125420102')
|
||||
);
|
||||
$this->iOSClientUrl = $this->getFromLegacyTheme(
|
||||
'getiOSClientUrl',
|
||||
$config->getSystemValueString('customclient_ios', 'https://geo.itunes.apple.com/us/app/nextcloud/id1125420102?mt=8')
|
||||
);
|
||||
$this->AndroidClientUrl = $this->getFromLegacyTheme(
|
||||
'getAndroidClientUrl',
|
||||
$config->getSystemValueString('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client')
|
||||
);
|
||||
$this->FDroidClientUrl = $this->getFromLegacyTheme(
|
||||
'getFDroidClientUrl',
|
||||
$config->getSystemValueString('customclient_fdroid', 'https://f-droid.org/packages/com.nextcloud.client/')
|
||||
);
|
||||
$this->defaultDocVersion = (string)$serverVersion->getMajorVersion(); // used to generate doc links
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return strip_tags($this->config->getAppValue('theming', 'name', $this->name));
|
||||
private function getFromLegacyTheme(string $method, string $default): string {
|
||||
if (isset($this->theme) && method_exists($this->theme, $method)) {
|
||||
return $this->theme->$method();
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
public function getHTMLName() {
|
||||
return $this->config->getAppValue('theming', 'name', $this->name);
|
||||
public function getName(): string {
|
||||
return strip_tags($this->appConfig->getAppValueString('name', $this->getFromLegacyTheme('getName', 'Nextcloud')));
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
return strip_tags($this->config->getAppValue('theming', 'name', $this->title));
|
||||
public function getTitle(): string {
|
||||
return strip_tags($this->appConfig->getAppValueString('name', $this->getFromLegacyTheme('getTitle', 'Nextcloud')));
|
||||
}
|
||||
|
||||
public function getEntity() {
|
||||
return strip_tags($this->config->getAppValue('theming', 'name', $this->entity));
|
||||
public function getEntity(): string {
|
||||
return strip_tags($this->appConfig->getAppValueString('name', $this->getFromLegacyTheme('getEntity', 'Nextcloud')));
|
||||
}
|
||||
|
||||
public function getProductName() {
|
||||
return strip_tags($this->config->getAppValue('theming', 'productName', $this->productName));
|
||||
public function getProductName(): string {
|
||||
return strip_tags($this->appConfig->getAppValueString('productName', $this->getFromLegacyTheme('getProductName', 'Nextcloud')));
|
||||
}
|
||||
|
||||
public function getBaseUrl() {
|
||||
return $this->config->getAppValue('theming', 'url', $this->url);
|
||||
public function getBaseUrl(): string {
|
||||
return $this->appConfig->getAppValueString('url', $this->getFromLegacyTheme('getBaseUrl', 'https://nextcloud.com'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,23 +120,33 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
* @psalm-suppress InvalidReturnStatement
|
||||
* @psalm-suppress InvalidReturnType
|
||||
*/
|
||||
public function getSlogan(?string $lang = null) {
|
||||
return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', parent::getSlogan($lang)));
|
||||
public function getSlogan(?string $lang = null): string {
|
||||
if ($this->appConfig->hasAppKey('slogan')) {
|
||||
return \OCP\Util::sanitizeHTML($this->appConfig->getAppValueString('slogan'));
|
||||
}
|
||||
if (isset($this->theme) && method_exists($this->theme, 'getSlogan')) {
|
||||
return $this->theme->getSlogan($lang);
|
||||
}
|
||||
if ($this->defaultSlogan === null) {
|
||||
$l10n = \OCP\Util::getL10N('lib', $lang);
|
||||
$this->defaultSlogan = $l10n->t('a safe home for all your data');
|
||||
}
|
||||
return $this->defaultSlogan;
|
||||
}
|
||||
|
||||
public function getImprintUrl() {
|
||||
return (string)$this->config->getAppValue('theming', 'imprintUrl', '');
|
||||
public function getImprintUrl(): string {
|
||||
return $this->appConfig->getAppValueString('imprintUrl', '');
|
||||
}
|
||||
|
||||
public function getPrivacyUrl() {
|
||||
return (string)$this->config->getAppValue('theming', 'privacyUrl', '');
|
||||
public function getPrivacyUrl(): string {
|
||||
return $this->appConfig->getAppValueString('privacyUrl', '');
|
||||
}
|
||||
|
||||
public function getDocBaseUrl() {
|
||||
return (string)$this->config->getAppValue('theming', 'docBaseUrl', $this->docBaseUrl);
|
||||
public function getDocBaseUrl(): string {
|
||||
return $this->appConfig->getAppValueString('docBaseUrl', $this->getFromLegacyTheme('getDocBaseUrl', 'https://docs.nextcloud.com'));
|
||||
}
|
||||
|
||||
public function getShortFooter() {
|
||||
public function getShortFooter(): string {
|
||||
$slogan = $this->getSlogan();
|
||||
$baseUrl = $this->getBaseUrl();
|
||||
$entity = $this->getEntity();
|
||||
@@ -132,11 +165,11 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
$links = [
|
||||
[
|
||||
'text' => $this->l->t('Legal notice'),
|
||||
'url' => (string)$this->getImprintUrl()
|
||||
'url' => $this->getImprintUrl()
|
||||
],
|
||||
[
|
||||
'text' => $this->l->t('Privacy policy'),
|
||||
'url' => (string)$this->getPrivacyUrl()
|
||||
'url' => $this->getPrivacyUrl()
|
||||
],
|
||||
];
|
||||
|
||||
@@ -167,6 +200,13 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
return $footer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns long version of the footer
|
||||
*/
|
||||
public function getLongFooter(): string {
|
||||
return $this->getFromLegacyTheme('getLongFooter', $this->getShortFooter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Color that is used for highlighting elements like important buttons
|
||||
* If user theming is enabled then the user defined value is returned
|
||||
@@ -224,42 +264,40 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
*/
|
||||
public function getDefaultColorPrimary(): string {
|
||||
// try admin color
|
||||
$defaultColor = $this->appConfig->getValueString(Application::APP_ID, 'primary_color', '');
|
||||
$defaultColor = $this->appConfig->getAppValueString('primary_color', '');
|
||||
if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $defaultColor)) {
|
||||
return $defaultColor;
|
||||
}
|
||||
|
||||
// fall back to default primary color
|
||||
return $this->primaryColor;
|
||||
return $this->getFromLegacyTheme('getColorPrimary', $this->getFromLegacyTheme('getMailHeaderColor', '#00679e'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Default background color only taking admin setting into account
|
||||
*/
|
||||
public function getDefaultColorBackground(): string {
|
||||
$defaultColor = $this->appConfig->getValueString(Application::APP_ID, 'background_color');
|
||||
$defaultColor = $this->appConfig->getAppValueString('background_color');
|
||||
if (preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $defaultColor)) {
|
||||
return $defaultColor;
|
||||
}
|
||||
|
||||
return $this->backgroundColor;
|
||||
return $this->getFromLegacyTheme('getColorBackground', '#00679e');
|
||||
}
|
||||
|
||||
/**
|
||||
* Themed logo url
|
||||
*
|
||||
* @param bool $useSvg Whether to point to the SVG image or a fallback
|
||||
* @return string
|
||||
*/
|
||||
public function getLogo($useSvg = true): string {
|
||||
$logo = $this->config->getAppValue('theming', 'logoMime', '');
|
||||
public function getLogo(bool $useSvg = true): string {
|
||||
$logo = $this->appConfig->getAppValueString('logoMime', '');
|
||||
|
||||
// short cut to avoid setting up the filesystem just to check if the logo is there
|
||||
//
|
||||
// explanation: if an SVG is requested and the app config value for logoMime is set then the logo is there.
|
||||
// otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which
|
||||
// needs to be called then)
|
||||
if ($useSvg === true && $logo !== false) {
|
||||
if ($useSvg === true && $logo !== '') {
|
||||
$logoExists = true;
|
||||
} else {
|
||||
try {
|
||||
@@ -270,9 +308,9 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
}
|
||||
}
|
||||
|
||||
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
$cacheBusterCounter = $this->appConfig->getAppValueString('cachebuster', '0');
|
||||
|
||||
if (!$logo || !$logoExists) {
|
||||
if ($logo !== '' || !$logoExists) {
|
||||
if ($useSvg) {
|
||||
$logo = $this->urlGenerator->imagePath('core', 'logo/logo.svg');
|
||||
} else {
|
||||
@@ -288,82 +326,32 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
* Themed background image url
|
||||
*
|
||||
* @param bool $darkVariant if the dark variant (if available) of the background should be used
|
||||
* @return string
|
||||
*/
|
||||
public function getBackground(bool $darkVariant = false): string {
|
||||
return $this->imageManager->getImageUrl('background' . ($darkVariant ? 'Dark' : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getiTunesAppId() {
|
||||
return $this->config->getAppValue('theming', 'iTunesAppId', $this->iTunesAppId);
|
||||
public function getiTunesAppId(): string {
|
||||
return $this->appConfig->getAppValueString('iTunesAppId', $this->iTunesAppId);
|
||||
}
|
||||
|
||||
public function getiOSClientUrl(): string {
|
||||
return $this->appConfig->getAppValueString('iOSClientUrl', $this->iOSClientUrl);
|
||||
}
|
||||
|
||||
public function getAndroidClientUrl(): string {
|
||||
return $this->appConfig->getAppValueString('AndroidClientUrl', $this->AndroidClientUrl);
|
||||
}
|
||||
|
||||
public function getFDroidClientUrl(): string {
|
||||
return $this->appConfig->getAppValueString('FDroidClientUrl', $this->FDroidClientUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* Returns the URL where the sync clients are listed
|
||||
*/
|
||||
public function getiOSClientUrl() {
|
||||
return $this->config->getAppValue('theming', 'iOSClientUrl', $this->iOSClientUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAndroidClientUrl() {
|
||||
return $this->config->getAppValue('theming', 'AndroidClientUrl', $this->AndroidClientUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFDroidClientUrl() {
|
||||
return $this->config->getAppValue('theming', 'FDroidClientUrl', $this->FDroidClientUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array scss variables to overwrite
|
||||
* @deprecated since Nextcloud 22 - https://github.com/nextcloud/server/issues/9940
|
||||
*/
|
||||
public function getScssVariables() {
|
||||
$cacheBuster = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
$cache = $this->cacheFactory->createDistributed('theming-' . $cacheBuster . '-' . $this->urlGenerator->getBaseUrl());
|
||||
if ($value = $cache->get('getScssVariables')) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$variables = [
|
||||
'theming-cachebuster' => "'" . $cacheBuster . "'",
|
||||
'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime') . "'",
|
||||
'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime') . "'",
|
||||
'theming-logoheader-mime' => "'" . $this->config->getAppValue('theming', 'logoheaderMime') . "'",
|
||||
'theming-favicon-mime' => "'" . $this->config->getAppValue('theming', 'faviconMime') . "'"
|
||||
];
|
||||
|
||||
$variables['image-logo'] = "url('" . $this->imageManager->getImageUrl('logo') . "')";
|
||||
$variables['image-logoheader'] = "url('" . $this->imageManager->getImageUrl('logoheader') . "')";
|
||||
$variables['image-favicon'] = "url('" . $this->imageManager->getImageUrl('favicon') . "')";
|
||||
$variables['image-login-background'] = "url('" . $this->imageManager->getImageUrl('background') . "')";
|
||||
$variables['image-login-plain'] = 'false';
|
||||
|
||||
if ($this->appConfig->getValueString(Application::APP_ID, 'primary_color', '') !== '') {
|
||||
$variables['color-primary'] = $this->getColorPrimary();
|
||||
$variables['color-primary-text'] = $this->getTextColorPrimary();
|
||||
$variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary());
|
||||
}
|
||||
|
||||
if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') {
|
||||
$variables['image-login-plain'] = 'true';
|
||||
}
|
||||
|
||||
$variables['has-legal-links'] = 'false';
|
||||
if ($this->getImprintUrl() !== '' || $this->getPrivacyUrl() !== '') {
|
||||
$variables['has-legal-links'] = 'true';
|
||||
}
|
||||
|
||||
$cache->set('getScssVariables', $variables);
|
||||
return $variables;
|
||||
public function getSyncClientUrl(): string {
|
||||
return $this->getFromLegacyTheme('getSyncClientUrl', $this->config->getSystemValueString('customclient_desktop', 'https://nextcloud.com/install/#install-clients'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -372,15 +360,15 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
*
|
||||
* @param string $app name of the app
|
||||
* @param string $image filename of the image
|
||||
* @return bool|string false if image should not replaced, otherwise the location of the image
|
||||
* @return string|false false if image should not replaced, otherwise the location of the image
|
||||
*/
|
||||
public function replaceImagePath($app, $image) {
|
||||
public function replaceImagePath(string $app, string $image): string|false {
|
||||
if ($app === '' || $app === 'files_sharing') {
|
||||
$app = 'core';
|
||||
}
|
||||
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
$cacheBusterValue = $this->appConfig->getAppValueString('cachebuster', '0');
|
||||
|
||||
$route = false;
|
||||
$route = '';
|
||||
if ($image === 'favicon.ico' && ($this->imageManager->shouldReplaceIcons() || $this->getCustomFavicon() !== null)) {
|
||||
$route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]);
|
||||
}
|
||||
@@ -401,7 +389,7 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
$route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]);
|
||||
}
|
||||
|
||||
if ($route) {
|
||||
if ($route !== '') {
|
||||
return $route . '?v=' . $this->util->getCacheBuster();
|
||||
}
|
||||
|
||||
@@ -420,20 +408,17 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
* Increases the cache buster key
|
||||
*/
|
||||
public function increaseCacheBuster(): void {
|
||||
$cacheBusterKey = (int)$this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
$this->config->setAppValue('theming', 'cachebuster', (string)($cacheBusterKey + 1));
|
||||
$cacheBusterKey = (int)$this->appConfig->getAppValueString('cachebuster', '0');
|
||||
$this->appConfig->setAppValueString('cachebuster', (string)($cacheBusterKey + 1));
|
||||
$this->cacheFactory->createDistributed('theming-')->clear();
|
||||
$this->cacheFactory->createDistributed('imagePath')->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update setting in the database
|
||||
*
|
||||
* @param string $setting
|
||||
* @param string $value
|
||||
*/
|
||||
public function set($setting, $value): void {
|
||||
$this->appConfig->setValueString('theming', $setting, $value);
|
||||
public function set(string $setting, string $value): void {
|
||||
$this->appConfig->setAppValueString($setting, $value);
|
||||
$this->increaseCacheBuster();
|
||||
}
|
||||
|
||||
@@ -443,9 +428,9 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
public function undoAll(): void {
|
||||
// Remember the current cachebuster value, as we do not want to reset this value
|
||||
// Otherwise this can lead to caching issues as the value might be known to a browser already
|
||||
$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||
$this->config->deleteAppValues('theming');
|
||||
$this->config->setAppValue('theming', 'cachebuster', $cacheBusterKey);
|
||||
$cacheBusterKey = $this->appConfig->getAppValueString('cachebuster', '0');
|
||||
$this->appConfig->deleteAppValues();
|
||||
$this->appConfig->setAppValueString('cachebuster', $cacheBusterKey);
|
||||
$this->increaseCacheBuster();
|
||||
}
|
||||
|
||||
@@ -455,8 +440,8 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
* @param string $setting setting which should be reverted
|
||||
* @return string default value
|
||||
*/
|
||||
public function undo($setting): string {
|
||||
$this->config->deleteAppValue('theming', $setting);
|
||||
public function undo(string $setting): string {
|
||||
$this->appConfig->deleteAppValue($setting);
|
||||
$this->increaseCacheBuster();
|
||||
|
||||
$returnValue = '';
|
||||
@@ -485,7 +470,7 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
case 'background':
|
||||
case 'favicon':
|
||||
$this->imageManager->delete($setting);
|
||||
$this->config->deleteAppValue('theming', $setting . 'Mime');
|
||||
$this->appConfig->deleteAppValue($setting . 'Mime');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -494,28 +479,22 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
|
||||
/**
|
||||
* Color of text in the header menu
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTextColorBackground() {
|
||||
public function getTextColorBackground(): string {
|
||||
return $this->util->invertTextColor($this->getColorBackground()) ? '#000000' : '#ffffff';
|
||||
}
|
||||
|
||||
/**
|
||||
* Color of text on primary buttons and other elements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTextColorPrimary() {
|
||||
public function getTextColorPrimary(): string {
|
||||
return $this->util->invertTextColor($this->getColorPrimary()) ? '#000000' : '#ffffff';
|
||||
}
|
||||
|
||||
/**
|
||||
* Color of text in the header and primary buttons
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultTextColorPrimary() {
|
||||
public function getDefaultTextColorPrimary(): string {
|
||||
return $this->util->invertTextColor($this->getDefaultColorPrimary()) ? '#000000' : '#ffffff';
|
||||
}
|
||||
|
||||
@@ -523,6 +502,16 @@ class ThemingDefaults extends \OC_Defaults {
|
||||
* Has the admin disabled user customization
|
||||
*/
|
||||
public function isUserThemingDisabled(): bool {
|
||||
return $this->appConfig->getValueBool(Application::APP_ID, 'disable-user-theming');
|
||||
return $this->appConfig->getAppValueBool('disable-user-theming');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string URL to doc with key
|
||||
*/
|
||||
public function buildDocLinkToKey(string $key): string {
|
||||
if (isset($this->theme) && method_exists($this->theme, 'buildDocLinkToKey')) {
|
||||
return $this->theme->buildDocLinkToKey($key);
|
||||
}
|
||||
return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ class ServicesTest extends TestCase {
|
||||
[Capabilities::class],
|
||||
[Capabilities::class, ICapability::class],
|
||||
[ThemingDefaults::class],
|
||||
[ThemingDefaults::class, \OC_Defaults::class],
|
||||
[Util::class],
|
||||
|
||||
// Controller
|
||||
|
||||
@@ -650,71 +650,6 @@ class ThemingDefaultsTest extends TestCase {
|
||||
$this->assertEquals('custom-logo' . '?v=0', $this->template->getLogo());
|
||||
}
|
||||
|
||||
public function testGetScssVariablesCached(): void {
|
||||
$this->config->expects($this->any())->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('1');
|
||||
$this->cacheFactory->expects($this->once())
|
||||
->method('createDistributed')
|
||||
->with('theming-1-')
|
||||
->willReturn($this->cache);
|
||||
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(['foo' => 'bar']);
|
||||
$this->assertEquals(['foo' => 'bar'], $this->template->getScssVariables());
|
||||
}
|
||||
|
||||
public function testGetScssVariables(): void {
|
||||
$this->config
|
||||
->expects($this->any())
|
||||
->method('getAppValue')
|
||||
->willReturnMap([
|
||||
['theming', 'cachebuster', '0', '0'],
|
||||
['theming', 'logoMime', '', 'jpeg'],
|
||||
['theming', 'backgroundMime', '', 'jpeg'],
|
||||
['theming', 'logoheaderMime', '', 'jpeg'],
|
||||
['theming', 'faviconMime', '', 'jpeg'],
|
||||
]);
|
||||
|
||||
$this->appConfig
|
||||
->expects(self::atLeastOnce())
|
||||
->method('getValueString')
|
||||
->willReturnMap([
|
||||
['theming', 'primary_color', '', false, $this->defaults->getColorPrimary()],
|
||||
['theming', 'primary_color', $this->defaults->getColorPrimary(), false, $this->defaults->getColorPrimary()],
|
||||
]);
|
||||
|
||||
$this->util->expects($this->any())->method('invertTextColor')->with($this->defaults->getColorPrimary())->willReturn(false);
|
||||
$this->util->expects($this->any())->method('elementColor')->with($this->defaults->getColorPrimary())->willReturn('#aaaaaa');
|
||||
$this->cacheFactory->expects($this->once())
|
||||
->method('createDistributed')
|
||||
->with('theming-0-')
|
||||
->willReturn($this->cache);
|
||||
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null);
|
||||
$this->imageManager->expects($this->exactly(4))
|
||||
->method('getImageUrl')
|
||||
->willReturnMap([
|
||||
['logo', 'custom-logo?v=0'],
|
||||
['logoheader', 'custom-logoheader?v=0'],
|
||||
['favicon', 'custom-favicon?v=0'],
|
||||
['background', 'custom-background?v=0'],
|
||||
]);
|
||||
|
||||
$expected = [
|
||||
'theming-cachebuster' => '\'0\'',
|
||||
'theming-logo-mime' => '\'jpeg\'',
|
||||
'theming-background-mime' => '\'jpeg\'',
|
||||
'image-logo' => "url('custom-logo?v=0')",
|
||||
'image-login-background' => "url('custom-background?v=0')",
|
||||
'color-primary' => $this->defaults->getColorPrimary(),
|
||||
'color-primary-text' => '#ffffff',
|
||||
'image-login-plain' => 'false',
|
||||
'color-primary-element' => '#aaaaaa',
|
||||
'theming-logoheader-mime' => '\'jpeg\'',
|
||||
'theming-favicon-mime' => '\'jpeg\'',
|
||||
'image-logoheader' => "url('custom-logoheader?v=0')",
|
||||
'image-favicon' => "url('custom-favicon?v=0')",
|
||||
'has-legal-links' => 'false'
|
||||
];
|
||||
$this->assertEquals($expected, $this->template->getScssVariables());
|
||||
}
|
||||
|
||||
public function testGetDefaultAndroidURL(): void {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
namespace OC\Core\Command;
|
||||
|
||||
use OC\Core\Command\User\ListCommand;
|
||||
use OCP\Defaults;
|
||||
use OCP\Server;
|
||||
use OCP\Theming\IDefaults;
|
||||
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
|
||||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -29,7 +29,7 @@ class Base extends Command implements CompletionAwareInterface {
|
||||
|
||||
protected function configure() {
|
||||
// Some of our commands do not extend this class; and some of those that do do not call parent::configure()
|
||||
$defaultHelp = 'More extensive and thorough documentation may be found at ' . Server::get(Defaults::class)->getDocBaseUrl() . PHP_EOL;
|
||||
$defaultHelp = '';//'More extensive and thorough documentation may be found at ' . Server::get(IDefaults::class)->getDocBaseUrl() . PHP_EOL;
|
||||
$this
|
||||
->setHelp($defaultHelp)
|
||||
->addOption(
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
namespace OC\Core\Command;
|
||||
|
||||
use OCP\Defaults;
|
||||
use OCP\IConfig;
|
||||
use OCP\ServerVersion;
|
||||
use OCP\Util;
|
||||
@@ -18,7 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
class Status extends Base {
|
||||
public function __construct(
|
||||
private IConfig $config,
|
||||
private Defaults $themingDefaults,
|
||||
private string $productName,
|
||||
private ServerVersion $serverVersion,
|
||||
) {
|
||||
parent::__construct('status');
|
||||
@@ -47,7 +46,7 @@ class Status extends Base {
|
||||
'edition' => '',
|
||||
'maintenance' => $maintenanceMode,
|
||||
'needsDbUpgrade' => $needUpgrade,
|
||||
'productname' => $this->themingDefaults->getProductName(),
|
||||
'productname' => $this->productName,
|
||||
'extendedSupport' => Util::hasExtendedSupport()
|
||||
];
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var \OC_Defaults $theme
|
||||
* @var \OCP\Theming\IDefaults $theme
|
||||
* @var array $_
|
||||
*/
|
||||
|
||||
|
||||
+1
-1
@@ -354,7 +354,7 @@ class OC {
|
||||
$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
|
||||
$tmpl->assign('incompatibleAppsList', $incompatibleDisabledApps);
|
||||
try {
|
||||
$defaults = new \OC_Defaults();
|
||||
$defaults = Server::get(\OCP\Theming\IDefaults::class);
|
||||
$tmpl->assign('productName', $defaults->getName());
|
||||
} catch (Throwable $error) {
|
||||
$tmpl->assign('productName', 'Nextcloud');
|
||||
|
||||
@@ -932,6 +932,7 @@ return array(
|
||||
'OCP\\TextToImage\\IProvider' => $baseDir . '/lib/public/TextToImage/IProvider.php',
|
||||
'OCP\\TextToImage\\IProviderWithUserId' => $baseDir . '/lib/public/TextToImage/IProviderWithUserId.php',
|
||||
'OCP\\TextToImage\\Task' => $baseDir . '/lib/public/TextToImage/Task.php',
|
||||
'OCP\\Theming\\IDefaults' => $baseDir . '/lib/public/Theming/IDefaults.php',
|
||||
'OCP\\Translation\\CouldNotTranslateException' => $baseDir . '/lib/public/Translation/CouldNotTranslateException.php',
|
||||
'OCP\\Translation\\IDetectLanguageProvider' => $baseDir . '/lib/public/Translation/IDetectLanguageProvider.php',
|
||||
'OCP\\Translation\\ITranslationManager' => $baseDir . '/lib/public/Translation/ITranslationManager.php',
|
||||
|
||||
@@ -973,6 +973,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
||||
'OCP\\TextToImage\\IProvider' => __DIR__ . '/../../..' . '/lib/public/TextToImage/IProvider.php',
|
||||
'OCP\\TextToImage\\IProviderWithUserId' => __DIR__ . '/../../..' . '/lib/public/TextToImage/IProviderWithUserId.php',
|
||||
'OCP\\TextToImage\\Task' => __DIR__ . '/../../..' . '/lib/public/TextToImage/Task.php',
|
||||
'OCP\\Theming\\IDefaults' => __DIR__ . '/../../..' . '/lib/public/Theming/IDefaults.php',
|
||||
'OCP\\Translation\\CouldNotTranslateException' => __DIR__ . '/../../..' . '/lib/public/Translation/CouldNotTranslateException.php',
|
||||
'OCP\\Translation\\IDetectLanguageProvider' => __DIR__ . '/../../..' . '/lib/public/Translation/IDetectLanguageProvider.php',
|
||||
'OCP\\Translation\\ITranslationManager' => __DIR__ . '/../../..' . '/lib/public/Translation/ITranslationManager.php',
|
||||
|
||||
@@ -138,9 +138,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
||||
return $c->get(IServerContainer::class)->getWebRoot();
|
||||
});
|
||||
|
||||
$this->registerService('OC_Defaults', function (ContainerInterface $c): object {
|
||||
return $c->get(IServerContainer::class)->get('ThemingDefaults');
|
||||
});
|
||||
$this->registerDeprecatedAlias('OC_Defaults', \OCP\Theming\IDefaults::class);
|
||||
|
||||
/** @deprecated 32.0.0 */
|
||||
$this->registerDeprecatedAlias('Protocol', Http::class);
|
||||
|
||||
@@ -14,7 +14,6 @@ use OC\SystemConfig;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Console\ConsoleEvent;
|
||||
use OCP\Defaults;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
@@ -39,9 +38,9 @@ class Application {
|
||||
private LoggerInterface $logger,
|
||||
private MemoryInfo $memoryInfo,
|
||||
private IAppManager $appManager,
|
||||
private Defaults $defaults,
|
||||
string $instanceName,
|
||||
) {
|
||||
$this->application = new SymfonyApplication($defaults->getName(), $serverVersion->getVersionString());
|
||||
$this->application = new SymfonyApplication($instanceName, $serverVersion->getVersionString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+26
-4
@@ -1001,8 +1001,24 @@ class Server extends ServerContainer implements IServerContainer {
|
||||
return $manager;
|
||||
});
|
||||
|
||||
$this->registerAlias(\OC_Defaults::class, 'ThemingDefaults');
|
||||
$this->registerService('ThemingDefaults', function (Server $c) {
|
||||
$this->registerService('instanceName', function (ContainerInterface $c) {
|
||||
try {
|
||||
return $c->get(\OCP\Theming\IDefaults::class)->getName();
|
||||
} catch (\Throwable $e) {
|
||||
return 'Nextcloud';
|
||||
}
|
||||
});
|
||||
$this->registerService('productName', function (ContainerInterface $c) {
|
||||
try {
|
||||
return $c->get(\OCP\Theming\IDefaults::class)->getProductName();
|
||||
} catch (\Throwable $e) {
|
||||
return 'Nextcloud';
|
||||
}
|
||||
});
|
||||
$this->registerDeprecatedAlias(\OC_Defaults::class, \OCP\Theming\IDefaults::class);
|
||||
$this->registerDeprecatedAlias('ThemingDefaults', \OCP\Theming\IDefaults::class);
|
||||
$this->registerAlias(ThemingDefaults::class, \OCP\Theming\IDefaults::class);
|
||||
$this->registerService(\OCP\Theming\IDefaults::class, function (Server $c) {
|
||||
try {
|
||||
$classExists = class_exists('OCA\Theming\ThemingDefaults');
|
||||
} catch (\OCP\AutoloadNotAllowedException $e) {
|
||||
@@ -1010,7 +1026,7 @@ class Server extends ServerContainer implements IServerContainer {
|
||||
$classExists = false;
|
||||
}
|
||||
|
||||
if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValueBool('installed', false) && $c->get(IAppManager::class)->isEnabledForAnyone('theming') && $c->get(TrustedDomainHelper::class)->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
|
||||
if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValueBool('installed', false) && $c->get(TrustedDomainHelper::class)->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
|
||||
$backgroundService = new BackgroundService(
|
||||
$c->get(IRootFolder::class),
|
||||
$c->getAppDataDir('theming'),
|
||||
@@ -1029,7 +1045,7 @@ class Server extends ServerContainer implements IServerContainer {
|
||||
);
|
||||
return new ThemingDefaults(
|
||||
$c->get(\OCP\IConfig::class),
|
||||
$c->get(\OCP\IAppConfig::class),
|
||||
$c->getAppContainerForService(\OCA\Theming\ThemingDefaults::class)->get(\OCP\AppFramework\Services\IAppConfig::class),
|
||||
$c->getL10N('theming'),
|
||||
$c->get(IUserSession::class),
|
||||
$c->get(IURLGenerator::class),
|
||||
@@ -1039,8 +1055,14 @@ class Server extends ServerContainer implements IServerContainer {
|
||||
$c->get(IAppManager::class),
|
||||
$c->get(INavigationManager::class),
|
||||
$backgroundService,
|
||||
$c->get(ServerVersion::class),
|
||||
);
|
||||
}
|
||||
var_dump(
|
||||
$classExists,
|
||||
$c->get(\OCP\IConfig::class)->getSystemValueBool('installed', false),
|
||||
$c->get(TrustedDomainHelper::class)->isTrustedDomain($c->getRequest()->getInsecureServerHost()));
|
||||
throw new \Exception('Does it break?');
|
||||
return new \OC_Defaults();
|
||||
});
|
||||
$this->registerService(JSCombiner::class, function (Server $c) {
|
||||
|
||||
@@ -21,7 +21,6 @@ use OC\TextProcessing\RemoveOldTasksBackgroundJob;
|
||||
use OC\User\BackgroundJobs\CleanupDeletedUsers;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\Defaults;
|
||||
use OCP\Http\Client\IClientService;
|
||||
use OCP\IAppConfig;
|
||||
use OCP\IConfig;
|
||||
@@ -46,7 +45,7 @@ class Setup {
|
||||
protected SystemConfig $config,
|
||||
protected IniGetWrapper $iniWrapper,
|
||||
IL10NFactory $l10nFactory,
|
||||
protected Defaults $defaults,
|
||||
protected string $productName,
|
||||
protected LoggerInterface $logger,
|
||||
protected ISecureRandom $random,
|
||||
protected Installer $installer,
|
||||
@@ -189,7 +188,7 @@ class Setup {
|
||||
'error' => $this->l10n->t(
|
||||
'Mac OS X is not supported and %s will not work properly on this platform. '
|
||||
. 'Use it at your own risk!',
|
||||
[$this->defaults->getProductName()]
|
||||
[$this->productName]
|
||||
),
|
||||
'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.'),
|
||||
];
|
||||
@@ -200,7 +199,7 @@ class Setup {
|
||||
'error' => $this->l10n->t(
|
||||
'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. '
|
||||
. 'This will lead to problems with files over 4 GB and is highly discouraged.',
|
||||
[$this->defaults->getProductName()]
|
||||
[$this->productName]
|
||||
),
|
||||
'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
|
||||
];
|
||||
|
||||
@@ -56,6 +56,7 @@ use OCP\Share\IShareProvider;
|
||||
use OCP\Share\IShareProviderSupportsAccept;
|
||||
use OCP\Share\IShareProviderSupportsAllSharesInFolder;
|
||||
use OCP\Share\IShareProviderWithNotification;
|
||||
use OCP\Theming\IDefaults;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,7 @@ class Manager implements IManager {
|
||||
private IRootFolder $rootFolder,
|
||||
private IMailer $mailer,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private \OC_Defaults $defaults,
|
||||
private IDefaults $defaults,
|
||||
private IEventDispatcher $dispatcher,
|
||||
private IUserSession $userSession,
|
||||
private KnownUserService $knownUserService,
|
||||
|
||||
@@ -84,18 +84,6 @@ class OC_Defaults {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL where the sync clients are listed
|
||||
* @return string URL
|
||||
*/
|
||||
public function getSyncClientUrl() {
|
||||
if ($this->themeExist('getSyncClientUrl')) {
|
||||
return $this->theme->getSyncClientUrl();
|
||||
} else {
|
||||
return $this->defaultSyncClientUrl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL to the App Store for the iOS Client
|
||||
* @return string URL
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCP\Theming;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
|
||||
/**
|
||||
* Public api to access default strings and urls for your templates
|
||||
*/
|
||||
#[Consumable('33.0.0')]
|
||||
interface IDefaults {
|
||||
/**
|
||||
* Get base URL for the organisation behind your instance
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getBaseUrl(): string;
|
||||
|
||||
/**
|
||||
* Link to the desktop sync client
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getSyncClientUrl(): string;
|
||||
|
||||
/**
|
||||
* Link to the iOS client
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getiOSClientUrl(): string;
|
||||
|
||||
/**
|
||||
* Link to the Android client
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getAndroidClientUrl(): string;
|
||||
|
||||
/**
|
||||
* link to the Android client on F-Droid
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getFDroidClientUrl(): string;
|
||||
|
||||
/**
|
||||
* base URL to the documentation of your ownCloud instance
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getDocBaseUrl(): string;
|
||||
|
||||
/**
|
||||
* name of your Nextcloud instance (e.g. MyPrivateCloud)
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* Name of the software product (defaults to Nextcloud)
|
||||
*
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getProductName(): string;
|
||||
|
||||
/**
|
||||
* Entity behind your instance
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getEntity(): string;
|
||||
|
||||
/**
|
||||
* Slogan
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getSlogan(?string $lang = null): string;
|
||||
|
||||
/**
|
||||
* Footer, short version
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getShortFooter(): string;
|
||||
|
||||
/**
|
||||
* footer, long version
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getLongFooter(): string;
|
||||
|
||||
/**
|
||||
* Returns the AppId for the App Store for the iOS Client
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getiTunesAppId(): string;
|
||||
|
||||
/**
|
||||
* Themed logo url
|
||||
*
|
||||
* @param bool $useSvg Whether to point to the SVG image or a fallback
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getLogo(bool $useSvg = true): string;
|
||||
|
||||
/**
|
||||
* Returns primary color
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getColorPrimary(): string;
|
||||
|
||||
/**
|
||||
* Return the default color primary
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getDefaultColorPrimary(): string;
|
||||
|
||||
/**
|
||||
* @return string URL to doc with key
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function buildDocLinkToKey(string $key): string;
|
||||
|
||||
/**
|
||||
* Returns the title
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getTitle(): string;
|
||||
|
||||
/**
|
||||
* Returns primary color
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getTextColorPrimary(): string;
|
||||
|
||||
/**
|
||||
* Returns primary color
|
||||
* @since 33.0.0
|
||||
*/
|
||||
public function getDefaultTextColorPrimary(): string;
|
||||
}
|
||||
@@ -58,6 +58,7 @@ use OCP\Share\IProviderFactory;
|
||||
use OCP\Share\IShare;
|
||||
use OCP\Share\IShareProvider;
|
||||
use OCP\Share\IShareProviderSupportsAllSharesInFolder;
|
||||
use OCP\Theming\IDefaults;
|
||||
use OCP\Util;
|
||||
use PHPUnit\Framework\MockObject\MockBuilder;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
@@ -109,7 +110,7 @@ class ManagerTest extends \Test\TestCase {
|
||||
protected $mailer;
|
||||
/** @var IURLGenerator|MockObject */
|
||||
protected $urlGenerator;
|
||||
/** @var \OC_Defaults|MockObject */
|
||||
/** @var IDefaults|MockObject */
|
||||
protected $defaults;
|
||||
/** @var IUserSession|MockObject */
|
||||
protected $userSession;
|
||||
@@ -134,7 +135,7 @@ class ManagerTest extends \Test\TestCase {
|
||||
$this->rootFolder = $this->createMock(IRootFolder::class);
|
||||
$this->mailer = $this->createMock(IMailer::class);
|
||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||
$this->defaults = $this->createMock(\OC_Defaults::class);
|
||||
$this->defaults = $this->createMock(IDefaults::class);
|
||||
$this->dispatcher = $this->createMock(IEventDispatcher::class);
|
||||
$this->userSession = $this->createMock(IUserSession::class);
|
||||
$this->knownUserService = $this->createMock(KnownUserService::class);
|
||||
|
||||
@@ -118,14 +118,4 @@ class OC_Theme {
|
||||
public function getColorBackground(): string {
|
||||
return '#3d85c6';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns variables to overload defaults from core/css/variables.scss
|
||||
* @return array
|
||||
*/
|
||||
public function getScssVariables(): array {
|
||||
return [
|
||||
'color-primary' => '#745bca'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user