aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes
diff options
context:
space:
mode:
authorwinter2024-12-23 22:17:41 +0000
committerwinter2024-12-23 22:17:41 +0000
commit916d4521cb595493bc5df8b7f9ef52310b6d013a (patch)
treed12b54f32339c2e6ae0bafc12bd4c30262615a5d /routes
parent8f1f84d92cabf3a606585bc79eba14e63c149b60 (diff)
actor profile page
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