webapp/src/app.config.ts
padreug 9ed674d0f3 Adds expense tracking module
Adds a new module for tracking user expenses.

The module includes:
- Configuration settings for the LNbits API endpoint and timeouts.
- An ExpensesAPI service for fetching accounts and submitting expense entries.
- A UI component for adding expenses, including account selection and form input.
- Dependency injection for the ExpensesAPI service.

This allows users to submit expense entries with account selection and reference data, which will be linked to their wallet.
2025-11-07 16:21:59 +01:00

121 lines
No EOL
3.3 KiB
TypeScript

import type { AppConfig } from './core/types'
export const appConfig: AppConfig = {
modules: {
base: {
name: 'base',
enabled: true,
lazy: false,
config: {
nostr: {
relays: JSON.parse(import.meta.env.VITE_NOSTR_RELAYS || '["wss://relay.damus.io", "wss://nos.lol"]')
},
auth: {
sessionTimeout: 24 * 60 * 60 * 1000, // 24 hours
},
pwa: {
autoPrompt: true
},
imageUpload: {
baseUrl: import.meta.env.VITE_PICTRS_BASE_URL || 'https://img.mydomain.com',
maxSizeMB: 10,
acceptedTypes: ['image/jpeg', 'image/png', 'image/webp', 'image/avif', 'image/gif']
}
}
},
'nostr-feed': {
name: 'nostr-feed',
enabled: true,
lazy: false,
config: {
refreshInterval: 30000, // 30 seconds
maxPosts: 100,
adminPubkeys: JSON.parse(import.meta.env.VITE_ADMIN_PUBKEYS || '[]'),
feedTypes: ['announcements', 'general']
}
},
market: {
name: 'market',
enabled: true,
lazy: false,
config: {
defaultCurrency: 'sats',
paymentTimeout: 300000, // 5 minutes
maxOrderHistory: 50,
apiConfig: {
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
}
}
},
chat: {
name: 'chat',
enabled: true,
lazy: false, // Load on startup to register routes
config: {
maxMessages: 500,
autoScroll: true,
showTimestamps: true,
notifications: {
enabled: true,
soundEnabled: false,
wildcardSupport: true
}
}
},
events: {
name: 'events',
enabled: true,
lazy: false,
config: {
apiConfig: {
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000',
apiKey: import.meta.env.VITE_API_KEY || ''
},
ticketValidationEndpoint: '/api/tickets/validate',
maxTicketsPerUser: 10
}
},
wallet: {
name: 'wallet',
enabled: true,
lazy: false,
config: {
defaultReceiveAmount: 1000, // 1000 sats
maxReceiveAmount: 1000000, // 1M sats
apiConfig: {
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
},
websocket: {
enabled: import.meta.env.VITE_WEBSOCKET_ENABLED !== 'false', // Can be disabled via env var
reconnectDelay: 2000, // 2 seconds (increased from 1s to reduce server load)
maxReconnectAttempts: 3, // Reduced from 5 to avoid overwhelming server
fallbackToPolling: true, // Enable polling fallback when WebSocket fails
pollingInterval: 10000 // 10 seconds for polling updates
}
}
},
expenses: {
name: 'expenses',
enabled: true,
lazy: false,
config: {
apiConfig: {
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000',
timeout: 30000 // 30 seconds for API requests
},
defaultCurrency: 'sats',
maxExpenseAmount: 1000000, // 1M sats
requireDescription: true
}
}
},
features: {
pwa: true,
pushNotifications: true,
electronApp: false,
developmentMode: import.meta.env.DEV
}
}
export default appConfig