Add complete WebRTC peer-to-peer file transfer functionality: Backend changes: - Add WebRTC signaling events to Socket.IO (offer, answer, ICE candidates) - Implement authorization checks for match participants - Add signaling relay between matched users Frontend changes: - Create useWebRTC hook for RTCPeerConnection management - Implement RTCDataChannel with 16KB chunking for large files - Add real-time progress monitoring for sender and receiver - Implement automatic file download on receiver side - Add connection state tracking and error handling - Integrate WebRTC with MatchChatPage (replace mockup) Configuration: - Add Vite allowed hosts configuration via VITE_ALLOWED_HOSTS env var - Support comma-separated host list or 'all' for development - Add .env.example with configuration examples - Update docker-compose.yml with default allowed hosts Documentation: - Add comprehensive WebRTC testing guide with troubleshooting - Add quick test checklist for manual testing - Document WebRTC flow, requirements, and success criteria Features: - End-to-end encrypted P2P transfer (DTLS) - 16KB chunk size optimized for DataChannel - Buffer management to prevent overflow - Automatic connection establishment with 30s timeout - Support for files of any size - Real-time progress tracking - Clean connection lifecycle management
37 lines
719 B
JavaScript
37 lines
719 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// Parse allowed hosts from environment variable
|
|
const getAllowedHosts = () => {
|
|
const hosts = process.env.VITE_ALLOWED_HOSTS;
|
|
|
|
// If set to 'all', allow all hosts
|
|
if (hosts === 'all') {
|
|
return 'all';
|
|
}
|
|
|
|
// If set, parse comma-separated list
|
|
if (hosts) {
|
|
return hosts.split(',').map(h => h.trim());
|
|
}
|
|
|
|
// Default: localhost only
|
|
return ['localhost'];
|
|
};
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
allowedHosts: getAllowedHosts(),
|
|
watch: {
|
|
usePolling: true,
|
|
},
|
|
hmr: {
|
|
clientPort: 8080,
|
|
},
|
|
},
|
|
})
|