File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,13 +19,18 @@ export const defaultAdminSettings: AdminSettings = {
1919} ;
2020
2121export async function loadAdminSettings ( ) : Promise < AdminSettings > {
22- const file = await getFile ( adminSettingsFile ) ;
23- if ( ! file ) {
22+ try {
23+ const file = await getFile ( adminSettingsFile ) ;
24+ if ( ! file ) {
25+ return defaultAdminSettings ;
26+ }
27+
28+ const { data } = parseFrontmatter < AdminSettings > ( file . content ) ;
29+ return { ...defaultAdminSettings , ...data } ;
30+ } catch ( error ) {
31+ console . error ( 'Error loading admin settings, using defaults:' , error ) ;
2432 return defaultAdminSettings ;
2533 }
26-
27- const { data } = parseFrontmatter < AdminSettings > ( file . content ) ;
28- return { ...defaultAdminSettings , ...data } ;
2934}
3035
3136export async function saveAdminSettings ( settings : AdminSettings ) : Promise < void > {
@@ -54,6 +59,8 @@ export function AdminSettingsProvider({ children }: { children: React.ReactNode
5459 } )
5560 . catch ( ( error ) => {
5661 console . error ( 'Failed to load admin settings:' , error ) ;
62+ // Use default settings on error
63+ setSettings ( defaultAdminSettings ) ;
5764 } )
5865 . finally ( ( ) => {
5966 setIsLoading ( false ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export function AuthPage() {
1515 const [ isUsernameValid , setIsUsernameValid ] = useState ( true ) ;
1616 const [ usernameError , setUsernameError ] = useState ( '' ) ;
1717 const { login, user } = useAuth ( ) ;
18- const { settings } = useAdminSettings ( ) ;
18+ const { settings, isLoading : adminLoading } = useAdminSettings ( ) ;
1919 const { t } = useTranslation ( ) ;
2020 const navigate = useNavigate ( ) ;
2121
@@ -64,11 +64,9 @@ export function AuthPage() {
6464 return ;
6565 }
6666
67+ // Don't block on maintenance mode - let users login regardless
68+ // Maintenance mode is just for display purposes on home page
6769 const normalizedUsername = username . trim ( ) . toLowerCase ( ) ;
68- if ( settings . maintenanceMode ) {
69- setError ( t ( 'maintenanceMessage' ) ) ;
70- return ;
71- }
7270
7371 setIsSubmitting ( true ) ;
7472 setError ( '' ) ;
You can’t perform that action at this time.
0 commit comments