feat: redirect bech32 paths

This commit is contained in:
codytseng
2025-06-22 12:57:43 +08:00
parent 7794ae2564
commit 4e80d59c1c

View File

@@ -95,6 +95,23 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
useEffect(() => { useEffect(() => {
const hasHistoryState = !!history.state const hasHistoryState = !!history.state
if (['/npub1', '/nprofile1'].some((prefix) => window.location.pathname.startsWith(prefix))) {
window.history.replaceState(
null,
'',
'/users' + window.location.pathname + window.location.search + window.location.hash
)
} else if (
['/note1', '/nevent1', '/naddr1'].some((prefix) =>
window.location.pathname.startsWith(prefix)
)
) {
window.history.replaceState(
null,
'',
'/notes' + window.location.pathname + window.location.search + window.location.hash
)
}
window.history.pushState(null, '', window.location.href) window.history.pushState(null, '', window.location.href)
if (window.location.pathname !== '/') { if (window.location.pathname !== '/') {
if ( if (