From a5dddcf093399a0d57fceb641da4c482b9b55219 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Thu, 7 Dec 2023 22:28:51 +0200 Subject: [PATCH] redirect from /npub to /username --- packages/app/src/Pages/Profile/ProfilePage.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/app/src/Pages/Profile/ProfilePage.tsx b/packages/app/src/Pages/Profile/ProfilePage.tsx index 4c2b7544..9d8202a5 100644 --- a/packages/app/src/Pages/Profile/ProfilePage.tsx +++ b/packages/app/src/Pages/Profile/ProfilePage.tsx @@ -105,6 +105,17 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) { ) as Tab[]; const horizontalScroll = useHorizontalScroll(); + useEffect(() => { + if ( + user?.nip05 && + user.nip05.endsWith(`@${CONFIG.nip05Domain}`) && + (!("isNostrAddressValid" in user) || user.isNostrAddressValid) + ) { + const [username] = user.nip05.split("@"); + navigate(`/${username}`, { replace: true }); + } + }, [user]); + useEffect(() => { if (!id) { const resolvedId = propId || params.id;