refactor: remove electron-related code
This commit is contained in:
parent
bed8df06e8
commit
2b1e6fe8f5
200 changed files with 2771 additions and 8432 deletions
45
src/lib/link.ts
Normal file
45
src/lib/link.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Event, nip19 } from 'nostr-tools'
|
||||
|
||||
export const toHome = () => '/'
|
||||
export const toNote = (eventOrId: Event | string) => {
|
||||
if (typeof eventOrId === 'string') return `/notes/${eventOrId}`
|
||||
const nevent = nip19.neventEncode({ id: eventOrId.id, author: eventOrId.pubkey })
|
||||
return `/notes/${nevent}`
|
||||
}
|
||||
export const toNoteList = ({
|
||||
hashtag,
|
||||
search,
|
||||
relay
|
||||
}: {
|
||||
hashtag?: string
|
||||
search?: string
|
||||
relay?: string
|
||||
}) => {
|
||||
const path = '/notes'
|
||||
const query = new URLSearchParams()
|
||||
if (hashtag) query.set('t', hashtag.toLowerCase())
|
||||
if (search) query.set('s', search)
|
||||
if (relay) query.set('relay', relay)
|
||||
return `${path}?${query.toString()}`
|
||||
}
|
||||
export const toProfile = (pubkey: string) => {
|
||||
const npub = nip19.npubEncode(pubkey)
|
||||
return `/users/${npub}`
|
||||
}
|
||||
export const toProfileList = ({ search }: { search?: string }) => {
|
||||
const path = '/users'
|
||||
const query = new URLSearchParams()
|
||||
if (search) query.set('s', search)
|
||||
return `${path}?${query.toString()}`
|
||||
}
|
||||
export const toFollowingList = (pubkey: string) => {
|
||||
const npub = nip19.npubEncode(pubkey)
|
||||
return `/users/${npub}/following`
|
||||
}
|
||||
export const toRelaySettings = () => '/relay-settings'
|
||||
export const toNotifications = () => '/notifications'
|
||||
|
||||
export const toNoStrudelProfile = (id: string) => `https://nostrudel.ninja/#/u/${id}`
|
||||
export const toNoStrudelNote = (id: string) => `https://nostrudel.ninja/#/n/${id}`
|
||||
export const toNoStrudelArticle = (id: string) => `https://nostrudel.ninja/#/articles/${id}`
|
||||
export const toNoStrudelStream = (id: string) => `https://nostrudel.ninja/#/streams/${id}`
|
||||
Loading…
Add table
Add a link
Reference in a new issue