| 102 | // The post behind a redirect link (`api.daily.dev/r/<id>`): the redirect only |
| 103 | // counts the read when it can tell who is reading. |
| 104 | export const getRedirectPostId = (anchor: HTMLAnchorElement): string | null => { |
| 105 | if (!publicApiUrl || anchor.host !== new URL(publicApiUrl).host) { |
| 106 | return null; |
| 107 | } |
| 108 | return anchor.pathname.match(/^\/r\/([^/]+)\/?$/)?.[1] ?? null; |
| 109 | }; |
| 110 | |
| 111 | const shareIntents = |
| 112 | /^(?:[a-z0-9-]+\.)?(?:twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|wa\.me|whatsapp\.com|t\.me|telegram\.me)$/; |