feat: add /reset-password page
Browse filesFiles changed (3)
- README.md+95-95
- app.py+3-3
- bootstrap.py+17-5
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---title: Habadashi Login Gatewayemoji: ๐colorFrom: bluecolorTo: greensdk: dockerpinned: false---# Habadashi Login GatewayPublic gateway with Supabase authentication that dynamically loads the private ver20 application from `DLPO/habadashi` Space.## Features- Supabase email/password authentication- Cookie-based session management- Dynamic loading of private application code (source code not exposed in public repo)- Role-based access control via profiles table## Environment Variables (Set in HF Space Secrets)- `SUPABASE_URL`: Your Supabase project URL- `SUPABASE_KEY`: Your Supabase anon/service key- `HF_TOKEN`: Hugging Face token with access to private `DLPO/habadashi` Space- `OPENAI_KEY`: OpenAI API key (required by ver20)- `CLIENTPOOL`: Client pool configuration (required by ver20)## Architecture1. User visits public Space2. Bootstrap downloads ver20 from private `DLPO/habadashi` Space3. User logs in with Supabase credentials4. On successful login, ver20 Gradio app is mounted at `/app/`5. User profile and organization info loaded from `profiles` table## Startup Phase LoggingThe application logs structured startup phases to help diagnose issues. Look for these phase markers in the logs:### Expected Startup Sequence1. `[STARTUP_META]` - Environment and configuration info2. `[PHASE] bootstrap_start` - Begin downloading private app3. `[PHASE] bootstrap_end success=true` - Private app downloaded4. `[PHASE] supabase_init_start` - Initialize Supabase client5. `[PHASE] supabase_init_end success=true` - Supabase ready6. `[PHASE] fastapi_init_start/end` - FastAPI app created7. `[PHASE] create_ui_start/end` - Login UI created8. `[PHASE] import_ver20_start` - Import ver20 app9. `[PHASE] import_ver20_end success=true` - Ver20 loaded10. `[PHASE] mount_login_start/end` - Login UI mounted11. `[PHASE] mount_app_start/end` - Ver20 app mounted12. `[STARTUP_COMPLETE]` - All phases complete### Health Check EndpointOnce started, check the health endpoint:```bashcurl https://your-space.hf.space/healthz```Expected response:```json{"ok": true,"ver20_loaded": true,"private_app_dir": "./private_app"}```### Debugging Startup FailuresIf the Space fails to start or restarts repeatedly:1. **Check the last phase reached** in logs2. **Look for `[ERROR]` and `[TRACEBACK]` markers** after the last phase3. **Common failure points:**- `bootstrap_end success=false` - HF_TOKEN missing or invalid- `supabase_init_end success=false` - SUPABASE_URL/KEY missing- `import_ver20_end success=false` - Ver20 app.py structure issue- No phases after `mount_app_end` - Port binding or health check issue### Request LoggingAll HTTP requests are logged with:- `[REQUEST]` - Incoming request (method, path)- `[RESPONSE]` - Response status and durationExample:```[REQUEST] method=GET path=/[RESPONSE] method=GET path=/ status=307 duration=0.015s```1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495---title: mbok_devemoji: ๐colorFrom: bluecolorTo: greensdk: dockerpinned: false---# mbok_devPublic gateway with Supabase authentication that dynamically loads the private ver20 application from `DLPO/habadashi` Space.## Features- Supabase email/password authentication- Cookie-based session management- Dynamic loading of private application code (source code not exposed in public repo)- Role-based access control via profiles table## Environment Variables (Set in HF Space Secrets)- `SUPABASE_URL`: Your Supabase project URL- `SUPABASE_KEY`: Your Supabase anon/service key- `HF_TOKEN`: Hugging Face token with access to private `DLPO/habadashi` Space- `OPENAI_KEY`: OpenAI API key (required by ver20)- `CLIENTPOOL`: Client pool configuration (required by ver20)## Architecture1. User visits public Space2. Bootstrap downloads ver20 from private `DLPO/habadashi` Space3. User logs in with Supabase credentials4. On successful login, ver20 Gradio app is mounted at `/app/`5. User profile and organization info loaded from `profiles` table## Startup Phase LoggingThe application logs structured startup phases to help diagnose issues. Look for these phase markers in the logs:### Expected Startup Sequence1. `[STARTUP_META]` - Environment and configuration info2. `[PHASE] bootstrap_start` - Begin downloading private app3. `[PHASE] bootstrap_end success=true` - Private app downloaded4. `[PHASE] supabase_init_start` - Initialize Supabase client5. `[PHASE] supabase_init_end success=true` - Supabase ready6. `[PHASE] fastapi_init_start/end` - FastAPI app created7. `[PHASE] create_ui_start/end` - Login UI created8. `[PHASE] import_ver20_start` - Import ver20 app9. `[PHASE] import_ver20_end success=true` - Ver20 loaded10. `[PHASE] mount_login_start/end` - Login UI mounted11. `[PHASE] mount_app_start/end` - Ver20 app mounted12. `[STARTUP_COMPLETE]` - All phases complete### Health Check EndpointOnce started, check the health endpoint:```bashcurl https://DLPO-mbok-dev.hf.space/healthz```Expected response:```json{"ok": true,"ver20_loaded": true,"private_app_dir": "./private_app"}```### Debugging Startup FailuresIf the Space fails to start or restarts repeatedly:1. **Check the last phase reached** in logs2. **Look for `[ERROR]` and `[TRACEBACK]` markers** after the last phase3. **Common failure points:**- `bootstrap_end success=false` - HF_TOKEN missing or invalid- `supabase_init_end success=false` - SUPABASE_URL/KEY missing- `import_ver20_end success=false` - Ver20 app.py structure issue- No phases after `mount_app_end` - Port binding or health check issue### Request LoggingAll HTTP requests are logged with:- `[REQUEST]` - Incoming request (method, path)- `[RESPONSE]` - Response status and durationExample:```[REQUEST] method=GET path=/[RESPONSE] method=GET path=/ status=307 duration=0.015s```
12345619 unmodified lines26272829303132521 unmodified lines554555556557558559560#!/usr/bin/env python3"""Habadashi Login Gateway - Main entry pointPublic Space that loads private ver20 app dynamically"""19 unmodified lines# --- Startup Meta Info ---print("=" * 80)print("๐ Starting Habadashi Login Gateway")print("=" * 80)print(f"[STARTUP_META] Python version: {sys.version}")print(f"[STARTUP_META] CWD: {os.getcwd()}")521 unmodified linesprint("[PHASE] mount_app_end path=/app protected=true ver20=false fallback=true")print("=" * 80)print("๐ Habadashi Login Gateway Ready!")print("=" * 80)print(f"[STARTUP_COMPLETE] All phases completed successfully")print(f"[STARTUP_COMPLETE] Access URLs:")12345619 unmodified lines26272829303132521 unmodified lines554555556557558559560#!/usr/bin/env python3"""mbok_dev - Main entry pointPublic Space that loads private ver20 app dynamically"""19 unmodified lines# --- Startup Meta Info ---print("=" * 80)print("๐ Starting mbok_dev")print("=" * 80)print(f"[STARTUP_META] Python version: {sys.version}")print(f"[STARTUP_META] CWD: {os.getcwd()}")521 unmodified linesprint("[PHASE] mount_app_end path=/app protected=true ver20=false fallback=true")print("=" * 80)print("๐ mbok_dev Ready!")print("=" * 80)print(f"[STARTUP_COMPLETE] All phases completed successfully")print(f"[STARTUP_COMPLETE] Access URLs:")
1234567891011128 unmodified lines212223242526272829303132333435#!/usr/bin/env python3"""Bootstrap module - Downloads ver20 from private DLPO/habadashi Space"""import osfrom pathlib import Pathfrom huggingface_hub import snapshot_downloaddef get_hf_token():"""Get HF_TOKEN from environment variable"""token = os.environ.get("HF_TOKEN")8 unmodified linesdef download_private_app(force_download: bool = False):"""Download ver20 application from private DLPO/habadashi SpaceArgs:force_download: If True, re-download even if already cachedReturns:Path: Local directory containing downloaded ver20 files"""repo_id = "DLPO/habadashi"repo_type = "space"local_dir = Path("./private_app")1234567891011121314151617181920218 unmodified lines303132333435363738394041424344454647#!/usr/bin/env python3"""Bootstrap module - Downloads ver20 from private Space.mbok_dev / mbok-dev โ DLPO/habadashi_devmbok (ใใฎไป) โ DLPO/habadashi"""import osfrom pathlib import Pathfrom huggingface_hub import snapshot_downloaddef _resolve_repo_id() -> str:"""SPACE_ID ็ฐๅขๅคๆฐใใๅ็ งๅ private Space ใฎ repo_id ใๆฑบๅฎใใใ"""space_id = os.environ.get("SPACE_ID", "").lower()if "mbok_dev" in space_id or "mbok-dev" in space_id:return "DLPO/habadashi_dev"return "DLPO/habadashi"def get_hf_token():"""Get HF_TOKEN from environment variable"""token = os.environ.get("HF_TOKEN")8 unmodified linesdef download_private_app(force_download: bool = False):"""Download ver20 application from private Space.ๅ็ งๅ ใฏ SPACE_ID ็ฐๅขๅคๆฐใงๆฑบๅฎ:mbok_dev / mbok-dev โ DLPO/habadashi_devmbok (ใใฎไป) โ DLPO/habadashiArgs:force_download: If True, re-download even if already cachedReturns:Path: Local directory containing downloaded ver20 files"""repo_id = _resolve_repo_id()repo_type = "space"local_dir = Path("./private_app")
README.md+95-95
app.py+3-3
bootstrap.py+17-5