diff --git a/.woodpecker.yml b/.woodpecker.yml
index aee34a9..d51f01d 100644
--- a/.woodpecker.yml
+++ b/.woodpecker.yml
@@ -12,6 +12,7 @@ pipeline:
commands:
- make build
when:
+ branch: [master, develop, feature/*]
event: [push, pull_request]
package:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e53563a..88309a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/README.md b/README.md
index b1686e0..e5e90b4 100644
--- a/README.md
+++ b/README.md
@@ -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?
------------------
diff --git a/appinfo/info.xml b/appinfo/info.xml
index e3e1ea1..1105b43 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -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/).
]]>
- 3.3.2
+ 3.4.0
agpl
Simon Vieille
SideMenu
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 1efd4b6..bdc3fba 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -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'],
diff --git a/lib/Controller/AppController.php b/lib/Controller/AppController.php
new file mode 100644
index 0000000..1d3de92
--- /dev/null
+++ b/lib/Controller/AppController.php
@@ -0,0 +1,102 @@
+.
+ */
+
+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);
+ }
+}
diff --git a/src/l10n/fixtures/cs.yaml b/src/l10n/fixtures/cs.yaml
index 08033d0..88cedd2 100644
--- a/src/l10n/fixtures/cs.yaml
+++ b/src/l10n/fixtures/cs.yaml
@@ -3,21 +3,14 @@
"No": "Ne"
"Yes": "Ano"
"Menu": "Nabídka"
-? 'Use the shortcut Ctrl+o
- to open and to hide the side menu. Use tab to
- navigate.'
-: 'Pro otevření/skrytí postranní nabídky použijte zkratku Ctrl+O („O“ jako otevřít). Pro pohyb po použijte klávesu
- Tab.'
+? 'Use the shortcut Ctrl+o to open and to hide the side menu. Use tab to navigate.'
+: 'Pro otevření/skrytí postranní nabídky použijte zkratku Ctrl+O („O“ jako otevřít). Pro pohyb po použijte klávesu Tab.'
"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 big menu
display.": "Tato funkce\
- \ je kompatibilní pouze s velkou nabídkou
."
+"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 big menu
display.": "Tato funkce je kompatibilní pouze s velkou nabídkou
."
"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ě."
diff --git a/src/l10n/fixtures/nl.yaml b/src/l10n/fixtures/nl.yaml
new file mode 100644
index 0000000..ad417e6
--- /dev/null
+++ b/src/l10n/fixtures/nl.yaml
@@ -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 Ctrl+o to open and to hide the side menu. Use tab to navigate.'
+: 'Use the shortcut Ctrl+o to open and to hide the side menu. Use tab 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 big menu
display.": "This feature is only compatible with the big menu
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."
diff --git a/src/l10n/fixtures/ru.yaml b/src/l10n/fixtures/ru.yaml
new file mode 100644
index 0000000..50262cb
--- /dev/null
+++ b/src/l10n/fixtures/ru.yaml
@@ -0,0 +1,92 @@
+"Custom menu": "Custom menu"
+"Enable the custom menu": "Enable the custom menu"
+"No": "Нет"
+"Yes": "Да"
+"Menu": "Меню"
+? 'Use the shortcut Ctrl+o to open and to hide the side menu. Use tab to navigate.'
+: 'Используйте сочетание клавиш Ctrl+o, чтобы открыть или скрыть боковое меню. Используйте Tab для навигации.'
+"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 big menu
display.": "This feature is only compatible with the big menu
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."