Procházet zdrojové kódy

Open meetings in Zoom web client

Use /wc/join URL (including pwd when available) so clicking a meeting card joins in the browser.

Made-with: Cursor
huzaifahayat12 před 5 dny
rodič
revize
fee24a5e9e
1 změnil soubory, kde provedl 24 přidání a 1 odebrání
  1. 24 1
      zoom_app/ViewController.swift

+ 24 - 1
zoom_app/ViewController.swift

@@ -686,11 +686,34 @@ class ViewController: NSViewController {
686 686
                 guard let start else { return nil }
687 687
                 let end = meeting.duration.map { start.addingTimeInterval(TimeInterval($0 * 60)) }
688 688
                 let webURL: URL? = {
689
+                    func wcJoinURL(meetingId: Int, pwd: String?) -> URL? {
690
+                        var components = URLComponents()
691
+                        components.scheme = "https"
692
+                        components.host = "zoom.us"
693
+                        components.path = "/wc/join/\(meetingId)"
694
+                        if let pwd, pwd.isEmpty == false {
695
+                            components.queryItems = [URLQueryItem(name: "pwd", value: pwd)]
696
+                        }
697
+                        return components.url
698
+                    }
699
+
689 700
                     if let join = meeting.join_url, let url = URL(string: join), url.scheme != nil {
701
+                        // Prefer the Zoom Web Client join URL so a click joins in the browser.
702
+                        // join_url is often `https://zoom.us/j/<id>?pwd=...`
703
+                        if url.path.contains("/wc/join/") {
704
+                            return url
705
+                        }
706
+                        if let id = meeting.id {
707
+                            let pwd = URLComponents(url: url, resolvingAgainstBaseURL: false)?
708
+                                .queryItems?
709
+                                .first(where: { $0.name == "pwd" })?
710
+                                .value
711
+                            return wcJoinURL(meetingId: id, pwd: pwd)
712
+                        }
690 713
                         return url
691 714
                     }
692 715
                     if let id = meeting.id {
693
-                        return URL(string: "https://zoom.us/j/\(id)")
716
+                        return wcJoinURL(meetingId: id, pwd: nil)
694 717
                     }
695 718
                     return nil
696 719
                 }()