From 86cf52e8d2701e13bd9fd4c847b35eba7506c473 Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 14 Dec 2024 00:08:41 +0000 Subject: add a godawful basic html actor page --- routes/actor.php | 4 ++++ routes/user.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 routes/user.php (limited to 'routes') diff --git a/routes/actor.php b/routes/actor.php index 021b9f8..51c0e1a 100644 --- a/routes/actor.php +++ b/routes/actor.php @@ -1,6 +1,7 @@ mount('/user/:handle', function (array $args) { if ($actor == null) { throw new NotFound("i don't know any local user called " . $args['handle']); } + if (str_contains($_SERVER['HTTP_ACCEPT'], 'text/html')) { + throw new TemporaryRedirect(path_to_uri("/@/$actor->handle")); + } json_response($actor); }); diff --git a/routes/user.php b/routes/user.php new file mode 100644 index 0000000..5532448 --- /dev/null +++ b/routes/user.php @@ -0,0 +1,30 @@ +mount('/@/:handle', function (array $args) { + $actor = Actor::findLocalByHandle($args['handle']); + if ($actor == null) { + throw new NotFound("i don't know any local user called " . $args['handle']); + } + + ?> + + + + + <?= $actor->displayName ?> (@<?= $actor->handle ?>) + + + +

displayName ?>

+

@handle ?>

+
+

bio ?>

+ + + +