Module: Browserctl::Policy
- Defined in:
- lib/browserctl/policy.rb
Class Method Summary collapse
-
.allowed_navigation?(url) ⇒ Boolean
Returns true if the URL is permitted by the domain policy.
Class Method Details
.allowed_navigation?(url) ⇒ Boolean
Returns true if the URL is permitted by the domain policy. When BROWSERCTL_ALLOWED_DOMAINS is unset, all URLs are allowed.
11 12 13 14 15 16 17 18 |
# File 'lib/browserctl/policy.rb', line 11 def self.(url) domains = allowed_domains return true if domains.empty? host_matches?(URI.parse(url).host, domains) rescue URI::InvalidURIError false end |