diff options
author | Marcel Klehr <mklehr@gmx.net> | 2022-08-17 11:21:39 +0300 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2022-08-23 15:30:18 +0300 |
commit | 41da638fc183b82be62e8dfae2f20750a87ffaf4 (patch) | |
tree | b9f352d3ebbeab54ea629604441ac2cbaffbc53f | |
parent | e2101b4240de976e89574e63b378047f2a683379 (diff) |
Implement isRecognizeInstalled check
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
-rw-r--r-- | lib/Controller/PageController.php | 1 | ||||
-rw-r--r-- | src/Photos.vue | 6 | ||||
-rw-r--r-- | src/router/index.js | 8 | ||||
-rw-r--r-- | src/services/IsRecognizeInstalled.js | 26 |
4 files changed, 38 insertions, 3 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index ddfbc50f..ac8deacb 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -104,6 +104,7 @@ class PageController extends Controller { $this->initialStateService->provideInitialState($this->appName, 'image-mimes', Application::IMAGE_MIMES); $this->initialStateService->provideInitialState($this->appName, 'video-mimes', Application::VIDEO_MIMES); $this->initialStateService->provideInitialState($this->appName, 'maps', $this->appManager->isEnabledForUser('maps') === true); + $this->initialStateService->provideInitialState($this->appName, 'recognize', $this->appManager->isEnabledForUser('recognize') === true); $this->initialStateService->provideInitialState($this->appName, 'croppedLayout', $this->config->getUserValue($user->getUid(), Application::APP_ID, 'croppedLayout', 'false')); $this->initialStateService->provideInitialState($this->appName, 'systemtags', $this->appManager->isEnabledForUser('systemtags') === true); diff --git a/src/Photos.vue b/src/Photos.vue index b8315252..72fcc9e7 100644 --- a/src/Photos.vue +++ b/src/Photos.vue @@ -39,7 +39,7 @@ <AppNavigationItem :to="{name: 'albums'}" :title="t('photos', 'Albums')"> <FolderMultipleImage slot="icon" :size="20" /> </AppNavigationItem> - <AppNavigationItem :to="{name: 'faces'}" :title="t('photos', 'People')"> + <AppNavigationItem v-if="showPeopleMenuEntry" :to="{name: 'faces'}" :title="t('photos', 'People')"> <template #icon> <AccountBoxMultipleOutline /> </template> @@ -116,6 +116,7 @@ import imgplaceholder from './assets/image.svg' import videoplaceholder from './assets/video.svg' import isMapsInstalled from './services/IsMapsInstalled.js' import areTagsInstalled from './services/AreTagsInstalled.js' +import isRecognizeInstalled from './services/IsRecognizeInstalled' export default { name: 'Photos', @@ -147,6 +148,9 @@ export default { showLocationMenuEntry: getCurrentUser() === null ? false : getCurrentUser().isAdmin || isMapsInstalled, + showPeopleMenuEntry: getCurrentUser() === null + ? false + : getCurrentUser().isAdmin || isRecognizeInstalled, } }, diff --git a/src/router/index.js b/src/router/index.js index 384f1e73..18895fe1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -29,6 +29,7 @@ import areTagsInstalled from '../services/AreTagsInstalled.js' import { imageMimes, videoMimes } from '../services/AllowedMimes.js' import Faces from '../views/Faces' import FaceContent from '../views/FaceContent' +import isRecognizeInstalled from '../services/IsRecognizeInstalled.js' const Folders = () => import('../views/Folders') const Albums = () => import('../views/Albums') @@ -159,8 +160,11 @@ export default new Router({ path: '/faces', name: 'faces', component: Faces, - props: route => ({ - rootTitle: t('photos', 'People'), + ...((!isRecognizeInstalled) && { + beforeEnter() { + const recognizeInstallLink = generateUrl('/settings/apps/installed/recognize') + window.open(recognizeInstallLink, '_blank') + }, }), }, { diff --git a/src/services/IsRecognizeInstalled.js b/src/services/IsRecognizeInstalled.js new file mode 100644 index 00000000..a03daa91 --- /dev/null +++ b/src/services/IsRecognizeInstalled.js @@ -0,0 +1,26 @@ +/** + * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com> + * + * @author John Molakvoæ <skjnldsv@protonmail.com> + * + * @license AGPL-3.0-or-later + * + * 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/>. + * + */ + +import { loadState } from '@nextcloud/initial-state' + +const maps = loadState('photos', 'recognize') +export default maps |