summaryrefslogtreecommitdiffstats
path: root/lib/Service
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-01-08 09:25:57 -0100
committerJulius Härtl <jus@bitgrid.net>2019-02-20 20:55:35 +0100
commit910583e12233d3282f5aeeb678c6aa420f25be0f (patch)
tree2ad7a50960eb926a25400d74a872756331ddc390 /lib/Service
parentdf1ad48a8d103d915168f8e63fa563c512b0a3e2 (diff)
get link for remote to follow local account
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/AccountService.php1
-rw-r--r--lib/Service/CurlService.php33
2 files changed, 26 insertions, 8 deletions
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index 497b732b..13dde24d 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -161,6 +161,7 @@ class AccountService {
* @throws NoUserException
* @throws SocialAppConfigException
* @throws UrlCloudException
+ * @throws ItemUnknownException
*/
public function getActorFromUserId(string $userId, bool $create = false): Person {
$this->miscService->confirmUserId($userId);
diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php
index 923596d1..c9b0c1c1 100644
--- a/lib/Service/CurlService.php
+++ b/lib/Service/CurlService.php
@@ -90,21 +90,15 @@ class CurlService {
/**
* @param string $account
*
- * @return Person
- * @throws InvalidOriginException
+ * @return array
* @throws InvalidResourceException
- * @throws MalformedArrayException
- * @throws RedundancyLimitException
* @throws RequestContentException
- * @throws RetrieveAccountFormatException
* @throws RequestNetworkException
* @throws RequestResultSizeException
* @throws RequestServerException
- * @throws SocialAppConfigException
- * @throws ItemUnknownException
* @throws RequestResultNotJsonException
*/
- public function retrieveAccount(string $account): Person {
+ public function webfingerAccount(string $account): array {
$account = $this->withoutBeginAt($account);
// we consider an account is like an email
@@ -122,6 +116,29 @@ class CurlService {
$request->setAddress($host);
$result = $this->request($request);
+ return $result;
+ }
+
+
+ /**
+ * @param string $account
+ *
+ * @return Person
+ * @throws InvalidOriginException
+ * @throws InvalidResourceException
+ * @throws MalformedArrayException
+ * @throws RedundancyLimitException
+ * @throws RequestContentException
+ * @throws RetrieveAccountFormatException
+ * @throws RequestNetworkException
+ * @throws RequestResultSizeException
+ * @throws RequestServerException
+ * @throws SocialAppConfigException
+ * @throws ItemUnknownException
+ */
+ public function retrieveAccount(string $account): Person {
+ $result = $this->webfingerAccount($account);
+
try {
$link = $this->extractArray('rel', 'self', $this->getArray('links', $result));
} catch (ArrayNotFoundException $e) {