Skip to content

Commit

Permalink
working on special pages for catalina
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed May 4, 2023
1 parent f94fc14 commit 34c9240
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ extension SpecialPagesUserScript: WKScriptMessageHandlerWithReply {
// MARK: - Fallback for macOS 10.15
extension SpecialPagesUserScript: WKScriptMessageHandler {
public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
// insecure messaging not required in special pages
let action = broker.messageHandlerFor(message);

// we only accept messages where we can encrypt the response
guard case .respondEncrypted(_, _, let params) = action else {
return
}

do {
try broker.execute(action: action, original: message) { [weak broker] json in
broker?.encryptMessageResponse(response: json, params: params, message: message)
}
} catch let error {
// there's no way of communicating this
}
}
}

0 comments on commit 34c9240

Please sign in to comment.