diff options
| author | winter | 2024-12-23 22:17:41 +0000 |
|---|---|---|
| committer | winter | 2024-12-23 22:17:41 +0000 |
| commit | 916d4521cb595493bc5df8b7f9ef52310b6d013a (patch) | |
| tree | d12b54f32339c2e6ae0bafc12bd4c30262615a5d /routes | |
| parent | 8f1f84d92cabf3a606585bc79eba14e63c149b60 (diff) | |
actor profile page
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/user.php | 29 |
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 |
