Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/photos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCorentin Mors <corentin.mors@dashlane.com>2020-10-12 22:19:14 +0300
committerCorentin Mors <corentin.mors@dashlane.com>2020-10-14 19:03:21 +0300
commit3f7ea970e4c1af13a2091bcd367905449b5ef215 (patch)
treecd5372ea89a032f53ed83222fe9fbfbee7c5fec4 /lib
parentf84e43ad3b8d5664bc7aaf4e8aab06cbe424c032 (diff)
Implement "your video" tab
Signed-off-by: Corentin Mors <corentin.mors@dashlane.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php5
-rw-r--r--lib/Controller/AlbumsController.php3
-rw-r--r--lib/Controller/PageController.php3
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index de3ade2a..760d1149 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -33,7 +33,7 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
class Application extends App implements IBootstrap {
public const APP_ID = 'photos';
- public const MIMES = [
+ public const IMAGE_MIMES = [
'image/png',
'image/jpeg',
'image/heic',
@@ -41,6 +41,9 @@ class Application extends App implements IBootstrap {
// 'image/x-xbitmap', // too rarely used for photos
// 'image/bmp', // too rarely used for photos
// 'image/svg+xml', // too rarely used for photos
+ ];
+
+ public const VIDEO_MIMES = [
// 'video/mpeg', // too rarely used for photos
// 'video/ogg', // too rarely used for photos
// 'video/webm', // too rarely used for photos
diff --git a/lib/Controller/AlbumsController.php b/lib/Controller/AlbumsController.php
index d047474b..662b6680 100644
--- a/lib/Controller/AlbumsController.php
+++ b/lib/Controller/AlbumsController.php
@@ -127,7 +127,8 @@ class AlbumsController extends Controller {
}
private function validFile(File $file, bool $shared): bool {
- if (in_array($file->getMimeType(), Application::MIMES) && $this->isShared($file) === $shared) {
+ $allowed_mimes = array_merge(Application::IMAGE_MIMES, Application::VIDEO_MIMES);
+ if (in_array($file->getMimeType(), $allowed_mimes) && $this->isShared($file) === $shared) {
return true;
}
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index effb3e07..3cf92ad6 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -75,7 +75,8 @@ class PageController extends Controller {
$this->eventDispatcher->dispatch(LoadSidebar::class, new LoadSidebar());
$this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());
- $this->initialStateService->provideInitialState($this->appName, 'mimes', Application::MIMES);
+ $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);
Util::addScript($this->appName, 'photos-main');