add ref_src (#3532)
parent
9fb20915e8
commit
4c95ec2ec4
|
@ -8,9 +8,14 @@ export function Link({
|
||||||
href: string
|
href: string
|
||||||
className?: string
|
className?: string
|
||||||
} & h.JSX.HTMLAttributes<HTMLAnchorElement>) {
|
} & h.JSX.HTMLAttributes<HTMLAnchorElement>) {
|
||||||
|
const newSearchParam = new URLSearchParams()
|
||||||
|
newSearchParam.set('ref_src', 'embed')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={href.startsWith('http') ? href : `https://bsky.app${href}`}
|
href={`${
|
||||||
|
href.startsWith('http') ? href : `https://bsky.app${href}`
|
||||||
|
}?${newSearchParam.toString()}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer nofollow"
|
rel="noopener noreferrer nofollow"
|
||||||
onClick={evt => evt.stopPropagation()}
|
onClick={evt => evt.stopPropagation()}
|
||||||
|
|
|
@ -242,7 +242,7 @@ function Snippet({thread}: {thread: AppBskyFeedDefs.ThreadViewPost}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toShareUrl(path: string) {
|
function toShareUrl(path: string) {
|
||||||
return `https://bsky.app${path}`
|
return `https://bsky.app${path}?ref_src=embed`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,10 +58,14 @@ function EmbedDialogInner({
|
||||||
}, [copied])
|
}, [copied])
|
||||||
|
|
||||||
const snippet = React.useMemo(() => {
|
const snippet = React.useMemo(() => {
|
||||||
|
function toEmbedUrl(href: string) {
|
||||||
|
return toShareUrl(href) + '?ref_src=embed'
|
||||||
|
}
|
||||||
|
|
||||||
const lang = record.langs && record.langs.length > 0 ? record.langs[0] : ''
|
const lang = record.langs && record.langs.length > 0 ? record.langs[0] : ''
|
||||||
const profileHref = toShareUrl(['/profile', postAuthor.did].join('/'))
|
const profileHref = toEmbedUrl(['/profile', postAuthor.did].join('/'))
|
||||||
const urip = new AtUri(postUri)
|
const urip = new AtUri(postUri)
|
||||||
const href = toShareUrl(
|
const href = toEmbedUrl(
|
||||||
['/profile', postAuthor.did, 'post', urip.rkey].join('/'),
|
['/profile', postAuthor.did, 'post', urip.rkey].join('/'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue