From 61b122e88cc6783b4d0cf5142a22002f8e558c60 Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 15 Mar 2025 18:35:59 +0000 Subject: implement pages --- routes/note.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'routes/note.php') diff --git a/routes/note.php b/routes/note.php index 2612f0f..6dd0025 100644 --- a/routes/note.php +++ b/routes/note.php @@ -2,7 +2,6 @@ use Digitigrade\HttpResponseStatus\Forbidden; use Digitigrade\HttpResponseStatus\NotFound; -use Digitigrade\HttpResponseStatus\PolicyRejected; use Digitigrade\HttpResponseStatus\TemporaryRedirect; use Digitigrade\Model\Instance; use Digitigrade\Model\Note; @@ -22,7 +21,7 @@ Router::getInstance()->mount('/note/:id', function (array $args) { } PolicyManager::getInstance()->checkFederationOrThrow($note, $instance); if (isset($_SERVER['HTTP_ACCEPT']) && str_contains($_SERVER['HTTP_ACCEPT'], 'text/html')) { - throw new TemporaryRedirect('/@/' . $note->author->handle . "/note/$note->id"); + throw new TemporaryRedirect($note->getLocalUiHref()); } // if it's not public we need to check whether the requesting instance is allowed to see it if ($note->privacy->scope != NotePrivacyScope::PUBLIC ) { @@ -49,7 +48,7 @@ Router::getInstance()->mount('/@/:handle/note/:id', function (array $args) { } // change the handle in the url if it's wrong if ($args['handle'] != $note->author->getFullHandle()) { - throw new TemporaryRedirect('/@/' . $note->author->getFullHandle() . "/note/$note->id"); + throw new TemporaryRedirect($note->getLocalUiHref()); } render_template('thread_page', ['note' => $note]); }); -- cgit v1.3