mirror of
https://github.com/mwalbeck/nextcloud-breeze-dark.git
synced 2025-04-07 06:25:40 +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
|
||||
node_modules
|
||||
translationfiles
|
||||
translationtool.phar
|
||||
/build
|
||||
/node_modules
|
||||
/vendor
|
||||
/.php_cs.cache
|
||||
|
|
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
|
@ -37,7 +37,8 @@ use OCP\IUserSession;
|
|||
use OCP\Util;
|
||||
use OCP\IURLGenerator;
|
||||
|
||||
class Application extends App implements IBootstrap {
|
||||
class Application extends App implements IBootstrap
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
public const APP_NAME = 'breezedark';
|
||||
|
@ -45,15 +46,18 @@ class Application extends App implements IBootstrap {
|
|||
/** @var string */
|
||||
protected $appName;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(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']);
|
||||
}
|
||||
|
||||
|
@ -64,17 +68,18 @@ class Application extends App implements IBootstrap {
|
|||
* @param IUserSession $userSession
|
||||
* @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();
|
||||
$default = $config->getAppValue($this->appName, "theme_enabled", "0");
|
||||
$loginPage = $config->getAppValue($this->appName, "theme_login_page", "1");
|
||||
$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,
|
||||
// so a logged in user still needs the guests.css stylesheet
|
||||
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
||||
} else if (is_null($user) AND $default) {
|
||||
} elseif (is_null($user) and $default) {
|
||||
$this->addStyling($urlGenerator, $loginPage, $cachebuster);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +91,8 @@ class Application extends App implements IBootstrap {
|
|||
* @param string $loginPage
|
||||
* @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::addScript($this->appName, 'breezedark');
|
||||
|
||||
|
|
|
@ -29,13 +29,12 @@ declare(strict_types=1);
|
|||
namespace OCA\BreezeDark\Controller;
|
||||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\DataDisplayResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
|
||||
class SettingsController extends Controller {
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
protected $appName;
|
||||
|
@ -52,10 +51,12 @@ class SettingsController extends Controller {
|
|||
* @param IUserSession $userSession
|
||||
* @param IRequest $request
|
||||
*/
|
||||
public function __construct(string $appName,
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IConfig $config,
|
||||
IUserSession $userSession,
|
||||
IRequest $request) {
|
||||
IRequest $request
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->config = $config;
|
||||
$this->userId = $userSession->getUser()->getUID();
|
||||
|
@ -66,7 +67,8 @@ class SettingsController extends Controller {
|
|||
*
|
||||
* Set user theme option
|
||||
*/
|
||||
public function personal(): void {
|
||||
public function personal(): void
|
||||
{
|
||||
if ($this->request->getParam("theme_enabled")) {
|
||||
$this->config->setUserValue($this->userId, $this->appName, "theme_enabled", "1");
|
||||
} else {
|
||||
|
@ -77,7 +79,8 @@ class SettingsController extends Controller {
|
|||
/**
|
||||
* Set global theme option
|
||||
*/
|
||||
public function admin(): void {
|
||||
public function admin(): void
|
||||
{
|
||||
if ($this->request->getParam("theme_enabled")) {
|
||||
$this->config->setAppValue($this->appName, "theme_enabled", "1");
|
||||
} else {
|
||||
|
@ -94,7 +97,8 @@ class SettingsController extends Controller {
|
|||
/**
|
||||
* Set custom styling option
|
||||
*/
|
||||
public function customStyling(): void {
|
||||
public function customStyling(): void
|
||||
{
|
||||
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_cachebuster", time());
|
||||
|
|
|
@ -34,7 +34,8 @@ use OCP\AppFramework\Http\DataDisplayResponse;
|
|||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
|
||||
class ThemingController extends Controller {
|
||||
class ThemingController extends Controller
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
protected $appName;
|
||||
|
@ -47,9 +48,11 @@ class ThemingController extends Controller {
|
|||
* @param IConfig $config
|
||||
* @param IRequest $request
|
||||
*/
|
||||
public function __construct(string $appName,
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IConfig $config,
|
||||
IRequest $request) {
|
||||
IRequest $request
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->config = $config;
|
||||
}
|
||||
|
@ -61,7 +64,8 @@ class ThemingController extends Controller {
|
|||
*
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
public function getCustomStyling(): DataDisplayResponse {
|
||||
public function getCustomStyling(): DataDisplayResponse
|
||||
{
|
||||
$customStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', '');
|
||||
$response = new DataDisplayResponse($customStyling, Http::STATUS_OK, ['Content-Type' => 'text/css']);
|
||||
$response->cacheFor(86400);
|
||||
|
|
|
@ -32,7 +32,8 @@ use OCP\AppFramework\Http\TemplateResponse;
|
|||
use OCP\IConfig;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
class Admin implements ISettings {
|
||||
class Admin implements ISettings
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
protected $appName;
|
||||
|
@ -44,8 +45,11 @@ class Admin implements ISettings {
|
|||
* @param string $appName
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(string $appName,
|
||||
IConfig $config) {
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IConfig $config
|
||||
)
|
||||
{
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
@ -53,7 +57,8 @@ class Admin implements ISettings {
|
|||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm(): TemplateResponse {
|
||||
public function getForm(): TemplateResponse
|
||||
{
|
||||
$themeEnabled = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
||||
$themeLoginPage = $this->config->getAppValue($this->appName, 'theme_login_page', "1");
|
||||
$themeCustomStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', "");
|
||||
|
@ -67,14 +72,16 @@ class Admin implements ISettings {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSection(): string {
|
||||
public function getSection(): string
|
||||
{
|
||||
return 'theming';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority(): int {
|
||||
public function getPriority(): int
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ use OCP\IConfig;
|
|||
use OCP\Settings\ISettings;
|
||||
use OCP\IUserSession;
|
||||
|
||||
class Personal implements ISettings {
|
||||
class Personal implements ISettings
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
protected $appName;
|
||||
|
@ -54,10 +55,12 @@ class Personal implements ISettings {
|
|||
* @param IUserSession $userSession
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(string $appName,
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IConfig $config,
|
||||
IUserSession $userSession,
|
||||
IAppManager $appManager) {
|
||||
IAppManager $appManager
|
||||
) {
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userId = $userSession->getUser()->getUID();
|
||||
|
@ -67,7 +70,8 @@ class Personal implements ISettings {
|
|||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm(): TemplateResponse {
|
||||
public function getForm(): TemplateResponse
|
||||
{
|
||||
$default = $this->config->getAppValue($this->appName, 'theme_enabled', "0");
|
||||
$themeEnabled = $this->config->getUserValue($this->userId, $this->appName, 'theme_enabled', $default);
|
||||
return new TemplateResponse('breezedark', 'personal', [
|
||||
|
@ -79,15 +83,16 @@ class Personal implements ISettings {
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSection(): string {
|
||||
public function getSection(): string
|
||||
{
|
||||
return 'accessibility';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority(): int {
|
||||
public function getPriority(): int
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue