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
+65 -49
View File
@@ -112,23 +112,33 @@ export default function ListingCard({ listing }: { listing: Listing }) {
? listing.images[0].url
: 'https://images.unsplash.com/photo-1555396273-367ea4eb4db5?w=800&auto=format&fit=crop&q=80'
const saveAriaLabel = isSaved
? locale === 'ru'
? 'Удалить из избранного'
: locale === 'en'
? 'Remove from saved'
: 'Favorilerden çıkar'
: locale === 'ru'
? 'Добавить в избранное'
: locale === 'en'
? 'Save listing'
: 'Favorilere ekle'
return (
<Link
href={`/${categorySlug}/${listing.slug}`}
className="group bg-paper rounded-2xl border border-pine/8 overflow-hidden flex flex-col relative shadow-sm hover:shadow-md hover:border-turquoise/35 transition-all duration-300 transform hover:-translate-y-0.5"
>
{/* Heart Save Button */}
<div className="group bg-paper rounded-2xl border border-pine/8 overflow-hidden flex flex-col relative shadow-sm hover:shadow-md hover:border-turquoise/35 transition-all duration-300 transform hover:-translate-y-0.5">
{/* Heart Save Button - Decoupled from card link for HTML valid semantics & 44px min touch area */}
<button
type="button"
onClick={toggleSave}
className="absolute top-4 left-4 z-20 w-9 h-9 rounded-full bg-paper/95 border border-pine/8 flex items-center justify-center shadow-sm hover:bg-stone transition duration-150 text-pine"
aria-label="Kaydet"
className="absolute top-3 left-3 z-20 min-w-[44px] min-h-[44px] rounded-full bg-paper/95 border border-pine/10 flex items-center justify-center shadow-sm hover:bg-stone transition duration-150 text-pine cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-turquoise"
aria-label={saveAriaLabel}
>
<Heart className={`w-4.5 h-4.5 transition duration-150 ${isSaved ? 'fill-bougainvillea text-bougainvillea' : 'text-pine/70 hover:text-pine'}`} />
<Heart className={`w-5 h-5 transition duration-150 ${isSaved ? 'fill-bougainvillea text-bougainvillea' : 'text-pine/70 hover:text-pine'}`} />
</button>
{/* Local Approved Seal */}
{listing.isLocalApproved && (
<div className="absolute top-4 right-4 z-10 w-[52px] h-[52px] rounded-full border-[1.5px] border-turquoise bg-paper flex items-center justify-center -rotate-12 shadow-sm shrink-0">
<div className="absolute top-3 right-3 z-10 w-[52px] h-[52px] rounded-full border-[1.5px] border-turquoise bg-paper flex items-center justify-center -rotate-12 shadow-sm shrink-0 pointer-events-none">
<div className="absolute inset-[2.5px] rounded-full border border-dashed border-turquoise/60" />
<span className="font-mono text-[7px] text-center font-bold text-turquoise tracking-tight leading-[1.1] uppercase">
YEREL<br />ONAYLI
@@ -136,49 +146,55 @@ export default function ListingCard({ listing }: { listing: Listing }) {
</div>
)}
{/* Image Preview */}
<div className="aspect-[4/3] w-full relative bg-stone-deep overflow-hidden">
<Image
src={mainImageUrl}
alt={name}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
className="object-cover transition-transform duration-500 group-hover:scale-105"
/>
<div className="absolute inset-0 bg-gradient-to-t from-pine/30 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
</div>
{/* Content Details */}
<div className="p-5 flex-1 flex flex-col justify-between">
<div>
{/* Category */}
<div className="text-[10px] font-mono text-bougainvillea font-bold uppercase tracking-wider mb-2">
{categoryName}
</div>
{/* Title */}
<h3 className="font-heading font-bold text-lg text-pine leading-tight mb-2 group-hover:text-turquoise transition-colors line-clamp-1">
{name}
</h3>
{/* Neighborhood */}
<div className="text-xs text-ink/60 font-medium mb-4">
{neighborhoodName}
</div>
{/* Main Card Content Link */}
<Link
href={`/${categorySlug}/${listing.slug}`}
className="flex-1 flex flex-col focus:outline-none focus-visible:ring-2 focus-visible:ring-turquoise"
>
{/* Image Preview */}
<div className="aspect-[4/3] w-full relative bg-stone-deep overflow-hidden">
<Image
src={mainImageUrl}
alt={name}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
className="object-cover transition-transform duration-500 group-hover:scale-105"
/>
<div className="absolute inset-0 bg-gradient-to-t from-pine/30 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
</div>
{/* Footer info (price range, rating) */}
<div className="border-t border-dashed border-pine/12 pt-3.5 mt-auto flex items-center justify-between text-xs font-mono">
<span className="text-pine font-semibold">{priceSymbols}</span>
{listing.rating && (
<div className="flex items-center gap-1 text-gold font-bold">
<Star className="w-3.5 h-3.5 fill-gold stroke-gold" />
<span> {listing.rating.toFixed(1)}</span>
{/* Content Details */}
<div className="p-5 flex-1 flex flex-col justify-between">
<div>
{/* Category */}
<div className="text-[10px] font-mono text-bougainvillea font-bold uppercase tracking-wider mb-2">
{categoryName}
</div>
)}
{/* Title */}
<h3 className="font-heading font-bold text-lg text-pine leading-tight mb-2 group-hover:text-turquoise transition-colors line-clamp-1">
{name}
</h3>
{/* Neighborhood */}
<div className="text-xs text-ink/70 font-medium mb-4">
{neighborhoodName}
</div>
</div>
{/* Footer info (price range, rating) */}
<div className="border-t border-dashed border-pine/12 pt-3.5 mt-auto flex items-center justify-between text-xs font-mono">
<span className="text-pine font-semibold">{priceSymbols}</span>
{listing.rating && (
<div className="flex items-center gap-1 text-gold font-bold">
<Star className="w-3.5 h-3.5 fill-gold stroke-gold" />
<span>{listing.rating.toFixed(1)}</span>
</div>
)}
</div>
</div>
</div>
</Link>
</Link>
</div>
)
}