diff --git a/app/admin/page.tsx b/app/admin/page.tsx
index 8d03f12..2b36bcc 100644
--- a/app/admin/page.tsx
+++ b/app/admin/page.tsx
@@ -3,7 +3,7 @@
import { useState, useEffect, useRef } from 'react';
import { Card, Portal, MediaItem, CardType } from '@/types';
import { EXTERNAL_LINK_ENABLED as EXTERNAL_LINK_DEFAULT } from '@/lib/config';
-import { CARD_LIMITS } from '@/lib/validation';
+import { CARD_LIMITS, PORTAL_LIMITS } from '@/lib/validation';
type CharCounterProps = { value: string | undefined; limit: number };
function CharCounter({ value, limit }: CharCounterProps) {
@@ -609,12 +609,14 @@ export default function AdminDashboard() {
- setPortal({...portal, title: e.target.value})} className={inputClasses} />
+ setPortal({...portal, title: e.target.value})} className={inputClasses} />
+
-
+
-
diff --git a/app/api/portals/route.ts b/app/api/portals/route.ts
index e37bdcc..733a604 100644
--- a/app/api/portals/route.ts
+++ b/app/api/portals/route.ts
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server';
import { revalidatePath } from 'next/cache'; // ADD THIS
import { getPortals, savePortals } from '@/lib/db';
import { isValidHexColor } from '@/lib/sanitize';
+import { validatePortal } from '@/lib/validation';
import { Portal } from '@/types';
export const dynamic = 'force-dynamic';
@@ -15,6 +16,11 @@ export async function POST(request: Request) {
try {
const incomingPortal: Portal = await request.json();
+ const { valid, errors } = validatePortal(incomingPortal);
+ if (!valid) {
+ return NextResponse.json({ error: 'Validation failed', errors }, { status: 400 });
+ }
+
// themeColor goes into a