From 0fd6721752f05e8a201c6fbb4ee3fd3647e105d2 Mon Sep 17 00:00:00 2001 From: aamoghS Date: Tue, 17 Feb 2026 18:49:22 -0500 Subject: [PATCH 1/2] ok --- .gitignore | 2 + packages/api/src/middleware/security.ts | 12 +-- sites/mainweb/components/Card/index.tsx | 92 ---------------- sites/mainweb/components/EventCard/index.tsx | 40 ------- .../components/InlineRadioInput/index.tsx | 50 --------- sites/mainweb/components/InputField/index.tsx | 102 ------------------ .../components/LearnMore/LearnMore.tsx | 38 ------- sites/mainweb/lib/trpc.tsx | 48 +-------- sites/mainweb/next.config.mjs | 15 +++ 9 files changed, 24 insertions(+), 375 deletions(-) delete mode 100644 sites/mainweb/components/Card/index.tsx delete mode 100644 sites/mainweb/components/EventCard/index.tsx delete mode 100644 sites/mainweb/components/InlineRadioInput/index.tsx delete mode 100644 sites/mainweb/components/InputField/index.tsx delete mode 100644 sites/mainweb/components/LearnMore/LearnMore.tsx diff --git a/.gitignore b/.gitignore index 72ed689..cf35c41 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,9 @@ nul npm-debug.log* yarn-debug.log* yarn-error.log* +yarn-error.log* .pnpm-debug.log* +*.log # Local env files .env diff --git a/packages/api/src/middleware/security.ts b/packages/api/src/middleware/security.ts index 5329ed0..e08ef87 100644 --- a/packages/api/src/middleware/security.ts +++ b/packages/api/src/middleware/security.ts @@ -22,12 +22,12 @@ const ipTrackingStore = new Map(); // DDoS Protection Constants const DDOS_CONFIG = { - maxRequestsPerMinute: 120, // Max requests per minute per IP - suspiciousThreshold: 100, // Requests that trigger suspicious flag - blockDurationMs: 5 * 60 * 1000, // 5 minutes block for suspicious IPs - burstThreshold: 30, // Max requests in 5 seconds - burstWindowMs: 5 * 1000, // 5 second burst window - cleanupIntervalMs: 60 * 1000, // Cleanup every minute + maxRequestsPerMinute: 3000, // Increased for venue WiFi (100 judges @ 30rpm) + suspiciousThreshold: 2000, + blockDurationMs: 5 * 60 * 1000, + burstThreshold: 500, // Allow 100 concurrent page loads + burstWindowMs: 5 * 1000, + cleanupIntervalMs: 60 * 1000, }; // Cleanup expired records diff --git a/sites/mainweb/components/Card/index.tsx b/sites/mainweb/components/Card/index.tsx deleted file mode 100644 index b2d52d5..0000000 --- a/sites/mainweb/components/Card/index.tsx +++ /dev/null @@ -1,92 +0,0 @@ -"use client"; - -import { useState, ReactNode } from "react"; -import Image, { StaticImageData } from "next/image"; - -interface CardProps { - img?: string | StaticImageData; - imgClassName?: string; - heading?: string; - linkUrl?: string; - children?: ReactNode; - className?: string; -} - -export default function Card({ img, imgClassName = "", heading, linkUrl, children, className = "" }: CardProps) { - const [imgError, setImgError] = useState(false); - - // Compute initials from heading to use in the fallback placeholder - const initials = heading - ? heading - .split(/\s+/) - .slice(0, 2) - .map((w) => w[0]) - .join("") - .toUpperCase() - : "PG"; // PG = Project - - return ( -
- {/* Image */} - {img && ( -
- {!imgError ? ( - {heading { - // log for easier debugging and show the fallback - // eslint-disable-next-line no-console - console.error("Project image failed to load:", heading, e); - setImgError(true); - }} - // keep placeholder prop for optimization while handling potential failures - placeholder="empty" - /> - ) : ( - // Fallback: simple SVG with initials so something meaningful is always visible -
- - - {initials} - -
- )} -
- )} - - {/* Content */} -
- {/* Heading */} - {heading && ( -
- {linkUrl ? ( - - {heading} - - ) : ( -

{heading}

- )} -
- )} - - {/* Description */} - {children && ( -
- {children} -
- )} -
-
- ); -} diff --git a/sites/mainweb/components/EventCard/index.tsx b/sites/mainweb/components/EventCard/index.tsx deleted file mode 100644 index 7018b3b..0000000 --- a/sites/mainweb/components/EventCard/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -// components/EventCard/index.tsx -"use client"; - -import Image, { StaticImageData } from "next/image"; -import Link from "next/link"; - -interface EventCardProps { - img: string | StaticImageData; - heading: string; - when?: string; - button_text: string; - button_to: string; - target?: string; - rel?: string; - className?: string; - children: React.ReactNode; -} - -const EventCard = ({ img, heading, when, button_text, button_to, target, rel, className, children }: EventCardProps) => { - const isExternal = button_to.startsWith("http"); - const outTarget = isExternal ? target ?? "_blank" : target; - const outRel = isExternal ? rel ?? "noopener noreferrer" : rel; - return ( -
-
- {heading} -
-
-

{heading}

- {when && {when}} -

{children}

- - {button_text} - -
-
- ); -}; - -export default EventCard; diff --git a/sites/mainweb/components/InlineRadioInput/index.tsx b/sites/mainweb/components/InlineRadioInput/index.tsx deleted file mode 100644 index f8ca83d..0000000 --- a/sites/mainweb/components/InlineRadioInput/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -"use client"; - -import { ChangeEvent } from "react"; - -interface InlineRadioInputProps { - color: string; - label: string; - value: string; - name: string; - onChange: (e: ChangeEvent) => void; - type?: string; - checked?: boolean; -} - -export default function InlineRadioInput({ - color, - label, - value, - name, - onChange, - type = "radio", - checked = false, -}: InlineRadioInputProps) { - const id = `${label.replaceAll(" ", "-")}-${name.replaceAll(" ", "-")}`; - - return ( -
- - -
- ); -} diff --git a/sites/mainweb/components/InputField/index.tsx b/sites/mainweb/components/InputField/index.tsx deleted file mode 100644 index 83704a8..0000000 --- a/sites/mainweb/components/InputField/index.tsx +++ /dev/null @@ -1,102 +0,0 @@ -"use client"; - -import { ChangeEvent } from "react"; - -interface InputFieldProps { - width?: string | number; - placeholder?: string; - name?: string; - helper?: boolean; - validIndication?: boolean; - type?: "text" | "email" | "password" | "submit" | "textarea"; - required?: boolean; - onChange?: (e: ChangeEvent) => void; - pattern?: string; - originalValue?: string; - onClick?: () => void; - helperText?: string; -} - -export default function InputField({ - width = "300px", - placeholder = "", - name, - helper, - validIndication, - type = "text", - required, - onChange, - pattern, - originalValue, - onClick, - helperText, -}: InputFieldProps) { - const id = name || placeholder.replaceAll(" ", ""); - - if (type === "submit") { - return ( -
- -
- ); - } - - if (type === "textarea") { - return ( -
- {helperText &&

{helperText}

} -