summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-06-12 13:10:21 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-06-21 11:00:14 -0100
commit35389b47af9d5099c675ea4893542e00fce5322c (patch)
tree0d1f773ca6b037e5183abb95c7d247bd250165c1
parentede7d0d7320b270a79e73d86116c1ff914a1a3ab (diff)
update account on retreivefeature/573/request-on-host-meta
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Service/CacheActorService.php4
-rw-r--r--lib/Service/CurlService.php10
-rw-r--r--lib/webfinger.php2
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/Service/CacheActorService.php b/lib/Service/CacheActorService.php
index e0c989d8..41ec3954 100644
--- a/lib/Service/CacheActorService.php
+++ b/lib/Service/CacheActorService.php
@@ -185,13 +185,15 @@ class CacheActorService {
* @throws CacheActorDoesNotExistException
* @throws InvalidOriginException
* @throws InvalidResourceException
+ * @throws ItemUnknownException
* @throws MalformedArrayException
* @throws RedundancyLimitException
* @throws RequestContentException
- * @throws RetrieveAccountFormatException
* @throws RequestNetworkException
+ * @throws RequestResultNotJsonException
* @throws RequestResultSizeException
* @throws RequestServerException
+ * @throws RetrieveAccountFormatException
* @throws SocialAppConfigException
* @throws ItemUnknownException
* @throws RequestResultNotJsonException
diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php
index ccf315cd..7775baff 100644
--- a/lib/Service/CurlService.php
+++ b/lib/Service/CurlService.php
@@ -109,7 +109,7 @@ class CurlService {
* @throws SocialAppConfigException
* @throws UnauthorizedFediverseException
*/
- public function webfingerAccount(string $account): array {
+ public function webfingerAccount(string &$account): array {
$account = $this->withoutBeginAt($account);
// we consider an account is like an email
@@ -141,6 +141,12 @@ class CurlService {
} else throw $e;
}
+ $subject = $this->get('subject', $result, '');
+ list($type, $temp) = explode(':', $subject, 2);
+ if ($type === 'acct') {
+ $account = $temp;
+ }
+
return $result;
}
@@ -189,7 +195,7 @@ class CurlService {
* @throws RequestResultNotJsonException
* @throws UnauthorizedFediverseException
*/
- public function retrieveAccount(string $account): Person {
+ public function retrieveAccount(string &$account): Person {
$result = $this->webfingerAccount($account);
try {
diff --git a/lib/webfinger.php b/lib/webfinger.php
index 1d7c7d98..8ccbb26d 100644
--- a/lib/webfinger.php
+++ b/lib/webfinger.php
@@ -90,7 +90,7 @@ if (substr($href, -1) === '/') {
}
$finger = [
- 'subject' => $username . '@' . $instance,
+ 'subject' => 'acct:' . $username . '@' . $instance,
'links' => [
[
'rel' => 'self',