From 10fb80d7e0e737ca790c1b694dac407888b3d696 Mon Sep 17 00:00:00 2001 From: Devanshu Rajesh Chicholikar Date: Sun, 1 Mar 2026 23:53:54 -0500 Subject: [PATCH] fix: isolate admin to standalone /admin route + add PATCH to CORS Admin completely removed from user dashboard: - Removed from Dashboard.tsx (no /dashboard/admin route) - Removed from Sidebar.tsx (no admin link, no Shield icon) - Zero admin traces in any user-facing component Admin is now a standalone route: - /admin in App.tsx -- no DashboardLayout, no sidebar, no topnav - ProtectedRoute wraps it (must be logged in) - Backend 403 enforces ADMIN_EMAILS check - retry:false prevents non-admins from hammering 403 Vercel rewrite added: - admin.opencodeintel.com -> /admin (add domain in Vercel dashboard) Also: PATCH added to CORS allow_methods for tier update endpoint. --- backend/main.py | 2 +- frontend/src/App.tsx | 13 +++++++++++++ frontend/src/components/Dashboard.tsx | 2 -- frontend/src/components/dashboard/Sidebar.tsx | 2 -- frontend/src/pages/AdminPage.tsx | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/main.py b/backend/main.py index 6792c66..09245ab 100644 --- a/backend/main.py +++ b/backend/main.py @@ -84,7 +84,7 @@ async def dispatch(self, request: Request, call_next): allow_origins=ALLOWED_ORIGINS, allow_origin_regex=ALLOW_ORIGIN_REGEX or None, allow_credentials=True, - allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"], + allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], allow_headers=["Authorization", "Content-Type"], ) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d9a161a..2585fe4 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -17,6 +17,7 @@ import { APIOverviewPage, APIRepositoriesPage, APISearchPage, APIAnalysisPage } import { ArchitecturePage } from './pages/ArchitecturePage'; import { ContributingPage } from './pages/ContributingPage'; import { GitHubCallbackPage } from './pages/GitHubCallbackPage'; +import { AdminPage } from './pages/AdminPage'; import { ScrollToTop } from './components/ScrollToTop'; import { ErrorBoundary } from './components/ErrorBoundary'; @@ -110,6 +111,18 @@ function AppRoutes() { /> + {/* Admin -- standalone route, no dashboard layout */} + +
+ +
+ + } + /> + {/* Fallback */} } /> diff --git a/frontend/src/components/Dashboard.tsx b/frontend/src/components/Dashboard.tsx index 4018716..9f46503 100644 --- a/frontend/src/components/Dashboard.tsx +++ b/frontend/src/components/Dashboard.tsx @@ -2,7 +2,6 @@ import { Routes, Route, Navigate } from 'react-router-dom' import { DashboardLayout } from './dashboard/DashboardLayout' import { DashboardHome } from './dashboard/DashboardHome' import { SettingsPage } from '../pages/SettingsPage' -import { AdminPage } from '../pages/AdminPage' export function Dashboard() { return ( @@ -10,7 +9,6 @@ export function Dashboard() { } /> } /> - } /> } /> diff --git a/frontend/src/components/dashboard/Sidebar.tsx b/frontend/src/components/dashboard/Sidebar.tsx index be100f9..0753e33 100644 --- a/frontend/src/components/dashboard/Sidebar.tsx +++ b/frontend/src/components/dashboard/Sidebar.tsx @@ -2,7 +2,6 @@ import { Link, useLocation } from 'react-router-dom' import { FolderGit2, BookOpen, - Shield, ChevronLeft, ChevronRight, ExternalLink, @@ -25,7 +24,6 @@ interface NavItem { const mainNavItems: NavItem[] = [ { name: 'Repositories', href: '/dashboard', icon: }, - { name: 'Admin', href: '/dashboard/admin', icon: }, ] const bottomNavItems: NavItem[] = [ diff --git a/frontend/src/pages/AdminPage.tsx b/frontend/src/pages/AdminPage.tsx index 96bac81..ac11fef 100644 --- a/frontend/src/pages/AdminPage.tsx +++ b/frontend/src/pages/AdminPage.tsx @@ -50,6 +50,7 @@ export function AdminPage() { return resp.json() }, enabled: !!session?.access_token, + retry: false, }) const users = data?.users ?? []