···11import React from 'react';
22import { Navigate } from 'react-router-dom';
33import { useAuth } from '../contexts/AuthContext';
44+import { isAccountAllowed } from '../config/allowlist';
45import Loading from './Loading/Loading';
5667// Component to protect routes that require authentication
78const ProtectedRoute = ({ children }) => {
88- const { isAuthenticated, loading } = useAuth();
99+ const { isAuthenticated, loading, session } = useAuth();
9101011 // Show loading state while authentication is being checked
1112 if (loading) {
1213 return <Loading message="Checking authentication..." />;
1314 }
14151515- // Redirect to login if not authenticated
1616+ // If not authenticated, redirect to login
1617 if (!isAuthenticated) {
1718 return <Navigate to="/login" replace />;
1819 }
19202020- // Render children if authenticated
2121+ // If authenticated but not allowed, redirect to supporter page
2222+ if (!isAccountAllowed(session)) {
2323+ return <Navigate to="/supporter" replace />;
2424+ }
2525+2626+ // Render children if authenticated and allowed
2127 return children;
2228};
2329
+14
src/config/allowlist.js
···11+// List of allowed DIDs and usernames
22+export const ALLOWED_ACCOUNTS = [
33+ 'did:plc:gq4fo3u6tqzzdkjlwzpb23tj', // Dame's DID
44+ 'dame.is' // Dame's handle
55+];
66+77+// Helper function to check if an account is allowed
88+export const isAccountAllowed = (session) => {
99+ if (!session) return false;
1010+1111+ // Check both DID and handle
1212+ return ALLOWED_ACCOUNTS.includes(session.sub) ||
1313+ ALLOWED_ACCOUNTS.includes(session.handle);
1414+};
+12-3
src/contexts/AuthContext.js
···8585 // Logout the user
8686 const logout = async () => {
8787 if (!client || !session) {
8888- console.log('No client or session available for logout'); // Debug log
8888+ console.log('No client or session available for logout');
8989 return;
9090 }
91919292 try {
9393- console.log('Attempting logout with client:', client); // Debug log
9494- // Instead of using client methods, we'll just clear the session
9393+ console.log('Attempting logout with client:', client);
9494+9595+ // Clear the session state
9596 setSession(null);
9797+9698 // Clear any stored tokens or session data
9799 localStorage.removeItem('atproto_session');
100100+101101+ // Clear any other potential storage items
102102+ localStorage.removeItem('atproto_state');
103103+ localStorage.removeItem('atproto_refresh_token');
104104+105105+ // Force a page reload to clear any remaining state
106106+ window.location.href = '/';
98107 } catch (err) {
99108 console.error('Logout failed:', err);
100109 setError(err.message);