diff --git a/docker-compose.demo.yml b/docker-compose.demo.yml index c08cbb2..00291ba 100644 --- a/docker-compose.demo.yml +++ b/docker-compose.demo.yml @@ -1,27 +1,27 @@ services: - meshchatx-demo: - build: - context: . - dockerfile: Dockerfile.demo - image: ${MESHCHAT_DEMO_IMAGE:-reticulum-meshchatx-demo:local} - container_name: reticulum-meshchatx-demo - restart: unless-stopped - - # Security Hardening - security_opt: - - no-new-privileges:true - read_only: true - tmpfs: - - /tmp:mode=1777 - - /var/cache/nginx:mode=1777 - - /var/run:mode=1777 - cap_drop: - - ALL - - # Resource Limits - deploy: - resources: - limits: - memory: 128M - reservations: - memory: 64M + meshchatx-demo: + build: + context: . + dockerfile: Dockerfile.demo + image: ${MESHCHAT_DEMO_IMAGE:-reticulum-meshchatx-demo:local} + container_name: reticulum-meshchatx-demo + restart: unless-stopped + + # Security Hardening + security_opt: + - no-new-privileges:true + read_only: true + tmpfs: + - /tmp:mode=1777 + - /var/cache/nginx:mode=1777 + - /var/run:mode=1777 + cap_drop: + - ALL + + # Resource Limits + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 64M diff --git a/nginx.demo.conf b/nginx.demo.conf index 76c8c52..f4c98ad 100644 --- a/nginx.demo.conf +++ b/nginx.demo.conf @@ -93,7 +93,53 @@ server { } location /api/v1/telephone/status { - return 200 '{"active_call": null}'; + set $mock_call $arg_mock_call; + if ($mock_call = "true") { + return 200 '{"enabled": true, "is_busy": false, "call_status": "ringing", "active_call": {"hash": "call123", "status": "ringing", "is_incoming": true, "is_outgoing": false, "remote_identity_hash": "8b5cf6", "remote_identity_name": "Alice", "audio_profile_id": 0, "tx_packets": 0, "rx_packets": 0, "tx_bytes": 0, "rx_bytes": 0, "is_mic_muted": false, "is_speaker_muted": false, "is_voicemail": false}, "is_mic_muted": false, "is_speaker_muted": false, "voicemail": {"is_recording": false, "unread_count": 0}}'; + add_header Content-Type application/json; + } + return 200 '{"enabled": true, "is_busy": false, "call_status": "idle", "active_call": null, "is_mic_muted": false, "is_speaker_muted": false, "voicemail": {"is_recording": false, "unread_count": 0}}'; + add_header Content-Type application/json; + } + + location /api/v1/telephone/mock-incoming-call { + return 200 '{"message": "Mock incoming call triggered. Poll /api/v1/telephone/status?mock_call=true to see the call"}'; + add_header Content-Type application/json; + } + + location /api/v1/telephone/history { + return 200 '{"call_history": [ + {"id": 1, "remote_identity_hash": "8b5cf6", "remote_identity_name": "Alice", "is_incoming": 1, "status": "completed", "duration_seconds": 125, "timestamp": 1735732800.0, "created_at": "2026-01-01T12:00:00Z"}, + {"id": 2, "remote_identity_hash": "3b82f6", "remote_identity_name": "Bob", "is_incoming": 0, "status": "completed", "duration_seconds": 45, "timestamp": 1735731000.0, "created_at": "2026-01-01T11:30:00Z"}, + {"id": 3, "remote_identity_hash": "10b981", "remote_identity_name": "Regional Hub", "is_incoming": 1, "status": "missed", "duration_seconds": 0, "timestamp": 1735729200.0, "created_at": "2026-01-01T11:00:00Z"}, + {"id": 4, "remote_identity_hash": "ef4444", "remote_identity_name": "Echo Bot", "is_incoming": 0, "status": "failed", "duration_seconds": 0, "timestamp": 1735727400.0, "created_at": "2026-01-01T10:30:00Z"}, + {"id": 5, "remote_identity_hash": "a1b2c3", "remote_identity_name": "Charlie", "is_incoming": 1, "status": "completed", "duration_seconds": 320, "timestamp": 1735725600.0, "created_at": "2026-01-01T10:00:00Z"} + ]}'; + add_header Content-Type application/json; + } + + location /api/v1/favourites { + set $aspect_filter $arg_aspect; + if ($aspect_filter = "lxmf.delivery") { + return 200 '{"favourites": [ + {"id": 1, "destination_hash": "8b5cf6", "display_name": "Alice", "aspect": "lxmf.delivery", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"}, + {"id": 2, "destination_hash": "3b82f6", "display_name": "Bob", "aspect": "lxmf.delivery", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"} + ]}'; + add_header Content-Type application/json; + } + if ($aspect_filter = "nomadnetwork.node") { + return 200 '{"favourites": [ + {"id": 3, "destination_hash": "10b981", "display_name": "Regional Hub", "aspect": "nomadnetwork.node", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"}, + {"id": 4, "destination_hash": "f68b5c", "display_name": "Nomad Portal", "aspect": "nomadnetwork.node", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"} + ]}'; + add_header Content-Type application/json; + } + return 200 '{"favourites": [ + {"id": 1, "destination_hash": "8b5cf6", "display_name": "Alice", "aspect": "lxmf.delivery", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"}, + {"id": 2, "destination_hash": "3b82f6", "display_name": "Bob", "aspect": "lxmf.delivery", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"}, + {"id": 3, "destination_hash": "10b981", "display_name": "Regional Hub", "aspect": "nomadnetwork.node", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"}, + {"id": 4, "destination_hash": "f68b5c", "display_name": "Nomad Portal", "aspect": "nomadnetwork.node", "created_at": "2026-01-01T08:00:00Z", "updated_at": "2026-01-01T08:00:00Z"} + ]}'; add_header Content-Type application/json; }