Turn links to posts into quote posts (#262)
* Turn links to posts into quote posts * Fix lint
This commit is contained in:
parent
d74ff9c219
commit
8e22ce8e2a
3 changed files with 73 additions and 10 deletions
|
@ -66,6 +66,18 @@ export function isBskyAppUrl(url: string): boolean {
|
|||
return url.startsWith('https://bsky.app/')
|
||||
}
|
||||
|
||||
export function isBskyPostUrl(url: string): boolean {
|
||||
if (isBskyAppUrl(url)) {
|
||||
try {
|
||||
const urlp = new URL(url)
|
||||
return /profile\/(?<name>[^/]+)\/post\/(?<rkey>[^/]+)/i.test(
|
||||
urlp.pathname,
|
||||
)
|
||||
} catch {}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function convertBskyAppUrlIfNeeded(url: string): string {
|
||||
if (isBskyAppUrl(url)) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue