feat: harden admin security, add AI trip planner, map view, and SEO/notification improvements

Security:
- requireAdmin() session check added to every admin-only server action
  (previously relied only on middleware path matching, which Next.js
  Server Actions don't reliably respect)
- Real Prisma + bcrypt admin auth, replacing hardcoded credentials; split
  into an Edge-safe auth.config.ts (used by proxy.ts) and the full
  Prisma-backed auth.ts (route handler, server actions, server components)
- Removed hardcoded fallback secret on the Instagram sync cron endpoint
- Honeypot field + per-IP rate limiting on contact/business-submission
  forms and the analytics events endpoint

Features:
- AI trip planner (/plan-olustur, /plan/[id]) backed by DeepSeek, grounded
  to only recommend isLocalApproved listings, with a deterministic
  link-injection fallback for anything the model doesn't format as markdown
- Interactive Leaflet/OpenStreetMap view on category listing pages
- Telegram notifications for new contact messages and business submissions

SEO:
- Brand-consistent favicon/apple-icon/PWA icons and default Open Graph/
  Twitter share images, generated via next/og (replacing default Next.js
  placeholders)
- BreadcrumbList structured data on category and listing detail pages
- Fixed two remaining raw <img> tags to use next/image

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
AyrisAI
2026-08-24 00:01:06 +03:00
co-authored by Claude Sonnet 5
parent 390bd699a6
commit 1b8cfeda95
62 changed files with 2216 additions and 411 deletions
+39 -22
View File
@@ -61,6 +61,7 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
...categoryItems,
{ name: t('events'), href: '/events' },
{ name: t('blog'), href: '/blog' },
{ name: t('aiPlanner'), href: '/plan-olustur' },
]
const handleLanguageChange = (localeCode: string) => {
@@ -83,7 +84,7 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
<p className="font-heading font-extrabold text-lg text-stone tracking-tight leading-none lowercase">
marmaris <span className="text-turquoise">local</span>
</p>
<p className="text-[9px] font-mono text-shutter tracking-wider mt-0.5 uppercase">
<p className="text-[10px] font-mono text-stone/75 font-medium tracking-wider mt-0.5 uppercase">
local knowledge
</p>
</div>
@@ -108,15 +109,16 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
{/* Action Items */}
<div className="hidden lg:flex items-center gap-4">
{/* Saved items trigger */}
{/* Saved items trigger - 44px touch target */}
<Link
href="/saved"
className="relative w-8 h-8 rounded-full border border-stone/20 hover:border-turquoise transition text-stone hover:text-turquoise flex items-center justify-center"
className="relative w-11 h-11 rounded-full border border-stone/20 hover:border-turquoise transition text-stone hover:text-turquoise flex items-center justify-center shrink-0"
title={t('saved')}
aria-label={t('saved')}
>
<Heart className="w-4 h-4" />
<Heart className="w-4.5 h-4.5" />
{favoritesCount > 0 && (
<span className="absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-bougainvillea text-stone text-[8px] font-mono font-bold flex items-center justify-center shadow-sm shrink-0">
<span className="absolute -top-1 -right-1 w-4 h-4 rounded-full bg-bougainvillea text-stone text-[8px] font-mono font-bold flex items-center justify-center shadow-sm shrink-0">
{favoritesCount}
</span>
)}
@@ -125,10 +127,14 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
{/* Language Selector */}
<div className="relative">
<button
type="button"
onClick={() => setLangMenuOpen(!langMenuOpen)}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-stone/20 hover:border-turquoise transition text-xs font-mono"
className="flex items-center gap-1.5 px-3.5 py-2.5 rounded-full border border-stone/20 hover:border-turquoise transition text-xs font-mono min-h-[44px] cursor-pointer"
aria-label="Select language"
aria-expanded={langMenuOpen}
aria-haspopup="true"
>
<Globe className="w-3.5 h-3.5 text-turquoise" />
<Globe className="w-4 h-4 text-turquoise" />
{activeLocale.toUpperCase()}
</button>
@@ -139,12 +145,13 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
{languages.map((lang) => (
<button
key={lang.code}
type="button"
onClick={() => handleLanguageChange(lang.code)}
className={`w-full text-left px-4 py-2 text-xs hover:bg-stone transition flex items-center justify-between ${activeLocale === lang.code ? 'font-bold text-turquoise bg-stone/40' : 'text-ink/80'
className={`w-full text-left px-4 py-2.5 text-xs hover:bg-stone transition flex items-center justify-between min-h-[40px] cursor-pointer ${activeLocale === lang.code ? 'font-bold text-turquoise bg-stone/40' : 'text-ink/80'
}`}
>
{lang.label}
<span className="font-mono text-[10px] text-shutter">{lang.code.toUpperCase()}</span>
<span className="font-mono text-[10px] text-pine/70">{lang.code.toUpperCase()}</span>
</button>
))}
</div>
@@ -155,47 +162,53 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
{/* Add Business Button */}
<Link
href="/add-business"
className="flex items-center gap-1.5 bg-turquoise hover:bg-turquoise/90 text-paper font-medium text-xs py-2 px-4 rounded-full transition-transform active:scale-95 shadow-sm"
className="flex items-center gap-1.5 bg-turquoise hover:bg-turquoise/90 text-paper font-medium text-xs py-2.5 px-4 rounded-full transition-transform active:scale-95 shadow-sm min-h-[44px]"
>
<PlusCircle className="w-3.5 h-3.5" />
<PlusCircle className="w-4 h-4" />
{t('addBusiness')}
</Link>
</div>
{/* Mobile menu button */}
<div className="flex items-center gap-3 lg:hidden">
{/* Mobile Saved trigger */}
<div className="flex items-center gap-2 lg:hidden">
{/* Mobile Saved trigger - 44px touch target */}
<Link
href="/saved"
className="relative w-8 h-8 rounded-full border border-stone/20 text-stone flex items-center justify-center"
className="relative w-11 h-11 rounded-full border border-stone/20 text-stone flex items-center justify-center shrink-0"
title={t('saved')}
aria-label={t('saved')}
>
<Heart className="w-4 h-4" />
<Heart className="w-4.5 h-4.5" />
{favoritesCount > 0 && (
<span className="absolute -top-1.5 -right-1.5 w-3.5 h-3.5 rounded-full bg-bougainvillea text-stone text-[8px] font-mono font-bold flex items-center justify-center shadow-sm shrink-0">
<span className="absolute -top-1 -right-1 w-4 h-4 rounded-full bg-bougainvillea text-stone text-[8px] font-mono font-bold flex items-center justify-center shadow-sm shrink-0">
{favoritesCount}
</span>
)}
</Link>
{/* Lang menu for mobile */}
{/* Lang menu for mobile - 44px touch target */}
<div className="relative">
<button
type="button"
onClick={() => setLangMenuOpen(!langMenuOpen)}
className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-full border border-stone/20 text-xs font-mono"
className="flex items-center gap-1.5 px-3 py-2.5 rounded-full border border-stone/20 text-xs font-mono min-h-[44px] cursor-pointer"
aria-label="Select language"
aria-expanded={langMenuOpen}
aria-haspopup="true"
>
<Globe className="w-3.5 h-3.5 text-turquoise" />
<Globe className="w-4 h-4 text-turquoise" />
{activeLocale.toUpperCase()}
</button>
{langMenuOpen && (
<>
<div className="fixed inset-0 z-10" onClick={() => setLangMenuOpen(false)} />
<div className="absolute right-0 mt-2 w-32 rounded-xl bg-paper text-ink shadow-lg ring-1 ring-black/5 z-20 py-1">
<div className="absolute right-0 mt-2 w-36 rounded-xl bg-paper text-ink shadow-lg ring-1 ring-black/5 z-20 py-1">
{languages.map((lang) => (
<button
key={lang.code}
type="button"
onClick={() => handleLanguageChange(lang.code)}
className="w-full text-left px-3 py-1.5 text-xs hover:bg-stone"
className="w-full text-left px-4 py-2.5 text-xs hover:bg-stone min-h-[40px] cursor-pointer"
>
{lang.label}
</button>
@@ -205,9 +218,13 @@ export default function Navbar({ categories = [] }: { categories?: Category[] })
)}
</div>
{/* Mobile Menu Toggle Button - 44px touch target */}
<button
type="button"
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
className="text-stone hover:text-turquoise focus:outline-none"
className="w-11 h-11 flex items-center justify-center rounded-xl text-stone hover:text-turquoise hover:bg-white/10 transition cursor-pointer"
aria-label="Toggle navigation menu"
aria-expanded={mobileMenuOpen}
>
{mobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
</button>