kopia lustrzana https://github.com/nextcloud/social
Merge branch 'stCyr_showAttachments' of https://github.com/StCyr/social into stCyr_showAttachments
commit
bafe39332e
|
@ -701,9 +701,10 @@ class LocalController extends Controller {
|
|||
$actor = $this->cacheActorService->getFromId($id);
|
||||
if ($actor->gotIcon()) {
|
||||
$avatar = $actor->getIcon();
|
||||
$document = $this->documentService->getFromCache($avatar->getId());
|
||||
$document = $this->documentService->getFromCache($avatar->getId(), $mime);
|
||||
|
||||
$response = new FileDisplayResponse($document);
|
||||
$response =
|
||||
new FileDisplayResponse($document, Http::STATUS_OK, ['Content-Type' => $mime]);
|
||||
$response->cacheFor(86400);
|
||||
|
||||
return $response;
|
||||
|
|
|
@ -291,9 +291,11 @@ class NavigationController extends Controller {
|
|||
*/
|
||||
public function documentGet(string $id): Response {
|
||||
try {
|
||||
$file = $this->documentService->getFromCache($id);
|
||||
$mime = '';
|
||||
$file = $this->documentService->getFromCache($id, $mime);
|
||||
|
||||
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
|
||||
|
||||
return new FileDisplayResponse($file, Http::STATUS_OK);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
@ -311,9 +313,10 @@ class NavigationController extends Controller {
|
|||
public function documentGetPublic(string $id): Response {
|
||||
|
||||
try {
|
||||
$file = $this->documentService->getFromCache($id, true);
|
||||
$mime = '';
|
||||
$file = $this->documentService->getFromCache($id, $mime, true);
|
||||
|
||||
return new FileDisplayResponse($file);
|
||||
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
@ -331,9 +334,10 @@ class NavigationController extends Controller {
|
|||
public function resizedGet(string $id): Response {
|
||||
|
||||
try {
|
||||
$file = $this->documentService->getResizedFromCache($id);
|
||||
$mime = '';
|
||||
$file = $this->documentService->getResizedFromCache($id, $mime);
|
||||
|
||||
return new FileDisplayResponse($file);
|
||||
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
@ -351,12 +355,14 @@ class NavigationController extends Controller {
|
|||
public function resizedGetPublic(string $id): Response {
|
||||
|
||||
try {
|
||||
$file = $this->documentService->getResizedFromCache($id, true);
|
||||
$mime = '';
|
||||
$file = $this->documentService->getResizedFromCache($id, $mime, true);
|
||||
|
||||
return new FileDisplayResponse($file);
|
||||
return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ class CacheDocumentService {
|
|||
use TStringTools;
|
||||
|
||||
|
||||
const RESIZED_HEIGHT = 250;
|
||||
const RESIZED_WIDTH = 350;
|
||||
const RESIZED_WIDTH = 280;
|
||||
const RESIZED_HEIGHT = 180;
|
||||
|
||||
/** @var IAppData */
|
||||
private $appData;
|
||||
|
|
|
@ -190,6 +190,7 @@ class DocumentService {
|
|||
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $mime
|
||||
* @param bool $public
|
||||
*
|
||||
* @return ISimpleFile
|
||||
|
@ -199,8 +200,9 @@ class DocumentService {
|
|||
* @throws RequestResultNotJsonException
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function getResizedFromCache(string $id, bool $public = false) {
|
||||
public function getResizedFromCache(string $id, string &$mime = '', bool $public = false) {
|
||||
$document = $this->cacheRemoteDocument($id, $public);
|
||||
$mime = $document->getMimeType();
|
||||
|
||||
return $this->cacheService->getContentFromCache($document->getResizedCopy());
|
||||
}
|
||||
|
@ -218,7 +220,7 @@ class DocumentService {
|
|||
* @throws RequestResultNotJsonException
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function getFromCache(string $id, bool $public = false, string &$mimeType = '') {
|
||||
public function getFromCache(string $id, string &$mimeType = '', bool $public = false) {
|
||||
$document = $this->cacheRemoteDocument($id, $public);
|
||||
$mimeType = $document->getMimeType();
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue