Compare commits

..

32 Commits

Author SHA1 Message Date
Simon Vieille 2b84ed37e8 Merge pull request 'release 5.1.1' (#433) from develop into master
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/433
2025-05-23 09:15:12 +02:00
Simon Vieille 3f16a674e6 release v5.1.1 2025-05-23 09:02:11 +02:00
Simon Vieille 782faf6add update changelog 2025-05-04 18:34:29 +02:00
Simon Vieille 92d15d161b Merge pull request 'fix #349: add custom controller to retrieve core apps' (#431) from bugfix/issue349-components-apps into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/431
2025-05-04 18:31:36 +02:00
Simon Vieille cd4b3b1054 fix #349: add custom controller to retrieve core apps 2025-05-04 18:24:32 +02:00
Simon Vieille f58dedf553 fix(build): define appName to fix this error: "The '@nextcloud/vue' library was used without setting / replacing the 'appName'" 2025-05-04 13:11:05 +02:00
Simon Vieille a4e459d8ed Merge pull request 'release v5.1.0' (#428) from develop into master
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/428
2025-04-30 13:01:55 +02:00
Simon Vieille 8c6f0ad1da release v5.1.0 2025-04-30 13:01:22 +02:00
Simon Vieille 7485a5b349 Merge pull request 'fix #425: allow to set a color using hex code' (#427) from feature/issue425-colorpicker into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/427
2025-04-30 13:00:29 +02:00
Simon Vieille b0e01c2eec update changelog 2025-04-30 12:57:49 +02:00
Simon Vieille d2730afe9f fix #425: allow to set a color using hex code 2025-04-30 12:57:13 +02:00
Simon Vieille 33ab7dff97 update changelog 2025-04-30 12:50:51 +02:00
Simon Vieille 0da550e3eb Merge pull request 'Use Request object' (#426) from llaumgui-develop into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/426
2025-04-30 12:47:23 +02:00
Simon Vieille 4bea4afb07 refactor(Application): add properties types 2025-04-30 12:45:32 +02:00
llaumgui d485b728e7 Use Request object 2025-04-30 09:30:35 +02:00
Simon Vieille 9fea794e2f Merge pull request 'release v5.0.3' (#423) from develop into master
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/423
2025-04-30 08:42:11 +02:00
Simon Vieille 8772504b76 release v5.0.3 2025-04-30 08:41:10 +02:00
Simon Vieille 75bea4be38 Merge pull request 'Update lib/AppInfo/Application.php' (#421) from Monica-Wood/side_menu:http_user_agent_check_patch into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/421
Reviewed-by: Simon Vieille <contact@deblan.fr>
2025-04-30 08:37:15 +02:00
Monica-Wood 8787918547 Update lib/AppInfo/Application.php
The current change is currently filling the nextcloud logs up with the error:
`Undefined array key \"HTTP_USER_AGENT\" at /srv/www/nextcloud/apps/side_menu/lib/AppInfo/Application.php#109`

This adds a check to ensure the index exists before read it.
2025-04-30 07:31:13 +02:00
Simon Vieille 55967ff81e Merge pull request 'release v5.0.2' (#420) from develop into master
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/420
2025-04-29 19:29:38 +02:00
Simon Vieille 1fcbd89d19 release v5.0.2 2025-04-29 19:26:07 +02:00
Simon Vieille f177340b13 update changelog 2025-04-29 19:24:04 +02:00
Simon Vieille aaa7afac51 Merge pull request 'fix #418: allow non admin user to access their settings' (#419) from bugfix/issue418-userconfigaccess into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/419
2025-04-29 19:23:27 +02:00
Simon Vieille fd4628d209 update changelog 2025-04-29 19:22:25 +02:00
Simon Vieille f9aa59ca04 fix #418: allow non admin user to access their settings 2025-04-29 19:21:17 +02:00
Simon Vieille 95e4ef136e Merge pull request 'fix #413: add user-agent check for memories mobile app' (#414) from bugfix/issues413-memories into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/414
2025-04-18 10:36:15 +02:00
Simon Vieille c0eb65547d fix #413: add user-agent check for memories mobile app 2025-04-17 15:15:03 +02:00
Simon Vieille 29d061c379 update readme 2025-04-17 08:48:14 +02:00
Simon Vieille 12604b44fc Merge pull request 'fix(StandardMenu): appLimit must return a value > 0' (#412) from develop into master
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/412
2025-04-17 00:05:38 +02:00
Simon Vieille 8e22d9ea62 Merge pull request 'bugfix/standard-menu-mobile' (#411) from bugfix/standard-menu-mobile into develop
Reviewed-on: https://gitnet.fr/deblan/side_menu/pulls/411
2025-04-17 00:04:48 +02:00
Simon Vieille 8957f1ae78 update app info 2025-04-17 00:03:04 +02:00
Simon Vieille 7b4b447754 fix(StandardMenu): appLimit must return a value > 0 2025-04-17 00:02:47 +02:00
10 changed files with 132 additions and 32 deletions
+24
View File
@@ -1,5 +1,29 @@
## [Unreleased] ## [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 ## 5.0.0
### Fixed ### Fixed
* fix apps's order in the standard menu * fix apps's order in the standard menu
+2 -3
View File
@@ -24,8 +24,7 @@ You like this app and you want to support me? ☕ [Buy me a coffee](https://www.
Requirements Requirements
------------ ------------
* PHP >= 8.0 * PHP >= 8.1
* App `theming` enabled
Installation and upgrade 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 $ 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. Administrators can edit many settings using the administration page.
+1 -1
View File
@@ -30,7 +30,7 @@ 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>5.0.0</version> <version>5.1.1</version>
<licence>agpl</licence> <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.fr/">Simon Vieille</author>
<namespace>SideMenu</namespace> <namespace>SideMenu</namespace>
+11 -16
View File
@@ -2,8 +2,9 @@
namespace OCA\SideMenu\AppInfo; namespace OCA\SideMenu\AppInfo;
use OC; use OC\AllConfig;
use OC\App\AppStore\Fetcher\CategoryFetcher; use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\AppFramework\Http\Request;
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;
@@ -31,23 +32,12 @@ use Psr\Container\ContainerInterface;
class Application extends App implements IBootstrap 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';
/** protected AllConfig $config;
* @var OC\AllConfig protected ContentSecurityPolicyNonceManager $cspnm;
*/ protected Request $request;
protected $config; protected ?User $user = null;
/**
* @var ContentSecurityPolicyNonceManager
*/
protected $cspnm;
/**
* @var User
*/
protected $user;
public function __construct(array $urlParams = []) public function __construct(array $urlParams = [])
{ {
@@ -96,6 +86,7 @@ class Application extends App implements IBootstrap
$this->config = \OC::$server->getConfig(); $this->config = \OC::$server->getConfig();
$this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager(); $this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
$this->user = \OC::$server[IUserSession::class]->getUser(); $this->user = \OC::$server[IUserSession::class]->getUser();
$this->request = \OC::$server->getRequest();
if (!$this->isEnabled()) { if (!$this->isEnabled()) {
return; return;
@@ -106,6 +97,10 @@ class Application extends App implements IBootstrap
protected function isEnabled(): bool 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; $enabled = true;
$isForced = (bool) $this->config->getAppValue(self::APP_ID, 'force', '0'); $isForced = (bool) $this->config->getAppValue(self::APP_ID, 'force', '0');
+74
View File
@@ -0,0 +1,74 @@
<?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/>.
*/
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,
]);
}
}
@@ -98,6 +98,7 @@ class PersonalSettingController extends Controller
} }
#[NoCSRFRequired] #[NoCSRFRequired]
#[NoAdminRequired]
#[FrontpageRoute(verb: 'GET', url: '/user/config')] #[FrontpageRoute(verb: 'GET', url: '/user/config')]
public function configuration(): JSONResponse public function configuration(): JSONResponse
{ {
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template> <template>
<NcColorPicker <NcColorPicker
v-model="model" v-model="model"
:advancedFields="true"
class="cm-settings-form-colorpicker" class="cm-settings-form-colorpicker"
> >
<div <div
+13 -8
View File
@@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:data-app-id="app.id" :data-app-id="app.id"
class="app-menu-entry" class="app-menu-entry"
:class="{ :class="{
'app-menu-entry__active': app.active, 'app-menu-entry__active': app.id === activeApp,
'app-menu-entry__hidden-label': hiddenLabels === 1, 'app-menu-entry__hidden-label': hiddenLabels === 1,
'app-menu-main__show-hovered': hiddenLabels === 2, 'app-menu-main__show-hovered': hiddenLabels === 2,
}" }"
@@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:class="{ 'has-unread': app.unread > 0 }" :class="{ 'has-unread': app.unread > 0 }"
:aria-label="app.name" :aria-label="app.name"
:target="targetBlankApps.indexOf(app.id) !== -1 ? '_blank' : undefined" :target="targetBlankApps.indexOf(app.id) !== -1 ? '_blank' : undefined"
:aria-current="app.active ? 'page' : false" :aria-current="app.id === activeApp ? 'page' : false"
> >
<img <img
:src="app.icon" :src="app.icon"
@@ -69,7 +69,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
v-for="app in popoverAppList" v-for="app in popoverAppList"
:key="app.id" :key="app.id"
:aria-label="app.name" :aria-label="app.name"
:aria-current="app.active ? 'page' : false" :aria-current="app.id === activeApp ? 'page' : false"
:href="app.href" :href="app.href"
:style="makeStyle(app)" :style="makeStyle(app)"
class="cm-standardmenu-app-menu-popover-entry app-menu-popover-entry" 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 { useConfigStore } from '../store/config.js'
import { useNavStore } from '../store/nav.js' import { useNavStore } from '../store/nav.js'
import { NcActions, NcActionLink } from '@nextcloud/vue' import { NcActions, NcActionLink } from '@nextcloud/vue'
import { getActiveAppId } from '../lib/app.js'
const navStore = useNavStore() const navStore = useNavStore()
const configStore = useConfigStore() const configStore = useConfigStore()
@@ -112,6 +113,7 @@ const topMenuApps = ref([])
const appsOrder = ref([]) const appsOrder = ref([])
const mainAppList = ref([]) const mainAppList = ref([])
const popoverAppList = ref([]) const popoverAppList = ref([])
const activeApp = ref(null)
let resizeTimeout = null let resizeTimeout = null
const setApps = (value) => { 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) => { const makeStyle = (app) => {
@@ -158,6 +160,11 @@ const computeLists = () => {
popoverAppList.value = appList.value.slice(appLimit()).sort((a, b) => a.order - b.order) 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 () => { onMounted(async () => {
const config = await configStore.getConfig() const config = await configStore.getConfig()
@@ -165,14 +172,12 @@ onMounted(async () => {
hiddenLabels.value = config['top-menu-mouse-over-hidden-label'] hiddenLabels.value = config['top-menu-mouse-over-hidden-label']
topMenuApps.value = config['top-menu-apps'] topMenuApps.value = config['top-menu-apps']
appsOrder.value = config['apps-order'] appsOrder.value = config['apps-order']
activeApp.value = getActiveAppId()
ready.value = true ready.value = true
setApps(await navStore.getCoreApps()) setApps(await navStore.getCoreApps())
window.addEventListener('resize', () => { window.addEventListener('resize', reComputeLists)
window.clearTimeout(resizeTimeout)
resizeTimeout = window.setTimeout(computeLists, 100)
})
}) })
</script> </script>
+1 -4
View File
@@ -41,10 +41,7 @@ export const useNavStore = defineStore('nav', () => {
async function getCoreApps() { async function getCoreApps() {
if (coreApps == null) { if (coreApps == null) {
coreApps = await axios coreApps = await await axios.get(generateUrl('/apps/side_menu/core/apps')).then((response) => response.data.items)
.get(generateOcsUrl('core/navigation', 2) + '/apps?format=json')
.then((response) => response.data)
.then((value) => value.ocs.data)
} }
return coreApps return coreApps
+4
View File
@@ -77,6 +77,10 @@ module.exports = {
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'], Buffer: ['buffer', 'Buffer'],
}), }),
new webpack.DefinePlugin({
appName: JSON.stringify(appName),
}),
], ],
resolve: { resolve: {