Compare commits
1 Commits
codex/refa
...
codex/guar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d948e0222 |
@@ -48,6 +48,13 @@ load_dotenv(backend_dir / '.env') # backend/.env
|
|||||||
load_dotenv(project_root / '.env') # root .env (fallback)
|
load_dotenv(project_root / '.env') # root .env (fallback)
|
||||||
load_dotenv() # CWD .env (fallback)
|
load_dotenv() # CWD .env (fallback)
|
||||||
|
|
||||||
|
PODCAST_ONLY_DEMO_MODE = os.getenv("PODCAST_ONLY_DEMO_MODE", "false").lower() in {
|
||||||
|
"1",
|
||||||
|
"true",
|
||||||
|
"yes",
|
||||||
|
"on",
|
||||||
|
}
|
||||||
|
|
||||||
# Set up clean logging for end users
|
# Set up clean logging for end users
|
||||||
from logging_config import setup_clean_logging
|
from logging_config import setup_clean_logging
|
||||||
setup_clean_logging()
|
setup_clean_logging()
|
||||||
@@ -183,7 +190,9 @@ rate_limiter = RateLimiter(window_seconds=60, max_requests=200)
|
|||||||
frontend_serving = FrontendServing(app)
|
frontend_serving = FrontendServing(app)
|
||||||
router_manager = RouterManager(app)
|
router_manager = RouterManager(app)
|
||||||
|
|
||||||
onboarding_manager = OnboardingManager(app)
|
onboarding_manager = None
|
||||||
|
if not PODCAST_ONLY_DEMO_MODE:
|
||||||
|
onboarding_manager = OnboardingManager(app)
|
||||||
|
|
||||||
# Middleware Order (FastAPI executes in REVERSE order of registration - LIFO):
|
# Middleware Order (FastAPI executes in REVERSE order of registration - LIFO):
|
||||||
# Registration order: 1. Monitoring 2. Rate Limit 3. API Key Injection
|
# Registration order: 1. Monitoring 2. Rate Limit 3. API Key Injection
|
||||||
@@ -255,7 +264,14 @@ async def router_status():
|
|||||||
# Onboarding management endpoints
|
# Onboarding management endpoints
|
||||||
@app.get("/api/onboarding/status")
|
@app.get("/api/onboarding/status")
|
||||||
async def onboarding_status():
|
async def onboarding_status():
|
||||||
"""Get onboarding manager status."""
|
"""Get onboarding manager status (or demo-mode disabled state)."""
|
||||||
|
if PODCAST_ONLY_DEMO_MODE:
|
||||||
|
return {
|
||||||
|
"enabled": False,
|
||||||
|
"status": "disabled",
|
||||||
|
"message": "Onboarding is disabled for podcast-only demo mode.",
|
||||||
|
"demo_mode": "podcast_only",
|
||||||
|
}
|
||||||
return onboarding_manager.get_onboarding_status()
|
return onboarding_manager.get_onboarding_status()
|
||||||
|
|
||||||
# Include routers using modular utilities
|
# Include routers using modular utilities
|
||||||
|
|||||||
@@ -280,11 +280,10 @@ const InitialRouteHandler: React.FC = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only block on onboarding initialization once we know the user has an active subscription.
|
// Loading state - only wait for onboarding init, not subscription check
|
||||||
// This allows no-subscription/inactive flows to continue even when onboarding data is still null.
|
// Subscription check is non-blocking and happens in background
|
||||||
const isActiveSubscriber = Boolean(subscription && subscription.active && subscription.plan !== 'none');
|
const waitingForOnboardingInit = loading || !data;
|
||||||
const waitingForOnboardingInit = isActiveSubscriber && (loading || !data);
|
if (loading || waitingForOnboardingInit) {
|
||||||
if (waitingForOnboardingInit) {
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
display="flex"
|
display="flex"
|
||||||
@@ -296,7 +295,7 @@ const InitialRouteHandler: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<CircularProgress size={60} />
|
<CircularProgress size={60} />
|
||||||
<Typography variant="h6" color="textSecondary">
|
<Typography variant="h6" color="textSecondary">
|
||||||
Preparing your workspace...
|
{subscriptionLoading ? 'Checking subscription...' : 'Preparing your workspace...'}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user