diff --git a/CHANGELOG.md b/CHANGELOG.md index f96bb7d..54b00a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,5 @@ ## [Unreleased] -## 5.1.1 -### Fixed -* fix(build): define appName to fix this error: "The `@nextcloud/vue` library was used without setting / replacing the `appName`" -* fix #349: add custom controller to retrieve core apps - -## 5.1.0 -### Added -* fix #425: allow to set a color using hex code -### Fixed -* #422: usage of `OC\AppFramework\Http\Request` instead of `$_SERVER` - -## 5.0.3 -### Fixed -* fix #422: undefined array key "HTTP_USER_AGENT" - -## 5.0.2 -### Fixed -* fix #413: add user-agent check for memories mobile app -* fix #418: allow non admin user to access their settings - -## 5.0.1 -### Fixed -* fix(StandardMenu): appLimit must return a value > 0 - ## 5.0.0 ### Fixed * fix apps's order in the standard menu diff --git a/README.md b/README.md index 48614bf..bf8abbb 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ You like this app and you want to support me? ☕ [Buy me a coffee](https://www. Requirements ------------ -* PHP >= 8.1 +* PHP >= 8.0 +* App `theming` enabled Installation and upgrade ------------------------ @@ -40,7 +41,7 @@ If you want to install it from source, go to https://gitnet.fr/deblan/side_menu/ ``` $ cd /path/to/nextcloud/apps -$ VERSION=x.y.z; curl -sS https://gitnet.fr/deblan/side_menu/releases/download/v${VERSION}/side_menu_v${VERSION}.tar.gz | tar xvfz - +$ curl -sS https://gitnet.fr/attachments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | tar xvfz - ``` Administrators can edit many settings using the administration page. diff --git a/appinfo/info.xml b/appinfo/info.xml index e5a95b2..f98f716 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -30,7 +30,7 @@ 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/). ]]> - 5.1.1 + 5.0.0 agpl Simon Vieille SideMenu diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 0f73c70..2d4f364 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -2,9 +2,8 @@ namespace OCA\SideMenu\AppInfo; -use OC\AllConfig; +use OC; use OC\App\AppStore\Fetcher\CategoryFetcher; -use OC\AppFramework\Http\Request; use OC\Security\CSP\ContentSecurityPolicyNonceManager; use OC\User\User; use OCA\SideMenu\Service\AppRepository; @@ -32,12 +31,23 @@ use Psr\Container\ContainerInterface; class Application extends App implements IBootstrap { public const APP_ID = 'side_menu'; + public const APP_NAME = 'Custom menu'; - protected AllConfig $config; - protected ContentSecurityPolicyNonceManager $cspnm; - protected Request $request; - protected ?User $user = null; + /** + * @var OC\AllConfig + */ + protected $config; + + /** + * @var ContentSecurityPolicyNonceManager + */ + protected $cspnm; + + /** + * @var User + */ + protected $user; public function __construct(array $urlParams = []) { @@ -86,7 +96,6 @@ class Application extends App implements IBootstrap $this->config = \OC::$server->getConfig(); $this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager(); $this->user = \OC::$server[IUserSession::class]->getUser(); - $this->request = \OC::$server->getRequest(); if (!$this->isEnabled()) { return; @@ -97,10 +106,6 @@ class Application extends App implements IBootstrap protected function isEnabled(): bool { - if (isset($this->request->server['HTTP_USER_AGENT']) && preg_match('/MemoriesNative/', $this->request->server['HTTP_USER_AGENT'])) { - return false; - } - $enabled = true; $isForced = (bool) $this->config->getAppValue(self::APP_ID, 'force', '0'); diff --git a/lib/Controller/CoreController.php b/lib/Controller/CoreController.php deleted file mode 100644 index 9302ef3..0000000 --- a/lib/Controller/CoreController.php +++ /dev/null @@ -1,74 +0,0 @@ -. - */ - -namespace OCA\SideMenu\Controller; - -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\Attribute\PublicPage; -use OCP\AppFramework\Http\JSONResponse; -use OCP\IRequest; -use OCP\IUserSession; - -class CoreController extends Controller -{ - public function __construct( - string $appName, - IRequest $request, - protected ConfigProxy $config, - protected AppRepository $appRepository, - ) { - parent::__construct($appName, $request); - } - - #[NoCSRFRequired] - #[NoAdminRequired] - #[PublicPage] - #[FrontpageRoute(verb: 'GET', url: '/core/apps')] - public function items(): JSONResponse - { - $user = \OC::$server[IUserSession::class]->getUser(); - $items = []; - - if (!$user) { - return new JSONResponse([ - 'items' => $items, - ]); - } - - $apps = $this->appRepository->getOrderedApps($user); - $keys = ['id', 'name', 'category', 'href', 'icon']; - - foreach ($apps as &$app) { - foreach ($app as $key => $value) { - if (!in_array($key, $keys)) { - unset($app[$key]); - } - } - } - - return new JSONResponse([ - 'items' => $apps, - ]); - } -} diff --git a/lib/Controller/JsController.php b/lib/Controller/JsController.php index 302de3d..a8be206 100644 --- a/lib/Controller/JsController.php +++ b/lib/Controller/JsController.php @@ -20,6 +20,7 @@ namespace OCA\SideMenu\Controller; use OC\User\User; +use OCA\SideMenu\AppInfo\Application; use OCA\SideMenu\Service\ConfigProxy; use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Controller; @@ -28,12 +29,10 @@ 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; use OCP\IUserSession; use OCP\L10N\IFactory; -use OCP\IAvatarManager; -use OCP\INavigationManager; -use OCP\IURLGenerator; class JsController extends Controller { @@ -45,13 +44,14 @@ class JsController extends Controller protected ConfigProxy $config, protected ThemingDefaults $themingDefaults, protected IFactory $l10nFactory, - protected IAvatarManager $avatarManager, - protected IUserSession $userSession, - protected INavigationManager $navigationManager, - protected IURLGenerator $urlGenerator, ) { parent::__construct($appName, $request); - $this->user = $this->userSession->getUser(); + + $this->themingDefaults = $themingDefaults; + + $this->user = \OC::$server[IUserSession::class]->getUser(); + $this->config = $config; + $this->l10nFactory = $l10nFactory; } #[NoCSRFRequired] @@ -99,25 +99,25 @@ class JsController extends Controller $targetBlankApps = $userTargetBlankApps; } - $isAvatarSet = $this->avatarManager->getAvatar($this->user->getUID())->exists(); + $isAvatarSet = \OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists(); if ($useAvatar && $isAvatarSet) { - $avatar = $this->urlGenerator->linkToRoute('core.avatar.getAvatar', [ - 'userId' => $this->user->getUID(), + $avatar = \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [ + 'userId' => $this->user->getUid(), 'size' => 128, 'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0), ]); } if ($this->config->getAppValueBool('show-settings', '0')) { - $settingsNav = $this->navigationManager->getAll('settings'); + $settingsNav = \OC::$server->getNavigationManager()->getAll('settings'); if (isset($settingsNav['settings'])) { $settings = [ 'href' => $settingsNav['settings']['href'], 'name' => $settingsNav['settings']['name'], - 'avatar' => $this->urlGenerator->linkToRoute('core.avatar.getAvatar', [ - 'userId' => $this->user->getUID(), + 'avatar' => \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [ + 'userId' => $this->user->getUid(), 'size' => 32, 'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0), ]), @@ -126,7 +126,7 @@ class JsController extends Controller } } - $indexUrl = $this->urlGenerator->linkTo('', 'index.php'); + $indexUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php'); return [ 'opener-position' => $this->config->getAppValue('opener-position', 'before'), diff --git a/lib/Controller/PersonalSettingController.php b/lib/Controller/PersonalSettingController.php index 285f89c..9b63576 100644 --- a/lib/Controller/PersonalSettingController.php +++ b/lib/Controller/PersonalSettingController.php @@ -98,7 +98,6 @@ class PersonalSettingController extends Controller } #[NoCSRFRequired] - #[NoAdminRequired] #[FrontpageRoute(verb: 'GET', url: '/user/config')] public function configuration(): JSONResponse { diff --git a/package.json b/package.json index 0a23693..b94a22b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "css-loader": "^7.1.2", "eslint": "^9.19.0", "eslint-config-prettier": "^10.0.1", - "eslint-plugin-vue": "^9.32.0", + "eslint-plugin-vue": "^10.0.0", "file-loader": "^6.2.0", "mini-css-extract-plugin": "^2.9.1", "postcss-loader": "^8.1.1", diff --git a/src/components/settings/form/FormColorPicker.vue b/src/components/settings/form/FormColorPicker.vue index 904fa95..d13d578 100644 --- a/src/components/settings/form/FormColorPicker.vue +++ b/src/components/settings/form/FormColorPicker.vue @@ -17,7 +17,6 @@ along with this program. If not, see .