Spaces:
Paused
Paused
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca Download web/app/plugins/firebase.client.ts from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/edb5ea459a6e19d91e941f078c1ff1799d310731/web/app/plugins/firebase.client.ts
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@edb5ea459a6e19d91e941f078c1ff1799d310731/web/app/plugins/firebase.client.ts
-
curl -L -o firebase.client.ts https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/edb5ea459a6e19d91e941f078c1ff1799d310731/web/app/plugins/firebase.client.ts
1.49 kB
| import { initializeApp, getApps } from 'firebase/app' | |
| import type { FirebaseApp } from 'firebase/app' | |
| import { getAuth, onAuthStateChanged } from 'firebase/auth' | |
| import { useAuthStore } from '../stores/auth' | |
| export default defineNuxtPlugin(() => { | |
| const config = useRuntimeConfig() | |
| const publicConfig = config.public as Record<string, string> | |
| // Skip initialization if no API key is configured | |
| if (!publicConfig.firebaseApiKey) { | |
| console.warn( | |
| '[firebase] No FIREBASE_API_KEY configured. Auth will not work.', | |
| ) | |
| // Resolve auth readiness so route middleware doesn't hang forever. | |
| useAuthStore().onAuthStateChanged(null) | |
| return | |
| } | |
| const firebaseConfig = { | |
| apiKey: publicConfig.firebaseApiKey, | |
| authDomain: publicConfig.firebaseAuthDomain, | |
| projectId: publicConfig.firebaseProjectId, | |
| storageBucket: publicConfig.firebaseStorageBucket, | |
| messagingSenderId: publicConfig.firebaseMessagingSenderId, | |
| appId: publicConfig.firebaseAppId, | |
| measurementId: publicConfig.firebaseMeasurementId, | |
| } | |
| // Initialise Firebase (only once) | |
| const app: FirebaseApp = | |
| getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0]! | |
| const auth = getAuth(app) | |
| // Listen for auth state changes and update the auth store | |
| const authStore = useAuthStore() | |
| onAuthStateChanged(auth, (user) => { | |
| authStore.onAuthStateChanged(user) | |
| }) | |
| return { | |
| provide: { | |
| firebaseApp: app, | |
| firebaseAuth: auth, | |
| }, | |
| } | |
| }) | |