import "server-only"; import { MessageCircle, Send, ArrowUpRight } from "lucide-react"; import { getI18n } from "@/lib/i18n"; function communityUrl(value: string | undefined, hosts: readonly string[]) { if (!value?.trim()) return null; try { const url = new URL(value.trim()); if ( url.protocol !== "https:" || url.username || url.password || url.port || !hosts.includes(url.hostname) || url.pathname === "/" ) return null; return url.href; } catch { return null; } } export async function CommunityLinks() { const { t } = await getI18n(); const discord = communityUrl(process.env.MINEGEO_DISCORD_URL, [ "discord.gg", "discord.com", "www.discord.com", "discordapp.com", ]); const telegram = communityUrl(process.env.MINEGEO_TELEGRAM_URL, [ "t.me", "telegram.me", ]); if (!discord && !telegram) return null; return (
{discord && ( )} {telegram && ( )}
); }