Merge pull request 'release v4.1.0' (#395) from develop into master
Reviewed-on: #395
This commit is contained in:
commit
fe5f0287c3
15 changed files with 143 additions and 154 deletions
|
|
@ -18,9 +18,12 @@ steps:
|
||||||
|
|
||||||
"Create signature":
|
"Create signature":
|
||||||
image: nextcloud:25
|
image: nextcloud:25
|
||||||
secrets: [app_certificate, app_public_certificate]
|
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
environment:
|
environment:
|
||||||
|
APP_CERTIFICATE:
|
||||||
|
from_secret: app_certificate
|
||||||
|
APP_PUBLIC_CERTIFICATE:
|
||||||
|
from_secret: app_public_certificate
|
||||||
SQLITE_DATABASE: /var/www/data/data.db
|
SQLITE_DATABASE: /var/www/data/data.db
|
||||||
NEXTCLOUD_ADMIN_USER: admin
|
NEXTCLOUD_ADMIN_USER: admin
|
||||||
NEXTCLOUD_ADMIN_PASSWORD: admin
|
NEXTCLOUD_ADMIN_PASSWORD: admin
|
||||||
|
|
@ -39,7 +42,9 @@ steps:
|
||||||
"Create package":
|
"Create package":
|
||||||
image: deblan/php:8.3
|
image: deblan/php:8.3
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
secrets: [app_certificate]
|
environment:
|
||||||
|
APP_CERTIFICATE:
|
||||||
|
from_secret: app_certificate
|
||||||
commands:
|
commands:
|
||||||
- cd "/builds/$CI_COMMIT_SHA"
|
- cd "/builds/$CI_COMMIT_SHA"
|
||||||
- apt-get update
|
- apt-get update
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
|
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
||||||
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
|
||||||
<id>side_menu</id>
|
<id>side_menu</id>
|
||||||
<name>Custom menu</name>
|
<name>Custom menu</name>
|
||||||
<summary>Modify the display of the menu.</summary>
|
<summary>Modify the display of the menu.</summary>
|
||||||
|
|
@ -17,7 +16,7 @@ You can report a bug or request a feature by opening an issue.
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
* PHP >= 8.0
|
* PHP >= 8.1
|
||||||
* App `theming` enabled
|
* App `theming` enabled
|
||||||
|
|
||||||
If you like this application and if you want to support the development:
|
If you like this application and if you want to support the development:
|
||||||
|
|
@ -32,9 +31,9 @@ Notice
|
||||||
Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**.
|
Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**.
|
||||||
In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/).
|
In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/).
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>4.0.1</version>
|
<version>4.1.0</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
<author mail="contact@deblan.fr" homepage="https://www.deblan.fr/">Simon Vieille</author>
|
||||||
<namespace>SideMenu</namespace>
|
<namespace>SideMenu</namespace>
|
||||||
<documentation>
|
<documentation>
|
||||||
<admin>https://deblan.gitnet.page/side_menu_doc/</admin>
|
<admin>https://deblan.gitnet.page/side_menu_doc/</admin>
|
||||||
|
|
@ -42,20 +41,20 @@ In case of downtime, you can download **Custom Menu** from [here](https://kim.de
|
||||||
</documentation>
|
</documentation>
|
||||||
<category>customization</category>
|
<category>customization</category>
|
||||||
<website>https://gitnet.fr/deblan/side_menu</website>
|
<website>https://gitnet.fr/deblan/side_menu</website>
|
||||||
<discussion>https://matrix.to/#/!TFPucDATKODpHNVAtu:neutralnetwork.org?via=neutralnetwork.org</discussion>
|
<discussion><![CDATA[https://matrix.to/#/!TFPucDATKODpHNVAtu:neutralnetwork.org?via=neutralnetwork.org]]></discussion>
|
||||||
<bugs>https://gitnet.fr/deblan/side_menu/issues</bugs>
|
<bugs>https://gitnet.fr/deblan/side_menu/issues</bugs>
|
||||||
<repository type="git">https://gitnet.fr/deblan/side_menu</repository>
|
<repository type="git">https://gitnet.fr/deblan/side_menu</repository>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc19_default_menu.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc19_default_menu.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/admin_settings.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/admin_settings.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/n19_big_menu.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/n19_big_menu.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc18_menu_always_displayed.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc18_menu_always_displayed.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc20_big_menu_responsive.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc20_big_menu_responsive.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/personal_settings.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/personal_settings.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_big_menu.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_big_menu.png]]></screenshot>
|
||||||
<screenshot>https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_default_menu.png</screenshot>
|
<screenshot><![CDATA[https://gitnet.fr/deblan/side_menu/raw/branch/master/screenshots/nc25_default_menu.png]]></screenshot>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="30" max-version="30"/>
|
<php min-version="8.1" max-version="8.4" />
|
||||||
<php min-version="8.0"/>
|
<nextcloud min-version="30" max-version="32"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<settings>
|
<settings>
|
||||||
<admin>OCA\SideMenu\Settings\Admin</admin>
|
<admin>OCA\SideMenu\Settings\Admin</admin>
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* 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 the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return [
|
|
||||||
'routes' => [
|
|
||||||
['name' => 'App#index', 'url' => '/', 'verb' => 'GET'],
|
|
||||||
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
|
|
||||||
['name' => 'Js#script', 'url' => '/js/script', 'verb' => 'GET'],
|
|
||||||
['name' => 'Js#config', 'url' => '/js/config', 'verb' => 'GET'],
|
|
||||||
['name' => 'Nav#items', 'url' => '/nav/items', 'verb' => 'GET'],
|
|
||||||
['name' => 'PersonalSetting#valueSet', 'url' => '/personalSetting/valueSet', 'verb' => 'POST'],
|
|
||||||
['name' => 'AdminSetting#removeCache', 'url' => '/admin/cache/remove', 'verb' => 'GET'],
|
|
||||||
['name' => 'AdminSetting#exportConfiguration', 'url' => '/admin/config/export', 'verb' => 'GET'],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace OCA\SideMenu\AppInfo;
|
namespace OCA\SideMenu\AppInfo;
|
||||||
|
|
||||||
use OC;
|
use OC;
|
||||||
|
use OC\App\AppStore\Fetcher\CategoryFetcher;
|
||||||
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
|
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
|
||||||
use OC\User\User;
|
use OC\User\User;
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
|
|
@ -12,7 +13,11 @@ use OCP\AppFramework\App;
|
||||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
|
use OCP\IConfig;
|
||||||
|
use OCP\INavigationManager;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
use OCP\L10N\IFactory;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
|
@ -26,6 +31,7 @@ class Application extends App implements IBootstrap
|
||||||
public const APP_ID = 'side_menu';
|
public const APP_ID = 'side_menu';
|
||||||
|
|
||||||
public const APP_NAME = 'Custom menu';
|
public const APP_NAME = 'Custom menu';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var OC\AllConfig
|
* @var OC\AllConfig
|
||||||
*/
|
*/
|
||||||
|
|
@ -41,14 +47,55 @@ class Application extends App implements IBootstrap
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function __construct(array $urlParams = [])
|
public function __construct(array $urlParams = [])
|
||||||
{
|
{
|
||||||
parent::__construct(self::APP_ID, $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function register(IRegistrationContext $context): void
|
||||||
|
{
|
||||||
|
$context->registerService(CategoryRepository::class, function (ContainerInterface $c) {
|
||||||
|
return new CategoryRepository(
|
||||||
|
$c->get(CategoryFetcher::class),
|
||||||
|
$c->get(ConfigProxy::class),
|
||||||
|
$c->get(IConfig::class),
|
||||||
|
$c->get(IFactory::class),
|
||||||
|
$c->get(IUserSession::class)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$context->registerService(AppRepository::class, function (ContainerInterface $c) {
|
||||||
|
return new AppRepository(
|
||||||
|
$c->get(\OC_App::class),
|
||||||
|
$c->get(INavigationManager::class),
|
||||||
|
$c->get(IFactory::class),
|
||||||
|
$c->get(ConfigProxy::class),
|
||||||
|
$c->get(CategoryRepository::class),
|
||||||
|
$c->get(IEventDispatcher::class),
|
||||||
|
$c->get(IUserSession::class)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$context->registerService(ConfigProxy::class, function (ContainerInterface $c) {
|
||||||
|
return new ConfigProxy(
|
||||||
|
$c->get(IConfig::class),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boot(IBootContext $context): void
|
||||||
|
{
|
||||||
|
$this->config = \OC::$server->getConfig();
|
||||||
|
$this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
|
||||||
|
$this->user = \OC::$server[IUserSession::class]->getUser();
|
||||||
|
|
||||||
|
if (!$this->isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addAssets();
|
||||||
|
}
|
||||||
|
|
||||||
protected function isEnabled(): bool
|
protected function isEnabled(): bool
|
||||||
{
|
{
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
|
|
@ -97,38 +144,10 @@ class Application extends App implements IBootstrap
|
||||||
$cache = $this->config->getAppValue(self::APP_ID, 'cache', '0');
|
$cache = $this->config->getAppValue(self::APP_ID, 'cache', '0');
|
||||||
|
|
||||||
foreach ($assets as $value) {
|
foreach ($assets as $value) {
|
||||||
$route = OC::$server->getURLGenerator()->linkToRoute($value['route'], ['v' => $cache]);
|
$route = \OC::$server->getURLGenerator()->linkToRoute($value['route'], ['v' => $cache]);
|
||||||
$value['attr'][$value['route_attr']] = $route;
|
$value['attr'][$value['route_attr']] = $route;
|
||||||
|
|
||||||
Util::addHeader($value['type'], $value['attr'], '');
|
Util::addHeader($value['type'], $value['attr'], '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(IRegistrationContext $context): void
|
|
||||||
{
|
|
||||||
$context->registerService('AppRepository', function () {
|
|
||||||
return new AppRepository();
|
|
||||||
});
|
|
||||||
|
|
||||||
$context->registerService('CategoryRepository', function () {
|
|
||||||
return new CategoryRepository();
|
|
||||||
});
|
|
||||||
|
|
||||||
$context->registerService('ConfigProxy', function () {
|
|
||||||
return new ConfigProxy();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function boot(IBootContext $context): void
|
|
||||||
{
|
|
||||||
$this->config = OC::$server->getConfig();
|
|
||||||
$this->cspnm = OC::$server->getContentSecurityPolicyNonceManager();
|
|
||||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
|
||||||
|
|
||||||
if (!$this->isEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addAssets();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -20,6 +21,8 @@ namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
use OCP\AppFramework\Http\DataDownloadResponse;
|
||||||
use OCP\AppFramework\Http\RedirectResponse;
|
use OCP\AppFramework\Http\RedirectResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
@ -37,9 +40,8 @@ class AdminSettingController extends Controller
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
#[FrontpageRoute(verb: 'GET', url: '/admin/cache/remove')]
|
||||||
*/
|
|
||||||
public function removeCache(): RedirectResponse
|
public function removeCache(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
|
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
|
||||||
|
|
@ -49,9 +51,8 @@ class AdminSettingController extends Controller
|
||||||
]).'#more');
|
]).'#more');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoCSRFRequired
|
#[FrontpageRoute(verb: 'GET', url: '/admin/config/export')]
|
||||||
*/
|
|
||||||
public function exportConfiguration(): DataDownloadResponse
|
public function exportConfiguration(): DataDownloadResponse
|
||||||
{
|
{
|
||||||
$keys = $this->config->getAppKeys(Application::APP_ID);
|
$keys = $this->config->getAppKeys(Application::APP_ID);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -18,10 +19,12 @@
|
||||||
|
|
||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OC;
|
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\AppFramework\Http\RedirectResponse;
|
use OCP\AppFramework\Http\RedirectResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
|
@ -39,13 +42,12 @@ class AppController extends Controller
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[FrontpageRoute(verb: 'GET', url: '/')]
|
||||||
*/
|
|
||||||
public function index(): RedirectResponse
|
public function index(): RedirectResponse
|
||||||
{
|
{
|
||||||
$user = OC::$server[IUserSession::class]->getUser();
|
$user = \OC::$server[IUserSession::class]->getUser();
|
||||||
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
|
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
|
||||||
$hiddenApps = $this->config->getAppValueArray('big-menu-hidden-apps', '[]');
|
$hiddenApps = $this->config->getAppValueArray('big-menu-hidden-apps', '[]');
|
||||||
$isForced = $this->config->getAppValueBool('force', '0');
|
$isForced = $this->config->getAppValueBool('force', '0');
|
||||||
|
|
@ -73,7 +75,7 @@ class AppController extends Controller
|
||||||
protected function redirectToApp($app, bool $isHref = false): RedirectResponse
|
protected function redirectToApp($app, bool $isHref = false): RedirectResponse
|
||||||
{
|
{
|
||||||
if (!$isHref) {
|
if (!$isHref) {
|
||||||
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue(
|
$isIgnoreFrontController = true === \OC::$server->getConfig()->getSystemValue(
|
||||||
'htaccess.IgnoreFrontController',
|
'htaccess.IgnoreFrontController',
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -18,14 +19,14 @@
|
||||||
|
|
||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OC;
|
|
||||||
use OC\User\User;
|
use OC\User\User;
|
||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCA\SideMenu\Service\Color;
|
use OCA\SideMenu\Service\Color;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCA\Theming\ThemingDefaults;
|
use OCA\Theming\ThemingDefaults;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\Response;
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
@ -43,14 +44,13 @@ class CssController extends Controller
|
||||||
) {
|
) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
$this->user = \OC::$server[IUserSession::class]->getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[PublicPage]
|
||||||
* @PublicPage
|
#[FrontpageRoute(verb: 'GET', url: '/css/stylesheet')]
|
||||||
*/
|
|
||||||
public function stylesheet(): TemplateResponse
|
public function stylesheet(): TemplateResponse
|
||||||
{
|
{
|
||||||
$response = new TemplateResponse(Application::APP_ID, 'css/stylesheet', $this->getConfig(), 'blank');
|
$response = new TemplateResponse(Application::APP_ID, 'css/stylesheet', $this->getConfig(), 'blank');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -18,12 +19,15 @@
|
||||||
|
|
||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OC;
|
|
||||||
use OC\User\User;
|
use OC\User\User;
|
||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCA\Theming\ThemingDefaults;
|
use OCA\Theming\ThemingDefaults;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||||
use OCP\AppFramework\Http\JSONResponse;
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
@ -45,16 +49,15 @@ class JsController extends Controller
|
||||||
|
|
||||||
$this->themingDefaults = $themingDefaults;
|
$this->themingDefaults = $themingDefaults;
|
||||||
|
|
||||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
$this->user = \OC::$server[IUserSession::class]->getUser();
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->l10nFactory = $l10nFactory;
|
$this->l10nFactory = $l10nFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[PublicPage]
|
||||||
* @PublicPage
|
#[FrontpageRoute(verb: 'GET', url: '/js/script')]
|
||||||
*/
|
|
||||||
public function script(): TemplateResponse
|
public function script(): TemplateResponse
|
||||||
{
|
{
|
||||||
$response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
|
$response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
|
||||||
|
|
@ -63,11 +66,10 @@ class JsController extends Controller
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[PublicPage]
|
||||||
* @PublicPage
|
#[FrontpageRoute(verb: 'GET', url: '/js/config')]
|
||||||
*/
|
|
||||||
public function config(): JSONResponse
|
public function config(): JSONResponse
|
||||||
{
|
{
|
||||||
return new JSONResponse($this->getConfig());
|
return new JSONResponse($this->getConfig());
|
||||||
|
|
@ -109,10 +111,10 @@ class JsController extends Controller
|
||||||
$targetBlankApps = $userTargetBlankApps;
|
$targetBlankApps = $userTargetBlankApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
$isAvatarSet = OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists();
|
$isAvatarSet = \OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists();
|
||||||
|
|
||||||
if ($useAvatar && $isAvatarSet) {
|
if ($useAvatar && $isAvatarSet) {
|
||||||
$avatar = OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
$avatar = \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||||
'userId' => $this->user->getUid(),
|
'userId' => $this->user->getUid(),
|
||||||
'size' => 128,
|
'size' => 128,
|
||||||
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
||||||
|
|
@ -120,13 +122,13 @@ class JsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->config->getAppValueBool('show-settings', '0')) {
|
if ($this->config->getAppValueBool('show-settings', '0')) {
|
||||||
$settingsNav = OC::$server->getNavigationManager()->getAll('settings');
|
$settingsNav = \OC::$server->getNavigationManager()->getAll('settings');
|
||||||
|
|
||||||
if (isset($settingsNav['settings'])) {
|
if (isset($settingsNav['settings'])) {
|
||||||
$settings = [
|
$settings = [
|
||||||
'href' => $settingsNav['settings']['href'],
|
'href' => $settingsNav['settings']['href'],
|
||||||
'name' => $settingsNav['settings']['name'],
|
'name' => $settingsNav['settings']['name'],
|
||||||
'avatar' => OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
'avatar' => \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||||
'userId' => $this->user->getUid(),
|
'userId' => $this->user->getUid(),
|
||||||
'size' => 32,
|
'size' => 32,
|
||||||
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
||||||
|
|
@ -136,7 +138,7 @@ class JsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$indexUrl = OC::$server->getURLGenerator()->linkTo('', 'index.php');
|
$indexUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'opener-position' => $this->config->getAppValue('opener-position', 'before'),
|
'opener-position' => $this->config->getAppValue('opener-position', 'before'),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -18,12 +19,15 @@
|
||||||
|
|
||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OC;
|
|
||||||
use OC\URLGenerator;
|
use OC\URLGenerator;
|
||||||
use OCA\SideMenu\Service\AppRepository;
|
use OCA\SideMenu\Service\AppRepository;
|
||||||
use OCA\SideMenu\Service\CategoryRepository;
|
use OCA\SideMenu\Service\CategoryRepository;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||||
use OCP\AppFramework\Http\JSONResponse;
|
use OCP\AppFramework\Http\JSONResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
@ -43,14 +47,13 @@ class NavController extends Controller
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[PublicPage]
|
||||||
* @PublicPage
|
#[FrontpageRoute(verb: 'GET', url: '/nav/items')]
|
||||||
*/
|
|
||||||
public function items(): JSONResponse
|
public function items(): JSONResponse
|
||||||
{
|
{
|
||||||
$user = OC::$server[IUserSession::class]->getUser();
|
$user = \OC::$server[IUserSession::class]->getUser();
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -21,6 +22,9 @@ namespace OCA\SideMenu\Controller;
|
||||||
use OCA\SideMenu\AppInfo\Application;
|
use OCA\SideMenu\AppInfo\Application;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||||
|
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
|
@ -37,13 +41,9 @@ class PersonalSettingController extends Controller
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[NoCSRFRequired]
|
||||||
* @NoAdminRequired
|
#[NoAdminRequired]
|
||||||
* @NoCSRFRequired
|
#[FrontpageRoute(verb: 'POST', url: '/personalSetting/valueSet')]
|
||||||
*
|
|
||||||
* @param mixed $name
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
public function valueSet($name, $value): array
|
public function valueSet($name, $value): array
|
||||||
{
|
{
|
||||||
$doSave = false;
|
$doSave = false;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@ class CategoryRepository
|
||||||
protected IConfig $iConfig,
|
protected IConfig $iConfig,
|
||||||
protected IFactory $l10nFactory,
|
protected IFactory $l10nFactory,
|
||||||
protected IUserSession $userSession
|
protected IUserSession $userSession
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves categories.
|
* Retrieves categories.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -27,22 +28,19 @@ use OCA\SideMenu\Service\LangRepository;
|
||||||
use OCA\Theming\ThemingDefaults;
|
use OCA\Theming\ThemingDefaults;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
|
||||||
class Admin implements ISettings
|
class Admin implements ISettings
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected IL10N $l,
|
protected IL10N $l,
|
||||||
protected ILogger $logger,
|
|
||||||
protected ConfigProxy $config,
|
protected ConfigProxy $config,
|
||||||
protected AppRepository $appRepository,
|
protected AppRepository $appRepository,
|
||||||
protected CategoryRepository $categoryRepository,
|
protected CategoryRepository $categoryRepository,
|
||||||
protected ThemingDefaults $theming,
|
protected ThemingDefaults $theming,
|
||||||
protected Color $color,
|
protected Color $color,
|
||||||
protected LangRepository $langRepository
|
protected LangRepository $langRepository
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TemplateResponse
|
* @return TemplateResponse
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -28,8 +29,7 @@ class AdminSection implements IIconSection
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected IURLGenerator $url,
|
protected IURLGenerator $url,
|
||||||
protected IL10N $l
|
protected IL10N $l
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
|
|
@ -46,9 +46,6 @@ class AdminSection implements IIconSection
|
||||||
return 70;
|
return 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getIcon()
|
public function getIcon()
|
||||||
{
|
{
|
||||||
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -23,7 +24,6 @@ use OCA\SideMenu\Service\AppRepository;
|
||||||
use OCA\SideMenu\Service\ConfigProxy;
|
use OCA\SideMenu\Service\ConfigProxy;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OCP\Settings\ISettings;
|
use OCP\Settings\ISettings;
|
||||||
|
|
||||||
|
|
@ -31,12 +31,10 @@ class Personal implements ISettings
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected IL10N $l,
|
protected IL10N $l,
|
||||||
protected ILogger $logger,
|
|
||||||
protected ConfigProxy $config,
|
protected ConfigProxy $config,
|
||||||
protected IUserSession $userSession,
|
protected IUserSession $userSession,
|
||||||
protected AppRepository $appRepository
|
protected AppRepository $appRepository
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TemplateResponse
|
* @return TemplateResponse
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
|
|
@ -30,8 +31,7 @@ class PersonalSection implements IIconSection
|
||||||
protected IURLGenerator $url,
|
protected IURLGenerator $url,
|
||||||
protected IL10N $l,
|
protected IL10N $l,
|
||||||
protected ConfigProxy $configProxy
|
protected ConfigProxy $configProxy
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
public function getID()
|
public function getID()
|
||||||
{
|
{
|
||||||
|
|
@ -60,9 +60,6 @@ class PersonalSection implements IIconSection
|
||||||
return 70;
|
return 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getIcon()
|
public function getIcon()
|
||||||
{
|
{
|
||||||
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue