aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/actor_profile.php
diff options
context:
space:
mode:
Diffstat (limited to 'routes/actor_profile.php')
-rw-r--r--routes/actor_profile.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/routes/actor_profile.php b/routes/actor_profile.php
new file mode 100644
index 0000000..4fea967
--- /dev/null
+++ b/routes/actor_profile.php
@@ -0,0 +1,19 @@
+<?php
+
+use Digitigrade\HttpResponseStatus\NotFound;
+use Digitigrade\Model\Actor;
+use Digitigrade\Router;
+
+Router::getInstance()->mount('/@/:handle', function (array $args) {
+ 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 actor called " . $args['handle']);
+ }
+ render_template('actor_profile_page', ['actor' => $actor]);
+}); \ No newline at end of file