-
Notifications
You must be signed in to change notification settings - Fork 271
Add support for short Teams meeting URLs in ParseJoinURL #858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
0cf61b5
97381ea
de42f7c
85bafad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,40 +43,55 @@ public static (ChatInfo, MeetingInfo) ParseJoinURL(string joinURL) | |
|
|
||
| var decodedURL = WebUtility.UrlDecode(joinURL); | ||
|
|
||
| //// Long URL format: | ||
| var regex = new Regex("https://teams\\.microsoft\\.com.*/(?<thread>[^/]+)/(?<message>[^/]+)\\?context=(?<context>{.*})"); | ||
| var match = regex.Match(decodedURL); | ||
| if (!match.Success) | ||
| if (match.Success) | ||
| { | ||
| throw new ArgumentException($"Join URL cannot be parsed: {joinURL}", nameof(joinURL)); | ||
| } | ||
| using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(match.Groups["context"].Value))) | ||
| { | ||
| var ctxt = (Meeting)new DataContractJsonSerializer(typeof(Meeting)).ReadObject(stream); | ||
|
|
||
| using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(match.Groups["context"].Value))) | ||
| { | ||
| var ctxt = (Meeting)new DataContractJsonSerializer(typeof(Meeting)).ReadObject(stream); | ||
| if (string.IsNullOrEmpty(ctxt.Tid)) | ||
| { | ||
| throw new ArgumentException("Join URL is invalid: missing Tid", nameof(joinURL)); | ||
| } | ||
|
|
||
| if (string.IsNullOrEmpty(ctxt.Tid)) | ||
| { | ||
| throw new ArgumentException("Join URL is invalid: missing Tid", nameof(joinURL)); | ||
| } | ||
| var chatInfo = new ChatInfo | ||
| { | ||
| ThreadId = match.Groups["thread"].Value, | ||
| MessageId = match.Groups["message"].Value, | ||
| ReplyChainMessageId = ctxt.MessageId, | ||
| }; | ||
|
|
||
| var chatInfo = new ChatInfo | ||
| { | ||
| ThreadId = match.Groups["thread"].Value, | ||
| MessageId = match.Groups["message"].Value, | ||
| ReplyChainMessageId = ctxt.MessageId, | ||
| }; | ||
| var meetingInfo = new OrganizerMeetingInfo | ||
| { | ||
| Organizer = new IdentitySet | ||
| { | ||
| User = new Identity { Id = ctxt.Oid }, | ||
| }, | ||
| }; | ||
| meetingInfo.Organizer.User.SetTenantId(ctxt.Tid); | ||
|
|
||
| return (chatInfo, meetingInfo); | ||
| } | ||
| } | ||
|
|
||
| var meetingInfo = new OrganizerMeetingInfo | ||
| //// Short URL format: https://teams.microsoft.com/meet/<meetingId>?p=<passcode> | ||
| var shortUrlRegex = new Regex("https://teams\\.microsoft\\.com/meet/(?<meetingId>[^?]+)\\?p=(?<passcode>.+)"); | ||
| var shortUrlMatch = shortUrlRegex.Match(decodedURL); | ||
| if (shortUrlMatch.Success) | ||
| { | ||
| var meetingInfo = new JoinMeetingIdMeetingInfo | ||
| { | ||
| Organizer = new IdentitySet | ||
| { | ||
| User = new Identity { Id = ctxt.Oid }, | ||
| }, | ||
| JoinMeetingId = shortUrlMatch.Groups["meetingId"].Value, | ||
| Passcode = shortUrlMatch.Groups["passcode"].Value, | ||
| }; | ||
| meetingInfo.Organizer.User.SetTenantId(ctxt.Tid); | ||
|
|
||
| return (chatInfo, meetingInfo); | ||
| return (new ChatInfo(), meetingInfo); | ||
| } | ||
|
Comment on lines
+85
to
92
|
||
|
|
||
| throw new ArgumentException($"Join URL cannot be parsed: {joinURL}", nameof(joinURL)); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.