|
3 | 3 | * Web Routes Module |
4 | 4 | * ============================================================================= |
5 | 5 | * |
6 | | - * This module contains all API endpoints and web routes for the photo viewer. |
| 6 | + * This module contains all API endpoints for the camera application. |
7 | 7 | * |
8 | 8 | * Routes included: |
| 9 | + * - GET /api/photo-stream - SSE endpoint for real-time photo updates |
| 10 | + * - GET /api/transcription-stream - SSE endpoint for real-time transcriptions |
| 11 | + * - POST /api/play-audio - Play audio to MentraOS glasses |
| 12 | + * - POST /api/speak - Text-to-speech to MentraOS glasses |
| 13 | + * - POST /api/stop-audio - Stop audio playback |
| 14 | + * - GET /api/theme-preference - Get user's theme preference from Simple Storage |
| 15 | + * - POST /api/theme-preference - Set user's theme preference in Simple Storage |
9 | 16 | * - GET /api/latest-photo - Get metadata for the latest photo |
10 | 17 | * - GET /api/photo/:requestId - Get the actual photo image data |
11 | 18 | * - GET /api/photo-base64/:requestId - Get photo as base64 JSON |
12 | | - * - GET /api/photo-stream - SSE endpoint for real-time photo updates |
13 | | - * - GET /webview - Main photo viewer web interface |
| 19 | + * |
| 20 | + * Note: The React frontend is served from the root route by index.ts |
14 | 21 | * |
15 | 22 | * ============================================================================= |
16 | 23 | */ |
17 | 24 |
|
18 | 25 | import { Express, Response } from 'express'; |
19 | | -import { AuthenticatedRequest } from '@mentra/sdk'; |
20 | | -import * as ejs from 'ejs'; |
21 | | -import * as path from 'path'; |
22 | 26 | import { getThemePreference, setThemePreference } from '../modules/simple-storage'; |
23 | 27 |
|
24 | 28 | // Store SSE clients with userId mapping |
@@ -473,26 +477,6 @@ export function setupWebviewRoutes( |
473 | 477 | }); |
474 | 478 | }); |
475 | 479 |
|
476 | | - |
477 | | - // Route 4: Main photo viewer web interface |
478 | | - app.get('/webview', async (req: any, res: any) => { |
479 | | - const userId = (req as AuthenticatedRequest).authUserId; |
480 | | - |
481 | | - if (!userId) { |
482 | | - res.status(401).send(` |
483 | | - <html> |
484 | | - <head><title>Photo Viewer - Not Authenticated</title></head> |
485 | | - <body style="font-family: Arial, sans-serif; text-align: center; padding: 50px;"> |
486 | | - <h1>Please open this page from the MentraOS app</h1> |
487 | | - </body> |
488 | | - </html> |
489 | | - `); |
490 | | - return; |
491 | | - } |
492 | | - |
493 | | - const templatePath = path.join(process.cwd(), 'views', 'photo-viewer.ejs'); |
494 | | - const html = await ejs.renderFile(templatePath, {}); |
495 | | - |
496 | | - res.send(html); |
497 | | - }); |
| 480 | + // Note: The /webview EJS route has been removed. |
| 481 | + // The React frontend is now served from the root route (/) by the SPA fallback in index.ts |
498 | 482 | } |
0 commit comments