diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml
index c42146a..ac39564 100644
--- a/.woodpecker/.publish.yml
+++ b/.woodpecker/.publish.yml
@@ -32,7 +32,7 @@ steps:
- echo "$APP_CERTIFICATE" > "/tmp/side_menu.key"
- echo "$APP_PUBLIC_CERTIFICATE" > "/tmp/side_menu.crt"
- mkdir /tmp/app
- - cp -r README.md CHANGELOG.md appinfo css lib img l10n js src templates screenshots vendor /tmp/app
+ - cp -r README.md CHANGELOG.md appinfo lib img l10n js src templates screenshots vendor /tmp/app
- /usr/src/nextcloud/occ integrity:sign-app
--privateKey=/tmp/side_menu.key
--certificate=/tmp/side_menu.crt
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 585c860..f96bb7d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,47 @@
## [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
+### Added
+* add new translations
+* add route `/apps/side_menu/user/config`
+* add new UI for admin and personals settings
+### Changed
+* migrate to Vue 3 and so add/update or remove dependencies
+* replace CSS with SCSS
+* remove route `/apps/side_menu/js/script`
+* remove generated Javascript using PHP
+* rewrite the standard menu of Nextcloud
+### Security
+* fix CVE-2023-44270
+* fix CVE-2024-9506
+* fix CVE-2024-6783
+
## 4.1.1
### Fixed
* fix(CssController): add missing NoCSRFRequired import (#397)
diff --git a/Makefile b/Makefile
index 7803a58..883cccb 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ release:
test -d $$RELEASE_DIRECTORY/$$VERSION && rm -fr $$RELEASE_DIRECTORY/$$VERSION
mkdir -p $$RELEASE_DIRECTORY/$$VERSION/side_menu
- cp -r README.md CHANGELOG.md appinfo css lib img l10n js src templates screenshots vendor $$RELEASE_DIRECTORY/$$VERSION/side_menu
+ cp -r README.md CHANGELOG.md appinfo lib img l10n js src templates screenshots vendor $$RELEASE_DIRECTORY/$$VERSION/side_menu
cd $$RELEASE_DIRECTORY/$$VERSION
zip -r side_menu_v$$VERSION.zip side_menu
tar cvzf side_menu_v$$VERSION.tar.gz side_menu
diff --git a/README.md b/README.md
index bf8abbb..48614bf 100644
--- a/README.md
+++ b/README.md
@@ -24,8 +24,7 @@ You like this app and you want to support me? ☕ [Buy me a coffee](https://www.
Requirements
------------
-* PHP >= 8.0
-* App `theming` enabled
+* PHP >= 8.1
Installation and upgrade
------------------------
@@ -41,7 +40,7 @@ If you want to install it from source, go to https://gitnet.fr/deblan/side_menu/
```
$ cd /path/to/nextcloud/apps
-$ curl -sS https://gitnet.fr/attachments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | tar xvfz -
+$ VERSION=x.y.z; curl -sS https://gitnet.fr/deblan/side_menu/releases/download/v${VERSION}/side_menu_v${VERSION}.tar.gz | tar xvfz -
```
Administrators can edit many settings using the administration page.
diff --git a/appinfo/info.xml b/appinfo/info.xml
index d6a0f5f..e5a95b2 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -10,14 +10,13 @@ This application is rather suitable for instances that activate a lot of applica
Use the shortcut `Ctrl`+`o` to open and to hide the side menu. Use `tab` to navigate.
-You can customize colors depending of the theme (Dark theme and Breeze Dark).
+You can customize colors depending of the theme.
-You can report a bug or request a feature by opening an issue.
+To report a bug or request a feature, please open an issue.
Requirements:
* PHP >= 8.1
-* App `theming` enabled
If you like this application and if you want to support the development:
@@ -31,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/).
]]>
- 4.1.1
+ 5.1.1
agpl
Simon Vieille
SideMenu
@@ -54,7 +53,7 @@ In case of downtime, you can download **Custom Menu** from [here](https://kim.de
-
+
OCA\SideMenu\Settings\Admin
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 906bb71..0f73c70 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -2,8 +2,9 @@
namespace OCA\SideMenu\AppInfo;
-use OC;
+use OC\AllConfig;
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;
@@ -31,23 +32,12 @@ use Psr\Container\ContainerInterface;
class Application extends App implements IBootstrap
{
public const APP_ID = 'side_menu';
-
public const APP_NAME = 'Custom menu';
- /**
- * @var OC\AllConfig
- */
- protected $config;
-
- /**
- * @var ContentSecurityPolicyNonceManager
- */
- protected $cspnm;
-
- /**
- * @var User
- */
- protected $user;
+ protected AllConfig $config;
+ protected ContentSecurityPolicyNonceManager $cspnm;
+ protected Request $request;
+ protected ?User $user = null;
public function __construct(array $urlParams = [])
{
@@ -96,6 +86,7 @@ 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;
@@ -106,6 +97,10 @@ 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');
@@ -128,7 +123,6 @@ class Application extends App implements IBootstrap
protected function addAssets()
{
Util::addScript(self::APP_ID, 'side_menu-menu');
- // Util::addStyle(self::APP_ID, 'sideMenu');
$assets = [
'stylesheet' => [
@@ -139,14 +133,6 @@ class Application extends App implements IBootstrap
'rel' => 'stylesheet',
],
],
- // 'script' => [
- // 'route' => 'side_menu.Js.script',
- // 'type' => 'script',
- // 'route_attr' => 'src',
- // 'attr' => [
- // 'nonce' => $this->cspnm->getNonce(),
- // ],
- // ],
];
$cache = $this->config->getAppValue(self::APP_ID, 'cache', '0');
diff --git a/lib/Controller/CoreController.php b/lib/Controller/CoreController.php
new file mode 100644
index 0000000..9302ef3
--- /dev/null
+++ b/lib/Controller/CoreController.php
@@ -0,0 +1,74 @@
+.
+ */
+
+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 f8c6228..302de3d 100644
--- a/lib/Controller/JsController.php
+++ b/lib/Controller/JsController.php
@@ -20,7 +20,6 @@
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;
@@ -29,10 +28,12 @@ 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
{
@@ -44,26 +45,13 @@ 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->themingDefaults = $themingDefaults;
-
- $this->user = \OC::$server[IUserSession::class]->getUser();
- $this->config = $config;
- $this->l10nFactory = $l10nFactory;
- }
-
- #[NoCSRFRequired]
- #[NoAdminRequired]
- #[PublicPage]
- #[FrontpageRoute(verb: 'GET', url: '/js/script')]
- public function script(): TemplateResponse
- {
- $response = new TemplateResponse(Application::APP_ID, 'js/script', $this->getConfig(), 'blank');
- $response->addHeader('Content-Type', 'text/javascript');
-
- return $response;
+ $this->user = $this->userSession->getUser();
}
#[NoCSRFRequired]
@@ -111,25 +99,25 @@ class JsController extends Controller
$targetBlankApps = $userTargetBlankApps;
}
- $isAvatarSet = \OC::$server->getAvatarManager()->getAvatar($this->user->getUid())->exists();
+ $isAvatarSet = $this->avatarManager->getAvatar($this->user->getUID())->exists();
if ($useAvatar && $isAvatarSet) {
- $avatar = \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
- 'userId' => $this->user->getUid(),
+ $avatar = $this->urlGenerator->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 = \OC::$server->getNavigationManager()->getAll('settings');
+ $settingsNav = $this->navigationManager->getAll('settings');
if (isset($settingsNav['settings'])) {
$settings = [
'href' => $settingsNav['settings']['href'],
'name' => $settingsNav['settings']['name'],
- 'avatar' => \OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', [
- 'userId' => $this->user->getUid(),
+ 'avatar' => $this->urlGenerator->linkToRoute('core.avatar.getAvatar', [
+ 'userId' => $this->user->getUID(),
'size' => 32,
'v' => $this->config->getUserValueInt($this->user, 'avatar', 'version', 0),
]),
@@ -138,7 +126,7 @@ class JsController extends Controller
}
}
- $indexUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
+ $indexUrl = $this->urlGenerator->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 9b63576..285f89c 100644
--- a/lib/Controller/PersonalSettingController.php
+++ b/lib/Controller/PersonalSettingController.php
@@ -98,6 +98,7 @@ class PersonalSettingController extends Controller
}
#[NoCSRFRequired]
+ #[NoAdminRequired]
#[FrontpageRoute(verb: 'GET', url: '/user/config')]
public function configuration(): JSONResponse
{
diff --git a/screenshots/admin_settings.png b/screenshots/admin_settings.png
index 4d7a0e0..eae14bb 100644
Binary files a/screenshots/admin_settings.png and b/screenshots/admin_settings.png differ
diff --git a/screenshots/personal_settings.png b/screenshots/personal_settings.png
index 05a73ee..480063b 100644
Binary files a/screenshots/personal_settings.png and b/screenshots/personal_settings.png differ
diff --git a/src/components/settings/form/FormColorPicker.vue b/src/components/settings/form/FormColorPicker.vue
index d13d578..904fa95 100644
--- a/src/components/settings/form/FormColorPicker.vue
+++ b/src/components/settings/form/FormColorPicker.vue
@@ -17,6 +17,7 @@ along with this program. If not, see .
.
:data-app-id="app.id"
class="app-menu-entry"
:class="{
- 'app-menu-entry__active': app.active,
+ 'app-menu-entry__active': app.id === activeApp,
'app-menu-entry__hidden-label': hiddenLabels === 1,
'app-menu-main__show-hovered': hiddenLabels === 2,
}"
@@ -44,7 +44,7 @@ along with this program. If not, see .
:class="{ 'has-unread': app.unread > 0 }"
:aria-label="app.name"
:target="targetBlankApps.indexOf(app.id) !== -1 ? '_blank' : undefined"
- :aria-current="app.active ? 'page' : false"
+ :aria-current="app.id === activeApp ? 'page' : false"
>
.
v-for="app in popoverAppList"
:key="app.id"
:aria-label="app.name"
- :aria-current="app.active ? 'page' : false"
+ :aria-current="app.id === activeApp ? 'page' : false"
:href="app.href"
:style="makeStyle(app)"
class="cm-standardmenu-app-menu-popover-entry app-menu-popover-entry"
@@ -101,6 +101,7 @@ import { ref, onMounted } from 'vue'
import { useConfigStore } from '../store/config.js'
import { useNavStore } from '../store/nav.js'
import { NcActions, NcActionLink } from '@nextcloud/vue'
+import { getActiveAppId } from '../lib/app.js'
const navStore = useNavStore()
const configStore = useConfigStore()
@@ -112,6 +113,7 @@ const topMenuApps = ref([])
const appsOrder = ref([])
const mainAppList = ref([])
const popoverAppList = ref([])
+const activeApp = ref(null)
let resizeTimeout = null
const setApps = (value) => {
@@ -142,7 +144,7 @@ const appLimit = () => {
})
}
- return Math.floor((body.offsetWidth - size) / 70)
+ return Math.max(0, Math.floor((body.offsetWidth - size) / 70))
}
const makeStyle = (app) => {
@@ -158,6 +160,11 @@ const computeLists = () => {
popoverAppList.value = appList.value.slice(appLimit()).sort((a, b) => a.order - b.order)
}
+const reComputeLists = (delay) => {
+ window.clearTimeout(resizeTimeout)
+ resizeTimeout = window.setTimeout(computeLists, delay || 100)
+}
+
onMounted(async () => {
const config = await configStore.getConfig()
@@ -165,14 +172,12 @@ onMounted(async () => {
hiddenLabels.value = config['top-menu-mouse-over-hidden-label']
topMenuApps.value = config['top-menu-apps']
appsOrder.value = config['apps-order']
+ activeApp.value = getActiveAppId()
ready.value = true
setApps(await navStore.getCoreApps())
- window.addEventListener('resize', () => {
- window.clearTimeout(resizeTimeout)
- resizeTimeout = window.setTimeout(computeLists, 100)
- })
+ window.addEventListener('resize', reComputeLists)
})
diff --git a/src/store/nav.js b/src/store/nav.js
index 03a128e..98abe0d 100644
--- a/src/store/nav.js
+++ b/src/store/nav.js
@@ -41,10 +41,7 @@ export const useNavStore = defineStore('nav', () => {
async function getCoreApps() {
if (coreApps == null) {
- coreApps = await axios
- .get(generateOcsUrl('core/navigation', 2) + '/apps?format=json')
- .then((response) => response.data)
- .then((value) => value.ocs.data)
+ coreApps = await await axios.get(generateUrl('/apps/side_menu/core/apps')).then((response) => response.data.items)
}
return coreApps
diff --git a/webpack.config.js b/webpack.config.js
index d9876e8..0c16d61 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -77,6 +77,10 @@ module.exports = {
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
+
+ new webpack.DefinePlugin({
+ appName: JSON.stringify(appName),
+ }),
],
resolve: {