diff --git a/app/api/analytics/route.ts b/app/api/analytics/route.ts new file mode 100644 index 0000000..39c7cec --- /dev/null +++ b/app/api/analytics/route.ts @@ -0,0 +1,30 @@ +import { NextResponse } from 'next/server'; + +export async function POST(req: Request) { + try { + const body = await req.json(); + const headers = req.headers; + + // Get IP here since we are the public facing entity + const ip = headers.get('x-forwarded-for') || 'unknown'; + + // Relay to Admin Dashboard (Internal Docker Network) + // admin_dash must be reachable. If in same docker network, use container name. + // If separate, use host.docker.internal or configured URL. + const adminUrl = process.env.ADMIN_DASH_URL || 'http://admin_dash:3000/api/track'; + + // We fire and forget - don't wait for response to keep this fast + fetch(adminUrl, { + method: 'POST', + body: JSON.stringify({ ...body, ip }), // Pass IP along + headers: { + 'Content-Type': 'application/json', + 'X-Forwarded-For': ip // Preserve IP + }, + }).catch(e => console.error('Relay failed', e)); + + return NextResponse.json({ success: true }); + } catch (error) { + return NextResponse.json({ success: false }); + } +} diff --git a/app/page.tsx b/app/page.tsx index 6b0027e..5ae26d9 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,3 +1,5 @@ +import Image from "next/image"; + export default function Home() { return (
@@ -10,7 +12,7 @@ export default function Home() {
-
+
{/* Left Column: Text & Info */}
@@ -55,21 +57,21 @@ export default function Home() {

Currently: - Writing about the architecture of personal sites. Read latest → + Writing about deep learning happenings Read latest →

{/* Right Column: Photo */}
-
+
{/* UNCOMMENT AFTER ADDING public/profile.jpg */} - {/* Akshay Kolli */} + Akshay Kolli {/* Placeholder */} -
+ {/*
profile.jpg -
+
*/}
diff --git a/app/resume/page.tsx b/app/resume/page.tsx index 2016262..80d9255 100644 --- a/app/resume/page.tsx +++ b/app/resume/page.tsx @@ -3,9 +3,7 @@ export default function ResumePage() {

Resume

-

- Academic and professional timeline. -

+
{/* Timeline Section */} diff --git a/components/Analytics.tsx b/components/Analytics.tsx index 6319483..164a83d 100644 --- a/components/Analytics.tsx +++ b/components/Analytics.tsx @@ -10,12 +10,8 @@ export function Analytics() { // Send beacon on mount and path change const sendBeacon = async () => { try { - // Point to the Admin Dashboard API - // In prod, this URL needs to be the absolute URL of admin_dash - // For local docker, standard localhost access might work if CORS allows, - // or we route through a proxy. - // For this personal setup, let's assume they are on same domain or localhost. - await fetch('http://localhost:3000/api/track', { // TODO: Make this configurable + // Send beacon to THIS website's API, which will relay it to the admin dash + await fetch('/api/analytics', { method: 'POST', body: JSON.stringify({ path: pathname, timestamp: Date.now() }), headers: { 'Content-Type': 'application/json' }, diff --git a/components/layout/Footer.tsx b/components/layout/Footer.tsx index b5b56ca..92c3ca8 100644 --- a/components/layout/Footer.tsx +++ b/components/layout/Footer.tsx @@ -2,7 +2,6 @@ export function Footer() { return (