kopia lustrzana https://github.com/nextcloud/social
Add unified avatar endpoint to quickly fetch avatars
Signed-off-by: Julius Härtl <jus@bitgrid.net>pull/72/head
rodzic
2d06e10d80
commit
2ec04d611e
appinfo
lib/Controller
|
@ -76,6 +76,7 @@ return [
|
|||
['name' => 'Local#accountUnfollow', 'url' => '/api/v1/account/follow', 'verb' => 'DELETE'],
|
||||
['name' => 'Local#accountInfo', 'url' => '/api/v1/account/info', 'verb' => 'GET'],
|
||||
['name' => 'Local#actorInfo', 'url' => '/api/v1/actor/info', 'verb' => 'GET'],
|
||||
['name' => 'Local#actorAvatar', 'url' => '/api/v1/actor/avatar', 'verb' => 'GET'],
|
||||
['name' => 'Local#documentsCache', 'url' => '/api/v1/documents/cache', 'verb' => 'POST'],
|
||||
|
||||
['name' => 'Queue#asyncWithToken', 'url' => CurlService::ASYNC_TOKEN, 'verb' => 'POST'],
|
||||
|
|
|
@ -403,6 +403,26 @@ class LocalController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoCSRFRequired
|
||||
* @NoAdminRequired
|
||||
* @NoSubAdminRequired
|
||||
* @param string $id
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function actorAvatar(string $id): DataResponse {
|
||||
try {
|
||||
$actor = $this->personService->getFromId($id);
|
||||
$avatar = $actor->getIcon();
|
||||
$this->documentService->getFromCache($avatar->getId());
|
||||
|
||||
|
||||
return $this->success(['actor' => $actor]);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* // TODO: Delete the NoCSRF check
|
||||
|
|
Ładowanie…
Reference in New Issue