diff options
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/NavigationController.php | 48 |
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); + } + } + } |