Ver código fonte

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 3 meses atrás
pai
commit
fee24a5e9e
1 arquivos alterados com 24 adições e 1 exclusões
  1. 24 1
      zoom_app/ViewController.swift

+ 24 - 1
zoom_app/ViewController.swift

@@ -686,11 +686,34 @@ class ViewController: NSViewController {
                 guard let start else { return nil }
                 let end = meeting.duration.map { start.addingTimeInterval(TimeInterval($0 * 60)) }
                 let webURL: URL? = {
+                    func wcJoinURL(meetingId: Int, pwd: String?) -> URL? {
+                        var components = URLComponents()
+                        components.scheme = "https"
+                        components.host = "zoom.us"
+                        components.path = "/wc/join/\(meetingId)"
+                        if let pwd, pwd.isEmpty == false {
+                            components.queryItems = [URLQueryItem(name: "pwd", value: pwd)]
+                        }
+                        return components.url
+                    }
+
                     if let join = meeting.join_url, let url = URL(string: join), url.scheme != nil {
+                        // Prefer the Zoom Web Client join URL so a click joins in the browser.
+                        // join_url is often `https://zoom.us/j/<id>?pwd=...`
+                        if url.path.contains("/wc/join/") {
+                            return url
+                        }
+                        if let id = meeting.id {
+                            let pwd = URLComponents(url: url, resolvingAgainstBaseURL: false)?
+                                .queryItems?
+                                .first(where: { $0.name == "pwd" })?
+                                .value
+                            return wcJoinURL(meetingId: id, pwd: pwd)
+                        }
                         return url
                     }
                     if let id = meeting.id {
-                        return URL(string: "https://zoom.us/j/\(id)")
+                        return wcJoinURL(meetingId: id, pwd: nil)
                     }
                     return nil
                 }()