Merge pull request 'release v3.4.0' (#179) from develop into master
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details

Reviewed-on: #179
This commit is contained in:
Simon Vieille 2022-11-20 15:17:23 +01:00
commit fe5ffcb6bf
9 changed files with 320 additions and 35 deletions

View File

@ -12,6 +12,7 @@ pipeline:
commands:
- make build
when:
branch: [master, develop, feature/*]
event: [push, pull_request]
package:

View File

@ -1,5 +1,10 @@
## [Unreleased]
## 3.4.0
### Added
* add translations (thanks to Pavelb, nier, Timur, p-bo)
* add possibility to define Custom Menu as default app and redirect to the first top menu app (#177)
## 3.3.2
### Fixed
* fix #173: reduce the height of categories list

View File

@ -47,6 +47,16 @@ Users can disable the menu using the page of personal settings.
Use the shortcut `Ctrl`+`o` to open and to hide the side menu. Use `tab` to navigate.
### Use first top menu app as default app
You can easily let Custom Menu redirect to the first app in the top menu by changing the following parameter in your `config/config.php`:
```
'defaultapp' => 'side_menu',
```
If the top menu is empty then it redirects to files.
How to contribute?
------------------

View File

@ -32,7 +32,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/).
]]></description>
<version>3.3.2</version>
<version>3.4.0</version>
<licence>agpl</licence>
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
<namespace>SideMenu</namespace>

View File

@ -19,6 +19,7 @@
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'],

View File

@ -0,0 +1,102 @@
<?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 OC;
use OCA\SideMenu\Service\AppRepository;
use OCA\SideMenu\Service\ConfigProxy;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
class AppController extends Controller
{
/**
* @var ConfigProxy
*/
protected $config;
/**
* @var AppRepository
*/
protected $appRepository;
public function __construct(
string $appName,
IRequest $request,
AppRepository $appRepository,
IURLGenerator $urlGenerator,
ConfigProxy $config
) {
parent::__construct($appName, $request);
$this->appRepository = $appRepository;
$this->urlGenerator = $urlGenerator;
$this->config = $config;
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index(): RedirectResponse
{
$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');
$userTopMenuApps = $this->config->getUserValueArray($user, 'top-menu-apps', '[]');
$apps = $this->appRepository->getOrderedApps($user);
if (!$isForced && !empty($userTopMenuApps)) {
$topMenuApps = $userTopMenuApps;
}
foreach ($apps as $app) {
$inTopMenuApps = in_array($app['id'], $topMenuApps);
$inHiddenApps = in_array($app['id'], $hiddenApps);
if (!$inTopMenuApps || $inHiddenApps) {
continue;
}
return $this->redirectToApp($app['id']);
}
return $this->redirectToApp('files');
}
protected function redirectToApp($appId): RedirectResponse
{
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false);
$isFrontControllerActive = 'true' === getenv('front_controller_active');
if ($isIgnoreFrontController || $isFrontControllerActive) {
$path = '/apps/%s/';
} else {
$path = '/index.php/apps/%s/';
}
$url = $this->urlGenerator->getAbsoluteURL(sprintf($path, $appId));
return new RedirectResponse($url);
}
}

View File

@ -3,21 +3,14 @@
"No": "Ne"
"Yes": "Ano"
"Menu": "Nabídka"
? 'Use the shortcut <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span>
to open and to hide the side menu. Use <span class="keyboard-key">tab</span> to
navigate.'
: 'Pro otevření/skrytí postranní nabídky použijte zkratku <span class="keyboard-key">Ctrl</span>+<span
class="keyboard-key">O</span> („O“ jako otevřít). Pro pohyb po použijte klávesu
<span class="keyboard-key">Tab</span>.'
? 'Use the shortcut <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span> to open and to hide the side menu. Use <span class="keyboard-key">tab</span> to navigate.'
: 'Pro otevření/skrytí postranní nabídky použijte zkratku <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">O</span> („O“ jako otevřít). Pro pohyb po použijte klávesu <span class="keyboard-key">Tab</span>.'
"Top menu": "Horní nabídka"
"Apps that not must be moved in the side menu": "Aplikace, které nepřesouvat do postranní\
\ nabídky"
"If there is no selection then the global configuration is applied.": "Pokud neexistuje\
\ žádný výběr, je uplatněno globální nastavení."
"Apps that not must be moved in the side menu": "Aplikace, které nepřesouvat do postranní nabídky"
"If there is no selection then the global configuration is applied.": "Pokud neexistuje žádný výběr, je uplatněno globální nastavení."
"Experimental": "Experimentální"
"Save": "Uložit"
"You like this app and you want to support me?": "Líbí se vám tato aplikace a chcete\
\ podpořit její vývoj?"
"You like this app and you want to support me?": "Líbí se vám tato aplikace a chcete podpořit její vývoj?"
"Buy me a coffee ☕": "Kupte mi kafe ☕"
"Hidden": "Skryté"
"Small": "Malé"
@ -44,21 +37,16 @@
"After the logo": "Za logem"
"Position": "Pozice"
"Show only the opener (hidden logo)": "Zobrazovat pouze otevírací tlačítko (logo skryto)"
"Do not display the side menu and the opener if there is no application (eg: public pages).": "Nezobrazovat\
\ postranní nabídku a její otevírací tlačítko pokud nejsou dostupné žádné aplikace\
\ (např. na veřejných stránkách)."
"Do not display the side menu and the opener if there is no application (eg: public pages).": "Nezobrazovat postranní nabídku a její otevírací tlačítko pokud nejsou dostupné žádné aplikace (např. na veřejných stránkách)."
"Panel": "Panel"
"Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "Otevřít\
\ nabídku při najetím ukazatelem na tlačítko nabídky (automaticky vypnuto pro dotykové\
\ obrazovky)"
"Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "Otevřít nabídku při najetím ukazatelem na tlačítko nabídky (automaticky vypnuto pro dotykové obrazovky)"
"Display the big menu": "Zobrazit velkou nabídku"
"Display the logo": "Zobrazit logo"
"Icons and texts": "Ikony a texty"
"Loader enabled": "Načítání zapnuto"
"Tips": "Tipy"
"Always displayed": "Vždy zobrazeno"
"This is the automatic behavior when the menu is always displayed.": "Toto je automatické\
\ chování, kdy je nabídka vždy zobrazena."
"This is the automatic behavior when the menu is always displayed.": "Toto je automatické chování, kdy je nabídka vždy zobrazena."
"Not compatible with touch screens.": "Nekompatibilní s dotykovými obrazovkami."
"Big menu": "Velká nabídka"
"Live preview": "Živý náhled"
@ -72,13 +60,10 @@
"Export the configuration": "Exportovat nastavení"
"Purge the cache": "Vyprázdnit mezipaměť"
"Show the link to settings": "Zobrazit odkaz na nastavení"
"The menu is enabled by default for users": "Nabídka je ve výchozím stavu pro uživatele\
\ zapnutá"
"The menu is enabled by default for users": "Nabídka je ve výchozím stavu pro uživatele zapnutá"
"Except when the configuration is forced.": "S výjimkou, kdy je nastavení vynuceno."
"Apps that should not be displayed in the menu": "Aplikace, které by neměly být v\
\ nabídce zobrazeny"
"This feature is only compatible with the <code>big menu</code> display.": "Tato funkce\
\ je kompatibilní pouze s <code>velkou nabídkou</code>."
"Apps that should not be displayed in the menu": "Aplikace, které by neměly být v nabídce zobrazeny"
"This feature is only compatible with the <code>big menu</code> display.": "Tato funkce je kompatibilní pouze s <code>velkou nabídkou</code>."
"The logo is a link to the default app": "Logo je odkaz na výchozí aplikaci"
"Others": "Ostatní"
"Categories": "Kategorie"
@ -87,8 +72,7 @@
"Name": "Název"
"Customed": "Přizpůsobeno"
"Show and hide the list of categories": "Zobrazit/skrýt seznam kategorií"
"This parameters are used when Dark theme or Breeze Dark Theme are enabled.": "Tyto\
\ parametry jsou použity v případě, že je zapnutý (Breeze) tmavý motiv vzhledu."
"This parameters are used when Dark theme or Breeze Dark Theme are enabled.": "Tyto parametry jsou použity v případě, že je zapnutý (Breeze) tmavý motiv vzhledu."
"Dark mode colors": "Barvy tmavého režimu"
"With categories": "S kategoriemi"
"Custom categories": "Vlastní kategorie"
@ -102,9 +86,7 @@
"Small text": "Malý text"
"Normal text": "Normální text"
"Big text": "Velký text"
"Applications": "Applications"
"Applications kept in the top menu": "Applications kept in the top menu"
"Applications kept in the top menu but also shown in side menu": "Applications kept\
\ in the top menu but also shown in side menu"
"These applications must be selected in the previous option.": "These applications\
\ must be selected in the previous option."
"Applications": "Aplikace"
"Applications kept in the top menu": "Aplikace ponechané v horní nabídce"
"Applications kept in the top menu but also shown in side menu": "Aplikace ponechané v horní nabídce ale také zobrazené v té boční"
"These applications must be selected in the previous option.": "Tyto aplikace je třeba vybrat v předchozí volbě."

92
src/l10n/fixtures/nl.yaml Normal file
View File

@ -0,0 +1,92 @@
"Custom menu": "Custom menu"
"Enable the custom menu": "Enable the custom menu"
"No": "No"
"Yes": "Yes"
"Menu": "Menu"
? 'Use the shortcut <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span> to open and to hide the side menu. Use <span class="keyboard-key">tab</span> to navigate.'
: 'Use the shortcut <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span> to open and to hide the side menu. Use <span class="keyboard-key">tab</span> to navigate.'
"Top menu": "Top menu"
"Apps that not must be moved in the side menu": "Apps that not must be moved in the side menu"
"If there is no selection then the global configuration is applied.": "If there is no selection then the global configuration is applied."
"Experimental": "Experimental"
"Save": "Save"
"You like this app and you want to support me?": "You like this app and you want to support me?"
"Buy me a coffee ☕": "Buy me a coffee ☕"
"Hidden": "Hidden"
"Small": "Small"
"Normal": "Normal"
"Big": "Big"
"Hidden icon": "Hidden icon"
"Small icon": "Small icon"
"Normal icon": "Normal icon"
"Big icon": "Big icon"
"Hidden text": "Hidden text"
"Small text": "Small text"
"Normal text": "Normal text"
"Big text": "Big text"
"Colors": "Colors"
"Background color": "Background color"
"Background color of current app": "Background color of current app"
"Text color": "Text color"
"Loader": "Loader"
"Icon": "Icon"
"Same color": "Same color"
"Opposite color": "Opposite color"
"Transparent": "Transparent"
"Opaque": "Opaque"
"Opener": "Opener"
"Default": "Default"
"Default (dark)": "Default (dark)"
"Hamburger": "Hamburger"
"Hamburger (dark)": "Hamburger (dark)"
"Hamburger 2": "Hamburger 2"
"Hamburger 2 (dark)": "Hamburger 2 (dark)"
"Before the logo": "Before the logo"
"After the logo": "After the logo"
"Position": "Position"
"Show only the opener (hidden logo)": "Show only the opener (hidden logo)"
"Do not display the side menu and the opener if there is no application (eg: public pages).": "Do not display the side menu and the opener if there is no application (eg: public pages)."
"Panel": "Panel"
"Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "Open the menu when the mouse is hover the opener (automatically disabled on touch screens)"
"Display the big menu": "Display the big menu"
"Display the logo": "Display the logo"
"Icons and texts": "Icons and texts"
"Loader enabled": "Loader enabled"
"Tips": "Tips"
"Always displayed": "Always displayed"
"This is the automatic behavior when the menu is always displayed.": "This is the automatic behavior when the menu is always displayed."
"Not compatible with touch screens.": "Not compatible with touch screens."
"Big menu": "Big menu"
"Live preview": "Live preview"
"Open apps in new tab": "Open apps in new tab"
"Use the global setting": "Use the global setting"
"Use my selection": "Use my selection"
"Show and hide the list of applications": "Show and hide the list of applications"
"Use the avatar instead of the logo": "Use the avatar instead of the logo"
"You do not have permission to change the settings.": "You do not have permission to change the settings."
"Force this configuration to users": "Force this configuration to users"
"Export the configuration": "Export the configuration"
"Purge the cache": "Purge the cache"
"Show the link to settings": "Show the link to settings"
"The menu is enabled by default for users": "The menu is enabled by default for users"
"Except when the configuration is forced.": "Except when the configuration is forced."
"Apps that should not be displayed in the menu": "Apps that should not be displayed in the menu"
"This feature is only compatible with the <code>big menu</code> display.": "This feature is only compatible with the <code>big menu</code> display."
"The logo is a link to the default app": "The logo is a link to the default app"
"Others": "Others"
"Categories": "Categories"
"Customize sorting": "Customize sorting"
"Order by": "Order by"
"Name": "Name"
"Customed": "Customed"
"Show and hide the list of categories": "Show and hide the list of categories"
"This parameters are used when Dark theme or Breeze Dark Theme are enabled.": "This parameters are used when Dark theme or Breeze Dark Theme are enabled."
"Dark mode colors": "Dark mode colors"
"With categories": "With categories"
"Custom categories": "Custom categories"
"Customize application categories": "Customize application categories"
"Reset to default": "Reset to default"
"Applications": "Applications"
"Applications kept in the top menu": "Applications kept in the top menu"
"Applications kept in the top menu but also shown in side menu": "Applications kept in the top menu but also shown in side menu"
"These applications must be selected in the previous option.": "These applications must be selected in the previous option."

92
src/l10n/fixtures/ru.yaml Normal file
View File

@ -0,0 +1,92 @@
"Custom menu": "Custom menu"
"Enable the custom menu": "Enable the custom menu"
"No": "Нет"
"Yes": "Да"
"Menu": "Меню"
? 'Use the shortcut <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span> to open and to hide the side menu. Use <span class="keyboard-key">tab</span> to navigate.'
: 'Используйте сочетание клавиш <span class="keyboard-key">Ctrl</span>+<span class="keyboard-key">o</span>, чтобы открыть или скрыть боковое меню. Используйте <span class="keyboard-key">Tab</span> для навигации.'
"Top menu": "Верхнее меню"
"Apps that not must be moved in the side menu": "Приложения не перемещаемые в боковое меню"
"If there is no selection then the global configuration is applied.": "If there is no selection then the global configuration is applied."
"Experimental": "Экспериментальный"
"Save": "Сохранить"
"You like this app and you want to support me?": "Вам нравится приложение или вы хотите поддержать меня?"
"Buy me a coffee ☕": "Купить мне чашку кофе ☕"
"Hidden": "Скрыто"
"Small": "Маленький"
"Normal": "Средний"
"Big": "Большой"
"Hidden icon": "Скрытая иконка"
"Small icon": "Маленькая иконка"
"Normal icon": "Средняя иконка"
"Big icon": "Большая иконка"
"Hidden text": "Скрытый текст"
"Small text": "Маленький текст"
"Normal text": "Средний текст"
"Big text": "Большой текст"
"Colors": "Цвета"
"Background color": "Цвет фона"
"Background color of current app": "Цвет фона выбранного приложения"
"Text color": "Цвет текста"
"Loader": "Загрузчик"
"Icon": "Иконка"
"Same color": "Такой же цвет"
"Opposite color": "Opposite color"
"Transparent": "Прозрачный"
"Opaque": "Opaque"
"Opener": "Opener"
"Default": "По-умолчанию"
"Default (dark)": "По-умолчанию (тёмный)"
"Hamburger": "Гамбургер"
"Hamburger (dark)": "Гамбургер (тёмный)"
"Hamburger 2": "Гамбургер 2"
"Hamburger 2 (dark)": "Гамбургер 2 (тёмный)"
"Before the logo": "Перед логотипом"
"After the logo": "После логотипа"
"Position": "Позиция"
"Show only the opener (hidden logo)": "Show only the opener (hidden logo)"
"Do not display the side menu and the opener if there is no application (eg: public pages).": "Do not display the side menu and the opener if there is no application (eg: public pages)."
"Panel": "Панеот"
"Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "Open the menu when the mouse is hover the opener (automatically disabled on touch screens)"
"Display the big menu": "Отобразить большое меню"
"Display the logo": "Показать лого"
"Icons and texts": "Иконки и текст"
"Loader enabled": "Loader enabled"
"Tips": "Советы"
"Always displayed": "Всегда отображается"
"This is the automatic behavior when the menu is always displayed.": "This is the automatic behavior when the menu is always displayed."
"Not compatible with touch screens.": "Не совместимо с сенсорными экранами"
"Big menu": "Большое меню"
"Live preview": "Live preview"
"Open apps in new tab": "Открывать приложения в новой вкладке"
"Use the global setting": "Use the global setting"
"Use my selection": "Use my selection"
"Show and hide the list of applications": "Показать или скрыть список приложений"
"Use the avatar instead of the logo": "Использовать аватар вместо логотипа"
"You do not have permission to change the settings.": "У вас нет разрешения изменять настройки"
"Force this configuration to users": "Force this configuration to users"
"Export the configuration": "Экспортировать конфигурацию"
"Purge the cache": "Очистить кэш"
"Show the link to settings": "Show the link to settings"
"The menu is enabled by default for users": "The menu is enabled by default for users"
"Except when the configuration is forced.": "Except when the configuration is forced."
"Apps that should not be displayed in the menu": "Apps that should not be displayed in the menu"
"This feature is only compatible with the <code>big menu</code> display.": "This feature is only compatible with the <code>big menu</code> display."
"The logo is a link to the default app": "The logo is a link to the default app"
"Others": "Прочие"
"Categories": "Категории"
"Customize sorting": "Customize sorting"
"Order by": "В порядке"
"Name": "Название"
"Customed": "Customed"
"Show and hide the list of categories": "Показать или скрыть список категорий"
"This parameters are used when Dark theme or Breeze Dark Theme are enabled.": "This parameters are used when Dark theme or Breeze Dark Theme are enabled."
"Dark mode colors": "Цвета тёмной темы"
"With categories": "С категориями"
"Custom categories": "Custom categories"
"Customize application categories": "Customize application categories"
"Reset to default": "Сбросить к значениям по-умолчанию"
"Applications": "Приложения"
"Applications kept in the top menu": "Applications kept in the top menu"
"Applications kept in the top menu but also shown in side menu": "Applications kept in the top menu but also shown in side menu"
"These applications must be selected in the previous option.": "These applications must be selected in the previous option."