Update Extension

This commit is contained in:
Hariharan Mudaliar 2026-03-19 15:10:45 +05:30
commit 0c5b11ca91
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E

View file

@ -373,6 +373,9 @@ struct ExtensionWebContentView: NSViewRepresentable {
return true
}
if (scheme == "http" || scheme == "https") {
if allowsRemoteRequests() {
return true
}
guard descriptor.allowLocalhostRequests else {
return false
}
@ -381,6 +384,15 @@ struct ExtensionWebContentView: NSViewRepresentable {
}
return false
}
private func allowsRemoteRequests() -> Bool {
guard let data = try? JSONEncoder().encode(descriptor),
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let value = json["allowRemoteRequests"] as? Bool else {
return false
}
return value
}
}
}