+
+ // MARK: - URL Event Handler
+
+ func application(_ application: NSApplication, open urls: [URL]) {
+ if (CapturaSettings.shouldAllowURLAutomation) {
+ for url in urls {
+ if let action = CapturaURLDecoder.decodeParams(url: url) {
+ switch action {
+ case let .configure(config):
+ NotificationCenter.default.post(name: .setConfiguration, object: nil, userInfo: [
+ "config": config
+ ])
+ case let .record(config):
+ NotificationCenter.default.post(name: .setCaptureSessionConfiguration, object: nil, userInfo: [
+ "config": config
+ ])
+ NotificationCenter.default.post(name: .startAreaSelection, object: nil, userInfo: nil)
+ }
+ }
+ }
+ } else {
+ let alert = NSAlert()
+ alert.messageText = "URL Automation Prevented"
+ alert.informativeText = "A website or application attempted to record your screen using URL Automation. If you want to allow this, enable it in Preferences."
+ alert.alertStyle = .warning
+ alert.addButton(withTitle: "OK")
+ alert.runModal()
+ }
+ }