mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update Extension
This commit is contained in:
parent
db38661da8
commit
0c5b11ca91
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue