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:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-11-18 18:09:46 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-11-18 18:09:46 +0300
commitbae4efe62f566c43a9703242bdf46051a345a4f9 (patch)
treeb697da518e2df9a3bfa9ab40be69c9c627058d9d /lib
parent2d3f8950fbf0029557d61bcba2eff331f1c67b2a (diff)
Proper mimes, initialstate and video loading placeholder
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php16
-rw-r--r--lib/Controller/AlbumsController.php3
-rw-r--r--lib/Controller/PageController.php15
3 files changed, 30 insertions, 4 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 97ab98b4..8125d4d5 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -30,6 +30,22 @@ class Application extends App {
const APP_ID = 'photos';
+ const MIMES = [
+ // 'image/png', // too rarely used for photos
+ 'image/jpeg',
+ // 'image/gif', // too rarely used for photos
+ // 'image/x-xbitmap', // too rarely used for photos
+ // 'image/bmp', // too rarely used for photos
+ // 'image/svg+xml', // too rarely used for photos
+ // 'video/mpeg', // too rarely used for photos
+ // 'video/ogg', // too rarely used for photos
+ // 'video/webm', // too rarely used for photos
+ 'video/mp4',
+ // 'video/x-m4v', // too rarely used for photos
+ 'video/quicktime',
+ // 'video/x-matroska' // too rarely used for photos
+ ];
+
public function __construct() {
parent::__construct(self::APP_ID);
}
diff --git a/lib/Controller/AlbumsController.php b/lib/Controller/AlbumsController.php
index 9b412ee8..4a475dca 100644
--- a/lib/Controller/AlbumsController.php
+++ b/lib/Controller/AlbumsController.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Photos\Controller;
use OCA\Files_Sharing\SharedStorage;
+use OCA\Photos\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
@@ -125,7 +126,7 @@ class AlbumsController extends Controller {
}
private function validFile(File $file, bool $shared): bool {
- if ($file->getMimePart() === 'image' && $this->isShared($file) === $shared) {
+ if (in_array($file->getMimeType(), Application::MIMES) && $this->isShared($file) === $shared) {
return true;
}
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 8529441e..593f7c1b 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -25,10 +25,12 @@ declare(strict_types=1);
namespace OCA\Photos\Controller;
use OCA\Files\Event\LoadSidebar;
+use OCA\Photos\AppInfo\Application;
use OCA\Viewer\Event\LoadViewer;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IInitialStateService;
use OCP\IRequest;
use OCP\Util;
@@ -39,13 +41,19 @@ class PageController extends Controller {
/** @var IEventDispatcher */
private $eventDispatcher;
+ /** @var IInitialStateService */
+ private $initialStateService;
+
public function __construct($appName,
IRequest $request,
- IEventDispatcher $eventDispatcher) {
+ IEventDispatcher $eventDispatcher,
+ IInitialStateService $initialStateService) {
parent::__construct($appName, $request);
$this->appName = $appName;
$this->eventDispatcher = $eventDispatcher;
+ $this->initialStateService = $initialStateService;
+
}
/**
@@ -59,9 +67,10 @@ 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);
- Util::addScript('photos', 'photos');
- Util::addStyle('photos', 'icons');
+ Util::addScript($this->appName, 'photos');
+ Util::addStyle($this->appName, 'icons');
$response = new TemplateResponse($this->appName, 'main');
return $response;