Release 202505261604

This commit is contained in:
pluja
2025-05-26 16:04:25 +00:00
parent 50ede46d50
commit b361ed3aa8
4 changed files with 51 additions and 25 deletions

View File

@@ -160,6 +160,7 @@ const splashText = showSplashText ? sample(splashTexts) : null
<a <a
href={makeUnimpersonateUrl(Astro.url)} href={makeUnimpersonateUrl(Astro.url)}
data-astro-reload data-astro-reload
data-astro-prefetch="tap"
class="xs:px-3 2xs:px-2 last:xs:-mr-3 last:2xs:-mr-2 flex h-full items-center px-1 text-sm text-stone-100 transition-colors last:-mr-1 hover:text-stone-200" class="xs:px-3 2xs:px-2 last:xs:-mr-3 last:2xs:-mr-2 flex h-full items-center px-1 text-sm text-stone-100 transition-colors last:-mr-1 hover:text-stone-200"
transition:name="header-unimpersonate-link" transition:name="header-unimpersonate-link"
aria-label="Unimpersonate" aria-label="Unimpersonate"

View File

@@ -8,7 +8,7 @@ type ContactMethodInfo<T extends string | null | undefined = string> = {
label: string label: string
/** Notice that the first capture group is then used to format the value */ /** Notice that the first capture group is then used to format the value */
matcher: RegExp matcher: RegExp
formatter: (value: string) => string | null formatter: (match: RegExpMatchArray) => string | null
icon: string icon: string
} }
@@ -24,82 +24,96 @@ export const {
label: type ? transformCase(type, 'title') : String(type), label: type ? transformCase(type, 'title') : String(type),
icon: 'ri:shield-fill', icon: 'ri:shield-fill',
matcher: /(.*)/, matcher: /(.*)/,
formatter: (value) => value, formatter: ([, value]) => value ?? String(value),
}), }),
[ [
{ {
type: 'email', type: 'email',
label: 'Email', label: 'Email',
matcher: /mailto:(.+)/, matcher: /mailto:(.+)/,
formatter: (value) => value, formatter: ([, value]) => value ?? 'Email',
icon: 'ri:mail-line', icon: 'ri:mail-line',
}, },
{ {
type: 'telephone', type: 'telephone',
label: 'Telephone', label: 'Telephone',
matcher: /tel:(.+)/, matcher: /tel:(.+)/,
formatter: (value) => { formatter: ([, value]) => {
return parsePhoneNumberWithError(value).formatInternational() return value ? parsePhoneNumberWithError(value).formatInternational() : 'Telephone'
}, },
icon: 'ri:phone-line', icon: 'ri:phone-line',
}, },
{ {
type: 'whatsapp', type: 'whatsapp',
label: 'WhatsApp', label: 'WhatsApp',
matcher: /https?:\/\/(?:www\.)?wa\.me\/(.+)/, matcher: /^https?:\/\/(?:www\.)?wa\.me\/(.+)/,
formatter: (value) => { formatter: ([, value]) => {
return parsePhoneNumberWithError(value).formatInternational() return value ? parsePhoneNumberWithError(value).formatInternational() : 'WhatsApp'
}, },
icon: 'ri:whatsapp-line', icon: 'ri:whatsapp-line',
}, },
{ {
type: 'telegram', type: 'telegram',
label: 'Telegram', label: 'Telegram',
matcher: /https?:\/\/(?:www\.)?t\.me\/(.+)/, matcher: /^https?:\/\/(?:www\.)?t\.me\/(.+)/,
formatter: (value) => `t.me/${value}`, formatter: ([, value]) => (value ? `t.me/${value}` : 'Telegram'),
icon: 'ri:telegram-line', icon: 'ri:telegram-line',
}, },
{ {
type: 'linkedin', type: 'linkedin',
label: 'LinkedIn', label: 'LinkedIn',
matcher: /https?:\/\/(?:www\.)?linkedin\.com\/(?:in|company)\/(.+)/, matcher: /^https?:\/\/(?:www\.)?linkedin\.com\/(?:in|company)\/(.+)/,
formatter: (value) => `in/${value}`, formatter: ([, value]) => (value ? `in/${value}` : 'LinkedIn'),
icon: 'ri:linkedin-box-line', icon: 'ri:linkedin-box-line',
}, },
{ {
type: 'x', type: 'x',
label: 'X', label: 'X',
matcher: /https?:\/\/(?:www\.)?x\.com\/(.+)/, matcher: /^https?:\/\/(?:www\.)?x\.com\/(.+)/,
formatter: (value) => `@${value}`, formatter: ([, value]) => (value ? `@${value}` : 'X'),
icon: 'ri:twitter-x-line', icon: 'ri:twitter-x-line',
}, },
{ {
type: 'instagram', type: 'instagram',
label: 'Instagram', label: 'Instagram',
matcher: /https?:\/\/(?:www\.)?instagram\.com\/(.+)/, matcher: /^https?:\/\/(?:www\.)?instagram\.com\/(.+)/,
formatter: (value) => `@${value}`, formatter: ([, value]) => (value ? `@${value}` : 'Instagram'),
icon: 'ri:instagram-line', icon: 'ri:instagram-line',
}, },
{ {
type: 'matrix', type: 'matrix',
label: 'Matrix', label: 'Matrix',
matcher: /https?:\/\/(?:www\.)?matrix\.to\/#\/(.+)/, matcher: /^https?:\/\/(?:www\.)?matrix\.to\/#\/(.+)/,
formatter: (value) => value, formatter: ([, value]) => (value ? `#${value}` : 'Matrix'),
icon: 'ri:hashtag', icon: 'ri:hashtag',
}, },
{ {
type: 'bitcointalk', type: 'bitcointalk',
label: 'BitcoinTalk', label: 'BitcoinTalk',
matcher: /https?:\/\/(?:www\.)?bitcointalk\.org/, matcher: /^https?:\/\/(?:www\.)?bitcointalk\.org/,
formatter: () => 'BitcoinTalk', formatter: () => 'BitcoinTalk',
icon: 'ri:btc-line', icon: 'ri:btc-line',
}, },
// Website must go last because it's a catch-all
{ {
type: 'simplex',
label: 'SimpleX Chat',
matcher: /^https?:\/\/(?:www\.)?(simplex\.chat)\//,
formatter: () => 'SimpleX Chat',
icon: 'simplex',
},
{
type: 'nostr',
label: 'Nostr',
matcher: /\b(npub1[a-zA-Z0-9]{58})\b/,
formatter: () => 'Nostr',
icon: 'nostr',
},
{
// Website must go last because it's a catch-all
type: 'website', type: 'website',
label: 'Website', label: 'Website',
matcher: /https?:\/\/(?:www\.)?((?:[a-zA-Z0-9-]+\.)+[a-zA-Z]+)/, matcher: /^https?:\/\/(?:www\.)?((?:[a-zA-Z0-9-]+\.)+[a-zA-Z]+)/,
formatter: (value) => value, formatter: ([, value]) => value ?? 'Website',
icon: 'ri:global-line', icon: 'ri:global-line',
}, },
] as const satisfies ContactMethodInfo[] ] as const satisfies ContactMethodInfo[]
@@ -107,10 +121,10 @@ export const {
export function formatContactMethod(url: string) { export function formatContactMethod(url: string) {
for (const contactMethod of contactMethods) { for (const contactMethod of contactMethods) {
const captureGroup = url.match(contactMethod.matcher)?.[1] const match = url.match(contactMethod.matcher)
if (!captureGroup) continue if (!match) continue
const formattedValue = contactMethod.formatter(captureGroup) const formattedValue = contactMethod.formatter(match)
if (!formattedValue) continue if (!formattedValue) continue
return { return {

View File

@@ -67,6 +67,15 @@ Once submitted, you get a unique tracking page where you can monitor its status
All new listings begin as **unlisted** — they're only accessible via direct link and won't appear in search results. After a brief admin review to confirm the request isn't spam or inappropriate, the listing will be marked as **Community Contributed**. All new listings begin as **unlisted** — they're only accessible via direct link and won't appear in search results. After a brief admin review to confirm the request isn't spam or inappropriate, the listing will be marked as **Community Contributed**.
#### Requirements
To list a new service, it must fulfill these requirements:
- Publicly available website explaining what the service is about
- Terms of service or FAQ document
For example, just a Telegram link is not a valid service.
### Suggestion Review Process ### Suggestion Review Process
#### First Review #### First Review

View File

@@ -50,6 +50,7 @@ if (reasonType === 'admin-required' && Astro.locals.user?.admin) {
<a <a
href={makeLoginUrl(Astro.url, { redirect, logout: true, message: reason })} href={makeLoginUrl(Astro.url, { redirect, logout: true, message: reason })}
data-astro-reload data-astro-reload
data-astro-prefetch="tap"
class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white" class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white"
> >
<Icon <Icon
@@ -62,6 +63,7 @@ if (reasonType === 'admin-required' && Astro.locals.user?.admin) {
Astro.locals.actualUser && ( Astro.locals.actualUser && (
<a <a
href={makeUnimpersonateUrl(Astro.url, { redirect })} href={makeUnimpersonateUrl(Astro.url, { redirect })}
data-astro-prefetch="tap"
class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white" class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white"
> >
<Icon <Icon