feat: check if title contains a username

This commit is contained in:
Ayo 2023-01-06 19:03:12 +01:00
parent 05bbd6ba4d
commit 1180311984

View file

@ -23,8 +23,8 @@ const providerName = $computed(() => props.card.providerName ? props.card.provid
const gitHubCards = $(useFeatureFlag('experimentalGitHubCards'))
// TODO: regex test the card.title value
const isMastodonLink = true
// checks if title contains a username
const isMastodonLink = props.card.title.match(/@+[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/gi)
// TODO: handle card.type: 'photo' | 'video' | 'rich';
const cardTypeIconMap: Record<CardType, string> = {