feat: nak req

This commit is contained in:
codytseng 2025-12-10 23:10:47 +08:00
parent ac196cd662
commit a6d6a19199
9 changed files with 388 additions and 25 deletions

View file

@ -3,6 +3,7 @@ import SearchResult from '@/components/SearchResult'
import { Button } from '@/components/ui/button'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { toSearch } from '@/lib/link'
import { parseNakReqCommand } from '@/lib/nak-parser'
import { useSecondaryPage } from '@/PageManager'
import { TSearchParams } from '@/types'
import { ChevronLeft } from 'lucide-react'
@ -20,7 +21,8 @@ const SearchPage = forwardRef(({ index }: { index?: number }, ref) => {
type !== 'profiles' &&
type !== 'notes' &&
type !== 'hashtag' &&
type !== 'relay'
type !== 'relay' &&
type !== 'nak'
) {
return null
}
@ -29,8 +31,16 @@ const SearchPage = forwardRef(({ index }: { index?: number }, ref) => {
return null
}
const input = params.get('i') ?? ''
let request = undefined
if (type === 'nak') {
try {
request = parseNakReqCommand(input)
} catch {
// ignore invalid request param
}
}
setInput(input || search)
return { type, search, input } as TSearchParams
return { type, search, input, request } as TSearchParams
}, [])
useEffect(() => {