Skip to content

Commit 10fb80d

Browse files
committed
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.
1 parent a604655 commit 10fb80d

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

backend/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def dispatch(self, request: Request, call_next):
8484
allow_origins=ALLOWED_ORIGINS,
8585
allow_origin_regex=ALLOW_ORIGIN_REGEX or None,
8686
allow_credentials=True,
87-
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
87+
allow_methods=["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
8888
allow_headers=["Authorization", "Content-Type"],
8989
)
9090

frontend/src/App.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { APIOverviewPage, APIRepositoriesPage, APISearchPage, APIAnalysisPage }
1717
import { ArchitecturePage } from './pages/ArchitecturePage';
1818
import { ContributingPage } from './pages/ContributingPage';
1919
import { GitHubCallbackPage } from './pages/GitHubCallbackPage';
20+
import { AdminPage } from './pages/AdminPage';
2021
import { ScrollToTop } from './components/ScrollToTop';
2122
import { ErrorBoundary } from './components/ErrorBoundary';
2223

@@ -110,6 +111,18 @@ function AppRoutes() {
110111
/>
111112

112113

114+
{/* Admin -- standalone route, no dashboard layout */}
115+
<Route
116+
path="/admin"
117+
element={
118+
<ProtectedRoute>
119+
<div className="min-h-screen bg-background p-8 max-w-6xl mx-auto">
120+
<AdminPage />
121+
</div>
122+
</ProtectedRoute>
123+
}
124+
/>
125+
113126
{/* Fallback */}
114127
<Route path="*" element={<Navigate to="/" replace />} />
115128
</Routes>

frontend/src/components/Dashboard.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { Routes, Route, Navigate } from 'react-router-dom'
22
import { DashboardLayout } from './dashboard/DashboardLayout'
33
import { DashboardHome } from './dashboard/DashboardHome'
44
import { SettingsPage } from '../pages/SettingsPage'
5-
import { AdminPage } from '../pages/AdminPage'
65

76
export function Dashboard() {
87
return (
98
<DashboardLayout>
109
<Routes>
1110
<Route index element={<DashboardHome />} />
1211
<Route path="settings" element={<SettingsPage />} />
13-
<Route path="admin" element={<AdminPage />} />
1412
<Route path="*" element={<Navigate to="/dashboard" replace />} />
1513
</Routes>
1614
</DashboardLayout>

frontend/src/components/dashboard/Sidebar.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Link, useLocation } from 'react-router-dom'
22
import {
33
FolderGit2,
44
BookOpen,
5-
Shield,
65
ChevronLeft,
76
ChevronRight,
87
ExternalLink,
@@ -25,7 +24,6 @@ interface NavItem {
2524

2625
const mainNavItems: NavItem[] = [
2726
{ name: 'Repositories', href: '/dashboard', icon: <FolderGit2 className="w-5 h-5" /> },
28-
{ name: 'Admin', href: '/dashboard/admin', icon: <Shield className="w-5 h-5" /> },
2927
]
3028

3129
const bottomNavItems: NavItem[] = [

frontend/src/pages/AdminPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function AdminPage() {
5050
return resp.json()
5151
},
5252
enabled: !!session?.access_token,
53+
retry: false,
5354
})
5455

5556
const users = data?.users ?? []

0 commit comments

Comments
 (0)