summaryrefslogtreecommitdiffstats
path: root/lib/Controller/NavigationController.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-07-17 20:34:28 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-07-17 20:34:28 -0100
commitf41c7efdbe93ce4b4ffbe39ec00a023f5f91e192 (patch)
treeb5917c73da4e25fc951c4d0e1c4464ee7e6856f5 /lib/Controller/NavigationController.php
parent31a5b21a6ea85d28903e90ca05f4b3e5922cd053 (diff)
2 sizes available
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Controller/NavigationController.php')
-rw-r--r--lib/Controller/NavigationController.php48
1 files changed, 44 insertions, 4 deletions
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php
index 331c7701..b9b256a0 100644
--- a/lib/Controller/NavigationController.php
+++ b/lib/Controller/NavigationController.php
@@ -34,6 +34,7 @@ use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use daita\MySmallPhpTools\Traits\TArrayTools;
use Exception;
use OC;
+use OC\AppFramework\Http;
use OC\User\NoUserException;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\AccountAlreadyExistsException;
@@ -139,7 +140,7 @@ class NavigationController extends Controller {
'firstrun' => false,
'setup' => false,
'isAdmin' => OC::$server->getGroupManager()
- ->isAdmin($this->userId),
+ ->isAdmin($this->userId),
'cliUrl' => $this->getCliUrl()
]
];
@@ -289,18 +290,17 @@ class NavigationController extends Controller {
* @return Response
*/
public function documentGet(string $id): Response {
-
try {
$file = $this->documentService->getFromCache($id);
- return new FileDisplayResponse($file);
+ return new FileDisplayResponse($file, Http::STATUS_OK);
} catch (Exception $e) {
return $this->fail($e);
}
}
-
/**
+ *
* @PublicPage
* @NoCSRFRequired
*
@@ -319,4 +319,44 @@ class NavigationController extends Controller {
}
}
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ *
+ * @param string $id
+ *
+ * @return Response
+ */
+ public function resizedGet(string $id): Response {
+
+ try {
+ $file = $this->documentService->getResizedFromCache($id);
+
+ return new FileDisplayResponse($file);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
+ * @param string $id
+ *
+ * @return Response
+ */
+ public function resizedGetPublic(string $id): Response {
+
+ try {
+ $file = $this->documentService->getResizedFromCache($id, true);
+
+ return new FileDisplayResponse($file);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
}