mirror of
https://github.com/mwalbeck/nextcloud-breeze-dark.git
synced 2025-04-15 01:38:35 +00:00
Add composer file to manage some dev dependencies
This commit is contained in:
parent
23517ad52d
commit
d95e9c0cf4
11 changed files with 2245 additions and 113 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
build
|
/build
|
||||||
node_modules
|
/node_modules
|
||||||
translationfiles
|
/vendor
|
||||||
translationtool.phar
|
/.php_cs.cache
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
13
composer.json
Normal file
13
composer.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"OCP\\": "vendor/christophwurst/nextcloud/OCP",
|
||||||
|
"OCA\\Talked\\": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"require": {},
|
||||||
|
"require-dev": {
|
||||||
|
"nextcloud/coding-standard": "^0.5.0",
|
||||||
|
"christophwurst/nextcloud": "^21.0"
|
||||||
|
}
|
||||||
|
}
|
2093
composer.lock
generated
Normal file
2093
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -4,26 +4,26 @@ declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\BreezeDark\AppInfo;
|
namespace OCA\BreezeDark\AppInfo;
|
||||||
|
@ -37,7 +37,8 @@ use OCP\IUserSession;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap
|
||||||
|
{
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public const APP_NAME = 'breezedark';
|
public const APP_NAME = 'breezedark';
|
||||||
|
@ -45,48 +46,53 @@ class Application extends App implements IBootstrap {
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
parent::__construct(self::APP_NAME);
|
parent::__construct(self::APP_NAME);
|
||||||
$this->appName = self::APP_NAME;
|
$this->appName = self::APP_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(IRegistrationContext $context): void {
|
public function register(IRegistrationContext $context): void
|
||||||
}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function boot(IBootContext $context): void {
|
public function boot(IBootContext $context): void
|
||||||
$context->injectFn([$this, 'doTheming']);
|
{
|
||||||
}
|
$context->injectFn([$this, 'doTheming']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the theme should be applied
|
* Check if the theme should be applied
|
||||||
*
|
*
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param IUserSession $userSession
|
* @param IUserSession $userSession
|
||||||
* @param IURLGenerator $urlGenerator
|
* @param IURLGenerator $urlGenerator
|
||||||
*/
|
*/
|
||||||
public function doTheming(IConfig $config, IUserSession $userSession, IURLGenerator $urlGenerator): void {
|
public function doTheming(IConfig $config, IUserSession $userSession, IURLGenerator $urlGenerator): void
|
||||||
|
{
|
||||||
$user = $userSession->getUser();
|
$user = $userSession->getUser();
|
||||||
$default = $config->getAppValue($this->appName, "theme_enabled", "0");
|
$default = $config->getAppValue($this->appName, "theme_enabled", "0");
|
||||||
$loginPage = $config->getAppValue($this->appName, "theme_login_page", "1");
|
$loginPage = $config->getAppValue($this->appName, "theme_login_page", "1");
|
||||||
$cachebuster = $config->getAppValue($this->appName, "theme_cachebuster", "0");
|
$cachebuster = $config->getAppValue($this->appName, "theme_cachebuster", "0");
|
||||||
|
|
||||||
if (!is_null($user) AND $config->getUserValue($user->getUID(), $this->appName, "theme_enabled", $default)) {
|
if (!is_null($user) and $config->getUserValue($user->getUID(), $this->appName, "theme_enabled", $default)) {
|
||||||
// When shown the 2FA login page you are logged in while also being on a login page,
|
// When shown the 2FA login page you are logged in while also being on a login page,
|
||||||
// so a logged in user still needs the guests.css stylesheet
|
// so a logged in user still needs the guests.css stylesheet
|
||||||
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
||||||
} else if (is_null($user) AND $default) {
|
} elseif (is_null($user) and $default) {
|
||||||
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add stylesheet(s) to nextcloud
|
* Add stylesheet(s) to nextcloud
|
||||||
*
|
*
|
||||||
* @param IURLGenerator $urlGenerator
|
* @param IURLGenerator $urlGenerator
|
||||||
* @param string $loginPage
|
* @param string $loginPage
|
||||||
* @param string $cachebuster
|
* @param string $cachebuster
|
||||||
*/
|
*/
|
||||||
public function addStyling(IURLGenerator $urlGenerator, string $loginPage, string $cachebuster): void {
|
public function addStyling(IURLGenerator $urlGenerator, string $loginPage, string $cachebuster): void
|
||||||
|
{
|
||||||
Util::addStyle($this->appName, 'server');
|
Util::addStyle($this->appName, 'server');
|
||||||
Util::addScript($this->appName, 'breezedark');
|
Util::addScript($this->appName, 'breezedark');
|
||||||
|
|
||||||
|
@ -98,7 +104,7 @@ class Application extends App implements IBootstrap {
|
||||||
// Only request the stylesheet if there is any styling to request
|
// Only request the stylesheet if there is any styling to request
|
||||||
if ($cachebuster) {
|
if ($cachebuster) {
|
||||||
$linkToCustomStyling = $urlGenerator->linkToRoute(
|
$linkToCustomStyling = $urlGenerator->linkToRoute(
|
||||||
'breezedark.Theming.getCustomStyling',
|
'breezedark.Theming.getCustomStyling',
|
||||||
['v' => $cachebuster,]
|
['v' => $cachebuster,]
|
||||||
);
|
);
|
||||||
Util::addHeader(
|
Util::addHeader(
|
||||||
|
|
|
@ -4,38 +4,37 @@ declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\BreezeDark\Controller;
|
namespace OCA\BreezeDark\Controller;
|
||||||
|
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http;
|
|
||||||
use OCP\AppFramework\Http\DataDisplayResponse;
|
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
||||||
class SettingsController extends Controller {
|
class SettingsController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
@ -52,10 +51,12 @@ class SettingsController extends Controller {
|
||||||
* @param IUserSession $userSession
|
* @param IUserSession $userSession
|
||||||
* @param IRequest $request
|
* @param IRequest $request
|
||||||
*/
|
*/
|
||||||
public function __construct(string $appName,
|
public function __construct(
|
||||||
IConfig $config,
|
string $appName,
|
||||||
IUserSession $userSession,
|
IConfig $config,
|
||||||
IRequest $request) {
|
IUserSession $userSession,
|
||||||
|
IRequest $request
|
||||||
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->userId = $userSession->getUser()->getUID();
|
$this->userId = $userSession->getUser()->getUID();
|
||||||
|
@ -63,10 +64,11 @@ class SettingsController extends Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*
|
*
|
||||||
* Set user theme option
|
* Set user theme option
|
||||||
*/
|
*/
|
||||||
public function personal(): void {
|
public function personal(): void
|
||||||
|
{
|
||||||
if ($this->request->getParam("theme_enabled")) {
|
if ($this->request->getParam("theme_enabled")) {
|
||||||
$this->config->setUserValue($this->userId, $this->appName, "theme_enabled", "1");
|
$this->config->setUserValue($this->userId, $this->appName, "theme_enabled", "1");
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,7 +79,8 @@ class SettingsController extends Controller {
|
||||||
/**
|
/**
|
||||||
* Set global theme option
|
* Set global theme option
|
||||||
*/
|
*/
|
||||||
public function admin(): void {
|
public function admin(): void
|
||||||
|
{
|
||||||
if ($this->request->getParam("theme_enabled")) {
|
if ($this->request->getParam("theme_enabled")) {
|
||||||
$this->config->setAppValue($this->appName, "theme_enabled", "1");
|
$this->config->setAppValue($this->appName, "theme_enabled", "1");
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +97,8 @@ class SettingsController extends Controller {
|
||||||
/**
|
/**
|
||||||
* Set custom styling option
|
* Set custom styling option
|
||||||
*/
|
*/
|
||||||
public function customStyling(): void {
|
public function customStyling(): void
|
||||||
|
{
|
||||||
if ($this->request->getParam("theme_custom_styling")) {
|
if ($this->request->getParam("theme_custom_styling")) {
|
||||||
$this->config->setAppValue($this->appName, "theme_custom_styling", $this->request->getParam("theme_custom_styling"));
|
$this->config->setAppValue($this->appName, "theme_custom_styling", $this->request->getParam("theme_custom_styling"));
|
||||||
$this->config->setAppValue($this->appName, "theme_cachebuster", time());
|
$this->config->setAppValue($this->appName, "theme_cachebuster", time());
|
||||||
|
|
|
@ -4,26 +4,26 @@ declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2021 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2021 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\BreezeDark\Controller;
|
namespace OCA\BreezeDark\Controller;
|
||||||
|
@ -34,7 +34,8 @@ use OCP\AppFramework\Http\DataDisplayResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class ThemingController extends Controller {
|
class ThemingController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
@ -47,24 +48,27 @@ class ThemingController extends Controller {
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param IRequest $request
|
* @param IRequest $request
|
||||||
*/
|
*/
|
||||||
public function __construct(string $appName,
|
public function __construct(
|
||||||
IConfig $config,
|
string $appName,
|
||||||
IRequest $request) {
|
IConfig $config,
|
||||||
|
IRequest $request
|
||||||
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @PublicPage
|
* @PublicPage
|
||||||
* @NoSameSiteCookieRequired
|
* @NoSameSiteCookieRequired
|
||||||
*
|
*
|
||||||
* @return DataDisplayResponse|NotFoundResponse
|
* @return DataDisplayResponse|NotFoundResponse
|
||||||
*/
|
*/
|
||||||
public function getCustomStyling(): DataDisplayResponse {
|
public function getCustomStyling(): DataDisplayResponse
|
||||||
|
{
|
||||||
$customStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', '');
|
$customStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', '');
|
||||||
$response = new DataDisplayResponse($customStyling, Http::STATUS_OK, ['Content-Type' => 'text/css']);
|
$response = new DataDisplayResponse($customStyling, Http::STATUS_OK, ['Content-Type' => 'text/css']);
|
||||||
$response->cacheFor(86400);
|
$response->cacheFor(86400);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,26 +4,26 @@ declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\BreezeDark\Settings;
|
namespace OCA\BreezeDark\Settings;
|
||||||
|
@ -32,7 +32,8 @@ use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
|
||||||
class Admin implements ISettings {
|
class Admin implements ISettings
|
||||||
|
{
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
@ -44,8 +45,11 @@ class Admin implements ISettings {
|
||||||
* @param string $appName
|
* @param string $appName
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
*/
|
*/
|
||||||
public function __construct(string $appName,
|
public function __construct(
|
||||||
IConfig $config) {
|
string $appName,
|
||||||
|
IConfig $config
|
||||||
|
)
|
||||||
|
{
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
@ -53,11 +57,12 @@ class Admin implements ISettings {
|
||||||
/**
|
/**
|
||||||
* @return TemplateResponse
|
* @return TemplateResponse
|
||||||
*/
|
*/
|
||||||
public function getForm(): TemplateResponse {
|
public function getForm(): TemplateResponse
|
||||||
|
{
|
||||||
$themeEnabled = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
$themeEnabled = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
||||||
$themeLoginPage = $this->config->getAppValue($this->appName, 'theme_login_page', "1");
|
$themeLoginPage = $this->config->getAppValue($this->appName, 'theme_login_page', "1");
|
||||||
$themeCustomStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', "");
|
$themeCustomStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', "");
|
||||||
return new TemplateResponse('breezedark', 'admin', [
|
return new TemplateResponse('breezedark', 'admin', [
|
||||||
"themeEnabled" => $themeEnabled,
|
"themeEnabled" => $themeEnabled,
|
||||||
"themeLoginPage" => $themeLoginPage,
|
"themeLoginPage" => $themeLoginPage,
|
||||||
"themeCustomStyling" => $themeCustomStyling
|
"themeCustomStyling" => $themeCustomStyling
|
||||||
|
@ -67,14 +72,16 @@ class Admin implements ISettings {
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSection(): string {
|
public function getSection(): string
|
||||||
|
{
|
||||||
return 'theming';
|
return 'theming';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPriority(): int {
|
public function getPriority(): int
|
||||||
|
{
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,26 +4,26 @@ declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\BreezeDark\Settings;
|
namespace OCA\BreezeDark\Settings;
|
||||||
|
@ -34,7 +34,8 @@ use OCP\IConfig;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
||||||
class Personal implements ISettings {
|
class Personal implements ISettings
|
||||||
|
{
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
@ -54,10 +55,12 @@ class Personal implements ISettings {
|
||||||
* @param IUserSession $userSession
|
* @param IUserSession $userSession
|
||||||
* @param IAppManager $appManager
|
* @param IAppManager $appManager
|
||||||
*/
|
*/
|
||||||
public function __construct(string $appName,
|
public function __construct(
|
||||||
IConfig $config,
|
string $appName,
|
||||||
IUserSession $userSession,
|
IConfig $config,
|
||||||
IAppManager $appManager) {
|
IUserSession $userSession,
|
||||||
|
IAppManager $appManager
|
||||||
|
) {
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->userId = $userSession->getUser()->getUID();
|
$this->userId = $userSession->getUser()->getUID();
|
||||||
|
@ -67,10 +70,11 @@ class Personal implements ISettings {
|
||||||
/**
|
/**
|
||||||
* @return TemplateResponse
|
* @return TemplateResponse
|
||||||
*/
|
*/
|
||||||
public function getForm(): TemplateResponse {
|
public function getForm(): TemplateResponse
|
||||||
|
{
|
||||||
$default = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
$default = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
||||||
$themeEnabled = $this->config->getUserValue($this->userId, $this->appName, 'theme_enabled', $default);
|
$themeEnabled = $this->config->getUserValue($this->userId, $this->appName, 'theme_enabled', $default);
|
||||||
return new TemplateResponse('breezedark', 'personal', [
|
return new TemplateResponse('breezedark', 'personal', [
|
||||||
"themeEnabled" => $themeEnabled,
|
"themeEnabled" => $themeEnabled,
|
||||||
"appWebPath" => $this->appWebPath
|
"appWebPath" => $this->appWebPath
|
||||||
]);
|
]);
|
||||||
|
@ -79,15 +83,16 @@ class Personal implements ISettings {
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSection(): string {
|
public function getSection(): string
|
||||||
|
{
|
||||||
return 'accessibility';
|
return 'accessibility';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getPriority(): int {
|
public function getPriority(): int
|
||||||
|
{
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Breeze Dark theme for Nextcloud
|
* Breeze Dark theme for Nextcloud
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
* @copyright Copyright (C) 2020 Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @author Magnus Walbeck <mw@mwalbeck.org>
|
* @author Magnus Walbeck <mw@mwalbeck.org>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue