Behebt Demo-Modus: committete Env-Dateien und Project-ID-Fallback

.env.development/.env.production und zentraler isDemoMode verhindern
leere VITE_APPWRITE_PROJECT_ID nach git clone ohne lokale .env.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Webklar DeployandCursor committed 2026-05-22 19:33:14 +00:00
1 parent 73d6c50b8d
commit f5257cd251
10 files changed
+108 -30

No files matched your search

+29 -4
View File
@@ -1,12 +1,37 @@
import { createContext, useContext, useState, useEffect } from 'react'
import { account, databases, DATABASE_ID, COLLECTIONS, ID, Query, hasAppwriteSession } from '../lib/appwrite'
import {
account,
databases,
DATABASE_ID,
COLLECTIONS,
ID,
Query,
hasAppwriteSession,
isDemoMode,
projectId as PROJECT_ID,
} from '../lib/appwrite'
const AuthContext = createContext()
// Demo mode when Appwrite is not configured
const DEMO_MODE = !(import.meta.env.VITE_APPWRITE_PROJECT_ID || '').trim()
const DEMO_MODE = isDemoMode
const PROJECT_ID = (import.meta.env.VITE_APPWRITE_PROJECT_ID || '').trim()
// #region agent log
if (typeof window !== 'undefined') {
fetch('http://127.0.0.1:7284/ingest/0747da40-b90b-4354-9b84-c9b550a81ec9', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '252827' },
body: JSON.stringify({
sessionId: '252827',
runId: 'pre-fix',
hypothesisId: 'B',
location: 'AuthContext.jsx:init',
message: 'Auth DEMO_MODE resolved',
data: { DEMO_MODE, PROJECT_ID: PROJECT_ID ? PROJECT_ID.slice(0, 8) : '' },
timestamp: Date.now(),
}),
}).catch(() => {})
}
// #endregion
function clearStaleAppwriteSessions() {
if (typeof window === 'undefined' || !window.localStorage) return