kopia lustrzana https://github.com/nextcloud/social
exception handling
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/69/head
rodzic
676ec5acce
commit
13d49b6ebe
|
@ -125,7 +125,6 @@ class ActivityPubController extends Controller {
|
|||
* @param string $username
|
||||
*
|
||||
* @return Response
|
||||
* @throws \OC\User\NoUserException
|
||||
*/
|
||||
public function actor(string $username): Response {
|
||||
if (!$this->checkSourceActivityStreams()) {
|
||||
|
@ -210,10 +209,13 @@ class ActivityPubController extends Controller {
|
|||
public function inbox(string $username): Response {
|
||||
|
||||
try {
|
||||
$actor = $this->actorService->getActor($username);
|
||||
|
||||
$this->activityService->checkRequest($this->request);
|
||||
$body = file_get_contents('php://input');
|
||||
|
||||
// TODO - check the recipient <-> username
|
||||
// $actor = $this->actorService->getActor($username);
|
||||
|
||||
$this->miscService->log('Inbox: ' . $body);
|
||||
|
||||
$activity = $this->importService->import($body);
|
||||
|
|
|
@ -125,7 +125,6 @@ class NavigationController extends Controller {
|
|||
* @NoSubAdminRequired
|
||||
*
|
||||
* @return TemplateResponse
|
||||
* @throws NoUserException
|
||||
*/
|
||||
public function navigate($path = ''): TemplateResponse {
|
||||
$data = [
|
||||
|
@ -162,6 +161,10 @@ class NavigationController extends Controller {
|
|||
$data['serverData']['firstrun'] = true;
|
||||
} catch (AccountAlreadyExistsException $e) {
|
||||
// we do nothing
|
||||
} catch (NoUserException $e) {
|
||||
// well, should not happens
|
||||
} catch (SocialAppConfigException $e) {
|
||||
// neither.
|
||||
}
|
||||
|
||||
return new TemplateResponse(Application::APP_NAME, 'main', $data);
|
||||
|
@ -231,7 +234,6 @@ class NavigationController extends Controller {
|
|||
* @param $username
|
||||
*
|
||||
* @return RedirectResponse|PublicTemplateResponse
|
||||
* @throws NoUserException
|
||||
*/
|
||||
public function public($username) {
|
||||
if (\OC::$server->getUserSession()
|
||||
|
|
|
@ -60,32 +60,28 @@ class ActorsRequest extends ActorsRequestBuilder {
|
|||
* @param Person $actor
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function create(Person $actor): string {
|
||||
|
||||
$id = $this->configService->getUrlSocial() . '@' . $actor->getPreferredUsername();
|
||||
|
||||
try {
|
||||
$qb = $this->getActorsInsertSql();
|
||||
$qb = $this->getActorsInsertSql();
|
||||
|
||||
$qb->setValue('id', $qb->createNamedParameter($id))
|
||||
$qb->setValue('id', $qb->createNamedParameter($id))
|
||||
// ->setValue('type', $qb->createNamedParameter($actor->getType()))
|
||||
->setValue('user_id', $qb->createNamedParameter($actor->getUserId()))
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
|
||||
->setValue('user_id', $qb->createNamedParameter($actor->getUserId()))
|
||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue(
|
||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||
)
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
|
||||
|
||||
$qb->execute();
|
||||
$qb->execute();
|
||||
|
||||
return $id;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ class ActorService {
|
|||
*
|
||||
* @throws AccountAlreadyExistsException
|
||||
* @throws NoUserException
|
||||
* @throws Exception
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
public function createActor(string $userId, string $username) {
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ class InstanceService {
|
|||
* @return mixed
|
||||
* @throws RequestException
|
||||
* @throws InvalidResourceException
|
||||
* @throws Request410Exception
|
||||
*/
|
||||
public function retrieveAccount(string $account) {
|
||||
$account = $this->withoutBeginAt($account);
|
||||
|
|
Ładowanie…
Reference in New Issue