aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/user.php29
1 files changed, 9 insertions, 20 deletions
diff --git a/routes/user.php b/routes/user.php
index 8626c38..c0a632a 100644
--- a/routes/user.php
+++ b/routes/user.php
@@ -5,26 +5,15 @@ use Digitigrade\Model\Actor;
use Digitigrade\Router;
Router::getInstance()->mount('/@/:handle', function (array $args) {
- $actor = Actor::findLocalByHandle($args['handle']);
+ if (str_contains($args['handle'], '@')) {
+ // remote actor
+ $actor = Actor::findByWebfinger($args['handle']);
+ } else {
+ // local actor
+ $actor = Actor::findLocalByHandle($args['handle']);
+ }
if ($actor == null || $actor->deleted) {
- throw new NotFound("i don't know any local user called " . $args['handle']);
+ throw new NotFound("i don't know any user called " . $args['handle']);
}
-
- ?>
- <!DOCTYPE html>
- <html>
-
- <head>
- <title><?= $actor->displayName ?> (@<?= $actor->handle ?>)</title>
- </head>
-
- <body>
- <h1><?= $actor->displayName ?></h1>
- <p>@<?= $actor->handle ?></p>
- <hr>
- <p><?= $actor->bio ?></p>
- </body>
-
- </html>
- <?php
+ render_template('actor_profile_page', ['actor' => $actor]);
}); \ No newline at end of file