@@ -54,20 +54,45 @@ async function getGoogleAccessToken(userId: string, req?: Request): Promise<stri
5454 }
5555}
5656
57+ // Helper to convert simple Markdown to HTML for Google Calendar
58+ function markdownToHtml ( md : string ) : string {
59+ if ( ! md ) return '' ;
60+ return md
61+ . replace ( / & / g, '&' )
62+ . replace ( / < / g, '<' )
63+ . replace ( / > / g, '>' )
64+ . replace ( / ^ # # # ( .* $ ) / gim, '<h3>$1</h3>' )
65+ . replace ( / ^ # # ( .* $ ) / gim, '<h2>$1</h2>' )
66+ . replace ( / ^ # ( .* $ ) / gim, '<h1>$1</h1>' )
67+ . replace ( / \* \* \* ( .* ?) \* \* \* / g, '<strong><em>$1</em></strong>' )
68+ . replace ( / \* \* ( .* ?) \* \* / g, '<strong>$1</strong>' )
69+ . replace ( / \* ( .* ?) \* / g, '<em>$1</em>' )
70+ . replace ( / _ _ ( .* ?) _ _ / g, '<strong>$1</strong>' )
71+ . replace ( / _ ( .* ?) _ / g, '<em>$1</em>' )
72+ . replace ( / ` ( .* ?) ` / g, '<code>$1</code>' )
73+ . replace ( / ^ \> ( .* $ ) / gim, '<blockquote>$1</blockquote>' )
74+ . replace ( / \[ ( .* ?) \] \( ( .* ?) \) / g, '<a href="$2">$1</a>' )
75+ . replace ( / \n / g, '<br />' ) ;
76+ }
77+
5778// Helper: Sync Event to Google Calendar (Create or Update)
5879async function syncGoogleCalendarEvent (
5980 userId : string ,
60- meeting : { title : string ; roomName : string ; startTime : Date ; endTime : Date ; recurrence ?: string | null ; guestEmails ?: string [ ] ; moderatorEmails ?: string [ ] } ,
81+ meeting : { title : string ; description ?: string | null ; roomName : string ; startTime : Date ; endTime : Date ; recurrence ?: string | null ; guestEmails ?: string [ ] ; moderatorEmails ?: string [ ] } ,
6182 existingEventId ?: string | null ,
6283 req ?: Request
6384) : Promise < string | null > {
6485 const host = req ?. headers . host || 'localhost:8780' ;
6586 const accessToken = await getGoogleAccessToken ( userId , req ) ;
6687 if ( ! accessToken ) return null ;
6788
89+ const joinLinkHtml = `<p><strong>Join LoungeMesh Spatial Meet:</strong> <a href="http://${ host } /session/${ meeting . roomName } ">http://${ host } /session/${ meeting . roomName } </a></p>` ;
90+ const descHtml = meeting . description ? markdownToHtml ( meeting . description ) : '' ;
91+ const finalDescription = descHtml ? `${ descHtml } <br /><br />${ joinLinkHtml } ` : joinLinkHtml ;
92+
6893 const eventPayload : any = {
6994 summary : meeting . title ,
70- description : `Join LoungeMesh Spatial Meet: http:// ${ host } /session/ ${ meeting . roomName } ` ,
95+ description : finalDescription ,
7196 start : {
7297 dateTime : meeting . startTime . toISOString ( ) ,
7398 timeZone : 'UTC' ,
@@ -156,7 +181,8 @@ export async function createMeeting(req: Request, res: Response) {
156181 lobbyEnabled,
157182 stagePromotionEnabled,
158183 allowParticipantRecording,
159- roomDefaults
184+ roomDefaults,
185+ description
160186 } = req . body ;
161187
162188 if ( ! title || ! roomName ) {
@@ -185,6 +211,7 @@ export async function createMeeting(req: Request, res: Response) {
185211 startTime : start ,
186212 endTime : end ,
187213 recurrence : recurrence || 'NONE' ,
214+ description : description || null ,
188215 guestEmails : guests ,
189216 moderatorEmails : moderators ,
190217 hostId,
@@ -206,6 +233,7 @@ export async function createMeeting(req: Request, res: Response) {
206233 if ( isScheduled && start && end && syncGoogleCal ) {
207234 const eventId = await syncGoogleCalendarEvent ( hostId , {
208235 title,
236+ description : description || null ,
209237 roomName,
210238 startTime : start ,
211239 endTime : end ,
@@ -304,7 +332,8 @@ export async function updateMeeting(req: Request, res: Response) {
304332 stagePromotionEnabled,
305333 allowParticipantRecording,
306334 roomDefaults,
307- syncGoogleCal
335+ syncGoogleCal,
336+ description
308337 } = req . body ;
309338
310339 try {
@@ -346,6 +375,7 @@ export async function updateMeeting(req: Request, res: Response) {
346375 startTime : start ,
347376 endTime : end ,
348377 recurrence : rec ,
378+ description : description !== undefined ? description : meeting . description ,
349379 guestEmails : guests ,
350380 moderatorEmails : moderators ,
351381 configs : {
@@ -383,6 +413,7 @@ export async function updateMeeting(req: Request, res: Response) {
383413 meeting . hostId ,
384414 {
385415 title : updated . title ,
416+ description : updated . description ,
386417 roomName : updated . roomName ,
387418 startTime : start ,
388419 endTime : end ,
0 commit comments