aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/webfinger.php
diff options
context:
space:
mode:
Diffstat (limited to 'routes/webfinger.php')
-rw-r--r--routes/webfinger.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/routes/webfinger.php b/routes/webfinger.php
index 4445cad..db29e73 100644
--- a/routes/webfinger.php
+++ b/routes/webfinger.php
@@ -3,6 +3,7 @@
use WpfTest\GlobalConfig;
use WpfTest\HttpResponseStatus\BadRequest;
use WpfTest\HttpResponseStatus\NotFound;
+use WpfTest\Model\Actor;
use WpfTest\Router;
Router::getInstance()->mount('/.well-known/webfinger', function (array $args) {
@@ -18,15 +19,16 @@ Router::getInstance()->mount('/.well-known/webfinger', function (array $args) {
if ($remotePart != GlobalConfig::getInstance()->getCanonicalHost()) {
throw new NotFound('i only know about local accounts');
}
- if ($localPart != 'winter') {
- throw new NotFound('i only know about winter!!!');
+ $actor = Actor::findLocalByHandle($localPart);
+ if ($actor == null) {
+ throw new NotFound('no local actor found with that name!');
}
json_response([
- 'subject' => "acct:$localPart@$remotePart",
+ 'subject' => "acct:$actor->handle@$remotePart",
'links' => [
[
- 'rel' => 'urn:example:wpf:actor',
- 'href' => path_to_uri('/user/winter'),
+ 'rel' => Actor::REL_URI,
+ 'href' => path_to_uri("/user/$actor->handle"),
'type' => 'application/json'
]
]