|
|
|
|
@ -37,12 +37,14 @@ use OCP\AppFramework\Http;
|
|
|
|
|
use OCP\AppFramework\Http\DataDisplayResponse;
|
|
|
|
|
use OCP\AppFramework\Http\FileDisplayResponse;
|
|
|
|
|
use OCP\AppFramework\Http\JSONResponse;
|
|
|
|
|
use OCP\AppFramework\Http\RedirectResponse;
|
|
|
|
|
use OCP\Files\File;
|
|
|
|
|
use OCP\Files\IRootFolder;
|
|
|
|
|
use OCP\IAvatarManager;
|
|
|
|
|
use OCP\ICache;
|
|
|
|
|
use OCP\IL10N;
|
|
|
|
|
use OCP\IRequest;
|
|
|
|
|
use OCP\IURLGenerator;
|
|
|
|
|
use OCP\IUserManager;
|
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
|
|
|
|
|
|
@ -63,6 +65,8 @@ class AvatarController extends Controller {
|
|
|
|
|
protected LoggerInterface $logger,
|
|
|
|
|
protected ?string $userId,
|
|
|
|
|
protected TimeFactory $timeFactory,
|
|
|
|
|
protected IURLGenerator $urlGenerator,
|
|
|
|
|
protected GuestAvatarController $guestAvatarController,
|
|
|
|
|
) {
|
|
|
|
|
parent::__construct($appName, $request);
|
|
|
|
|
}
|
|
|
|
|
@ -104,6 +108,9 @@ class AvatarController extends Controller {
|
|
|
|
|
['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()]
|
|
|
|
|
);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
if ($guestFallback) {
|
|
|
|
|
return $this->guestAvatarController->getAvatarDark($userId, (string)$size);
|
|
|
|
|
}
|
|
|
|
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -150,6 +157,9 @@ class AvatarController extends Controller {
|
|
|
|
|
['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()]
|
|
|
|
|
);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
if ($guestFallback) {
|
|
|
|
|
return $this->guestAvatarController->getAvatar($userId, (string)$size);
|
|
|
|
|
}
|
|
|
|
|
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|