forked from deblan/side_menu
Compare commits
1 commit
develop
...
renovate/j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45105f4690 |
19 changed files with 164 additions and 178 deletions
|
|
@ -18,12 +18,9 @@ steps:
|
|||
|
||||
"Create signature":
|
||||
image: nextcloud:25
|
||||
secrets: [app_certificate, app_public_certificate]
|
||||
volumes: *volumes
|
||||
environment:
|
||||
APP_CERTIFICATE:
|
||||
from_secret: app_certificate
|
||||
APP_PUBLIC_CERTIFICATE:
|
||||
from_secret: app_public_certificate
|
||||
SQLITE_DATABASE: /var/www/data/data.db
|
||||
NEXTCLOUD_ADMIN_USER: admin
|
||||
NEXTCLOUD_ADMIN_PASSWORD: admin
|
||||
|
|
@ -42,9 +39,7 @@ steps:
|
|||
"Create package":
|
||||
image: deblan/php:8.3
|
||||
volumes: *volumes
|
||||
environment:
|
||||
APP_CERTIFICATE:
|
||||
from_secret: app_certificate
|
||||
secrets: [app_certificate]
|
||||
commands:
|
||||
- cd "/builds/$CI_COMMIT_SHA"
|
||||
- apt-get update
|
||||
|
|
|
|||
19
CHANGELOG.md
19
CHANGELOG.md
|
|
@ -1,24 +1,5 @@
|
|||
## [Unreleased]
|
||||
|
||||
## 4.1.1
|
||||
### Fixed
|
||||
* fix(CssController): add missing NoCSRFRequired import (#397)
|
||||
* fix(SideMenu): ncApps must be an array (#369)
|
||||
|
||||
## 4.1.0
|
||||
### Added
|
||||
* add compatibility with NC31
|
||||
### Fixed
|
||||
* fix(service): add service constructor arguments
|
||||
* fix(settings): remove non-existing and unused ILogger service
|
||||
### Changed
|
||||
* refactor(controller): usage of attributes instead of annotations
|
||||
|
||||
## 4.0.1
|
||||
### Fixed
|
||||
* fix top menu labels (fix #368)
|
||||
* fix #369: The menu is displayed even if there are no apps
|
||||
|
||||
## 4.0.0
|
||||
### Added
|
||||
* add compatibility with NC30
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
||||
<?xml version="1.0"?>
|
||||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
||||
<id>side_menu</id>
|
||||
<name>Custom menu</name>
|
||||
<summary>Modify the display of the menu.</summary>
|
||||
|
|
@ -16,7 +17,7 @@ You can report a bug or request a feature by opening an issue.
|
|||
|
||||
Requirements:
|
||||
|
||||
* PHP >= 8.1
|
||||
* PHP >= 8.0
|
||||
* App `theming` enabled
|
||||
|
||||
If you like this application and if you want to support the development:
|
||||
|
|
@ -31,9 +32,9 @@ Notice
|
|||
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/).
|
||||
]]></description>
|
||||
<version>4.1.1</version>
|
||||
<version>4.0.0</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="contact@deblan.fr" homepage="https://www.deblan.fr/">Simon Vieille</author>
|
||||
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
||||
<namespace>SideMenu</namespace>
|
||||
<documentation>
|
||||
<admin>https://deblan.gitnet.page/side_menu_doc/</admin>
|
||||
|
|
@ -41,20 +42,20 @@ In case of downtime, you can download **Custom Menu** from [here](https://kim.de
|
|||
</documentation>
|
||||
<category>customization</category>
|
||||
<website>https://gitnet.fr/deblan/side_menu</website>
|
||||
<discussion><![CDATA[https://matrix.to/#/!TFPucDATKODpHNVAtu:neutralnetwork.org?via=neutralnetwork.org]]></discussion>
|
||||
<discussion>https://matrix.to/#/!TFPucDATKODpHNVAtu:neutralnetwork.org?via=neutralnetwork.org</discussion>
|
||||
<bugs>https://gitnet.fr/deblan/side_menu/issues</bugs>
|
||||
<repository type="git">https://gitnet.fr/deblan/side_menu</repository>
|
||||
<screenshot><![CDATA[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/admin_settings.png]]></screenshot>
|
||||
<screenshot><![CDATA[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/nc18_menu_always_displayed.png]]></screenshot>
|
||||
<screenshot><![CDATA[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/personal_settings.png]]></screenshot>
|
||||
<screenshot><![CDATA[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_default_menu.png]]></screenshot>
|
||||
<screenshot>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>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>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>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>
|
||||
<dependencies>
|
||||
<php min-version="8.1" max-version="8.4" />
|
||||
<nextcloud min-version="30" max-version="32"/>
|
||||
<nextcloud min-version="30" max-version="30"/>
|
||||
<php min-version="8.0"/>
|
||||
</dependencies>
|
||||
<settings>
|
||||
<admin>OCA\SideMenu\Settings\Admin</admin>
|
||||
|
|
|
|||
31
appinfo/routes.php
Normal file
31
appinfo/routes.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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,7 +3,6 @@
|
|||
namespace OCA\SideMenu\AppInfo;
|
||||
|
||||
use OC;
|
||||
use OC\App\AppStore\Fetcher\CategoryFetcher;
|
||||
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
|
||||
use OC\User\User;
|
||||
use OCA\SideMenu\Service\AppRepository;
|
||||
|
|
@ -13,11 +12,7 @@ use OCP\AppFramework\App;
|
|||
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IConfig;
|
||||
use OCP\INavigationManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Util;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
|
@ -31,7 +26,6 @@ class Application extends App implements IBootstrap
|
|||
public const APP_ID = 'side_menu';
|
||||
|
||||
public const APP_NAME = 'Custom menu';
|
||||
|
||||
/**
|
||||
* @var OC\AllConfig
|
||||
*/
|
||||
|
|
@ -47,55 +41,14 @@ class Application extends App implements IBootstrap
|
|||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $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
|
||||
{
|
||||
$enabled = true;
|
||||
|
|
@ -144,14 +97,38 @@ class Application extends App implements IBootstrap
|
|||
$cache = $this->config->getAppValue(self::APP_ID, 'cache', '0');
|
||||
|
||||
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;
|
||||
|
||||
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,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -21,8 +20,6 @@ namespace OCA\SideMenu\Controller;
|
|||
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
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\RedirectResponse;
|
||||
use OCP\IConfig;
|
||||
|
|
@ -40,8 +37,9 @@ class AdminSettingController extends Controller
|
|||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/admin/cache/remove')]
|
||||
/**
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function removeCache(): RedirectResponse
|
||||
{
|
||||
$this->config->setAppValue(Application::APP_ID, 'cache-categories', '[]');
|
||||
|
|
@ -51,8 +49,9 @@ class AdminSettingController extends Controller
|
|||
]).'#more');
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/admin/config/export')]
|
||||
/**
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function exportConfiguration(): DataDownloadResponse
|
||||
{
|
||||
$keys = $this->config->getAppKeys(Application::APP_ID);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -19,12 +18,10 @@
|
|||
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OC;
|
||||
use OCA\SideMenu\Service\AppRepository;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
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\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
|
|
@ -42,12 +39,13 @@ class AppController extends Controller
|
|||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function index(): RedirectResponse
|
||||
{
|
||||
$user = \OC::$server[IUserSession::class]->getUser();
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
|
||||
$hiddenApps = $this->config->getAppValueArray('big-menu-hidden-apps', '[]');
|
||||
$isForced = $this->config->getAppValueBool('force', '0');
|
||||
|
|
@ -75,7 +73,7 @@ class AppController extends Controller
|
|||
protected function redirectToApp($app, bool $isHref = false): RedirectResponse
|
||||
{
|
||||
if (!$isHref) {
|
||||
$isIgnoreFrontController = true === \OC::$server->getConfig()->getSystemValue(
|
||||
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue(
|
||||
'htaccess.IgnoreFrontController',
|
||||
false
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -19,15 +18,14 @@
|
|||
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OC;
|
||||
use OC\User\User;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
use OCA\SideMenu\Service\Color;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
use OCA\Theming\ThemingDefaults;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
|
||||
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
|
||||
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||
use OCP\AppFramework\Http\Response;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -45,13 +43,14 @@ class CssController extends Controller
|
|||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->user = \OC::$server[IUserSession::class]->getUser();
|
||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/css/stylesheet')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
public function stylesheet(): TemplateResponse
|
||||
{
|
||||
$response = new TemplateResponse(Application::APP_ID, 'css/stylesheet', $this->getConfig(), 'blank');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -19,15 +18,12 @@
|
|||
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OC;
|
||||
use OC\User\User;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
use OCA\Theming\ThemingDefaults;
|
||||
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\TemplateResponse;
|
||||
use OCP\IRequest;
|
||||
|
|
@ -49,15 +45,16 @@ class JsController extends Controller
|
|||
|
||||
$this->themingDefaults = $themingDefaults;
|
||||
|
||||
$this->user = \OC::$server[IUserSession::class]->getUser();
|
||||
$this->user = OC::$server[IUserSession::class]->getUser();
|
||||
$this->config = $config;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/js/script')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
public function script(): TemplateResponse
|
||||
{
|
||||
$response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
|
||||
|
|
@ -66,10 +63,11 @@ class JsController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/js/config')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
public function config(): JSONResponse
|
||||
{
|
||||
return new JSONResponse($this->getConfig());
|
||||
|
|
@ -111,10 +109,10 @@ class JsController extends Controller
|
|||
$targetBlankApps = $userTargetBlankApps;
|
||||
}
|
||||
|
||||
$isAvatarSet = \OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists();
|
||||
$isAvatarSet = OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists();
|
||||
|
||||
if ($useAvatar && $isAvatarSet) {
|
||||
$avatar = \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||
$avatar = OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||
'userId' => $this->user->getUid(),
|
||||
'size' => 128,
|
||||
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
||||
|
|
@ -122,13 +120,13 @@ class JsController extends Controller
|
|||
}
|
||||
|
||||
if ($this->config->getAppValueBool('show-settings', '0')) {
|
||||
$settingsNav = \OC::$server->getNavigationManager()->getAll('settings');
|
||||
$settingsNav = OC::$server->getNavigationManager()->getAll('settings');
|
||||
|
||||
if (isset($settingsNav['settings'])) {
|
||||
$settings = [
|
||||
'href' => $settingsNav['settings']['href'],
|
||||
'name' => $settingsNav['settings']['name'],
|
||||
'avatar' => \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||
'avatar' => OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
|
||||
'userId' => $this->user->getUid(),
|
||||
'size' => 32,
|
||||
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
|
||||
|
|
@ -138,7 +136,7 @@ class JsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$indexUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
|
||||
$indexUrl = OC::$server->getURLGenerator()->linkTo('', 'index.php');
|
||||
|
||||
return [
|
||||
'opener-position' => $this->config->getAppValue('opener-position', 'before'),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -19,15 +18,12 @@
|
|||
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OC;
|
||||
use OC\URLGenerator;
|
||||
use OCA\SideMenu\Service\AppRepository;
|
||||
use OCA\SideMenu\Service\CategoryRepository;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
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\IRequest;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -47,13 +43,14 @@ class NavController extends Controller
|
|||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[PublicPage]
|
||||
#[FrontpageRoute(verb: 'GET', url: '/nav/items')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*/
|
||||
public function items(): JSONResponse
|
||||
{
|
||||
$user = \OC::$server[IUserSession::class]->getUser();
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$items = [];
|
||||
|
||||
if (!$user) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -22,9 +21,6 @@ namespace OCA\SideMenu\Controller;
|
|||
use OCA\SideMenu\AppInfo\Application;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
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\IRequest;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -41,9 +37,13 @@ class PersonalSettingController extends Controller
|
|||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
#[NoCSRFRequired]
|
||||
#[NoAdminRequired]
|
||||
#[FrontpageRoute(verb: 'POST', url: '/personalSetting/valueSet')]
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function valueSet($name, $value): array
|
||||
{
|
||||
$doSave = false;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ class CategoryRepository
|
|||
protected IConfig $iConfig,
|
||||
protected IFactory $l10nFactory,
|
||||
protected IUserSession $userSession
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves categories.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -28,19 +27,22 @@ use OCA\SideMenu\Service\LangRepository;
|
|||
use OCA\Theming\ThemingDefaults;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
class Admin implements ISettings
|
||||
{
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
protected ILogger $logger,
|
||||
protected ConfigProxy $config,
|
||||
protected AppRepository $appRepository,
|
||||
protected CategoryRepository $categoryRepository,
|
||||
protected ThemingDefaults $theming,
|
||||
protected Color $color,
|
||||
protected LangRepository $langRepository
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -29,7 +28,8 @@ class AdminSection implements IIconSection
|
|||
public function __construct(
|
||||
protected IURLGenerator $url,
|
||||
protected IL10N $l
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
|
|
@ -46,6 +46,9 @@ class AdminSection implements IIconSection
|
|||
return 70;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIcon()
|
||||
{
|
||||
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -24,6 +23,7 @@ use OCA\SideMenu\Service\AppRepository;
|
|||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IL10N;
|
||||
use OCP\ILogger;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
|
|
@ -31,10 +31,12 @@ class Personal implements ISettings
|
|||
{
|
||||
public function __construct(
|
||||
protected IL10N $l,
|
||||
protected ILogger $logger,
|
||||
protected ConfigProxy $config,
|
||||
protected IUserSession $userSession,
|
||||
protected AppRepository $appRepository
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
|
|
@ -31,7 +30,8 @@ class PersonalSection implements IIconSection
|
|||
protected IURLGenerator $url,
|
||||
protected IL10N $l,
|
||||
protected ConfigProxy $configProxy
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
|
|
@ -60,6 +60,9 @@ class PersonalSection implements IIconSection
|
|||
return 70;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIcon()
|
||||
{
|
||||
return $this->url->imagePath(Application::APP_ID, 'icon.svg');
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
"exports-loader": "^5.0.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"handlebars-loader": "^1.7.3",
|
||||
"jasmine-core": "~2.5.2",
|
||||
"jasmine-core": "~2.99.0",
|
||||
"jasmine-sinon": "^0.4.0",
|
||||
"jsdoc": "^4.0.2",
|
||||
"raw-loader": "^4.0.2",
|
||||
|
|
|
|||
|
|
@ -110,16 +110,14 @@ export default defineComponent({
|
|||
mounted() {
|
||||
axios.get(generateOcsUrl('core/navigation', 2) + '/apps?format=json')
|
||||
.then((response) => response.data)
|
||||
.then((data) => {
|
||||
.then((data) => {
|
||||
if (data.ocs.meta.statuscode !== 200) {
|
||||
return
|
||||
}
|
||||
|
||||
this.setApps(data.ocs.data)
|
||||
})
|
||||
})
|
||||
|
||||
this.targetBlankApps = window.targetBlankApps
|
||||
this.hiddenLabels = window.topMenuAppsMouseOverHiddenLabel
|
||||
let timeout = null
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<ul class="side-menu-apps-list" :class="{'side-menu-apps-list--with-settings': !!settings}">
|
||||
<SideMenuApp
|
||||
v-for="(app, key) in apps"
|
||||
v-if="searchMatch(app.name)"
|
||||
v-if="!hiddenApps.includes(app.id) && searchMatch(app.name)"
|
||||
v-bind:classes="{'side-menu-app': true, 'active': app.active}"
|
||||
v-bind:key="key"
|
||||
v-bind:icon="app.icon"
|
||||
|
|
@ -86,7 +86,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
retrieveApps() {
|
||||
const ncApps = loadState('core', 'apps', [])
|
||||
const ncApps = loadState('core', 'apps', {})
|
||||
let orders = {}
|
||||
let finalApps = []
|
||||
|
||||
|
|
@ -94,16 +94,17 @@ export default {
|
|||
orders[app] = order + 1
|
||||
})
|
||||
|
||||
for (let app of ncApps) {
|
||||
if (window.topMenuApps.includes(app.id) && !window.topSideMenuApps.includes(app.id)) {
|
||||
for (let id in ncApps) {
|
||||
if (window.topMenuApps.includes(id) && !window.topSideMenuApps.includes(id)) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (this.hiddenApps.includes(app.id)) {
|
||||
if (this.hiddenApps.includes(id)) {
|
||||
continue
|
||||
}
|
||||
|
||||
app.order = orders[app.id] || null
|
||||
let app = ncApps[id]
|
||||
app.order = orders[id] || null
|
||||
|
||||
finalApps.push(app)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue