web-app/src/modules/base/index.ts
padreug c692664c93 Update app configuration and plugin manager for improved environment variable support
- Modify app configuration to use environment variables for base URL and API key, enhancing flexibility for different environments.
- Refactor plugin installation logic in the PluginManager to ensure proper configuration object structure.
- Update base module initialization to correctly access Nostr relay options from the configuration, improving reliability.
2025-09-05 00:17:11 +02:00

65 lines
No EOL
1.7 KiB
TypeScript

import type { App } from 'vue'
import type { ModulePlugin } from '@/core/types'
import { container, SERVICE_TOKENS } from '@/core/di-container'
import { relayHub } from './nostr/relay-hub'
import { nostrclientHub } from './nostr/nostrclient-hub'
// Import auth services
import { auth } from './auth/auth-service'
// Import PWA services
import { pwaService } from './pwa/pwa-service'
/**
* Base Module Plugin
* Provides core infrastructure: Nostr, Auth, PWA, and UI components
*/
export const baseModule: ModulePlugin = {
name: 'base',
version: '1.0.0',
async install(_app: App, options?: any) {
console.log('🔧 Installing base module...')
// Register core Nostr services
container.provide(SERVICE_TOKENS.RELAY_HUB, relayHub)
container.provide(SERVICE_TOKENS.NOSTR_CLIENT_HUB, nostrclientHub)
// Register auth service
container.provide(SERVICE_TOKENS.AUTH_SERVICE, auth)
// Register PWA service
container.provide('pwaService', pwaService)
// Initialize core services
await relayHub.initialize(options?.config?.nostr?.relays || [])
await auth.initialize()
console.log('✅ Base module installed successfully')
},
async uninstall() {
console.log('🗑️ Uninstalling base module...')
// Cleanup Nostr connections
relayHub.disconnect()
nostrclientHub.disconnect?.()
console.log('✅ Base module uninstalled')
},
services: {
relayHub,
nostrclientHub,
auth,
pwaService
},
// No routes - base module is pure infrastructure
routes: [],
// No UI components at module level - they'll be imported as needed
components: {}
}
export default baseModule