Settings: Tweaks for Catalyst
This commit is contained in:
@@ -68,7 +68,10 @@ class Settings
|
||||
public var redirectRules: [String: String] = [:]
|
||||
|
||||
func redirectRule(for url: URL) -> URL? {
|
||||
if var components = URLComponents(url: url, resolvingAgainstBaseURL: false), let host = url.host {
|
||||
if var components = URLComponents(url: url, resolvingAgainstBaseURL: false), var host = url.host {
|
||||
// Remove "www." if necessary.
|
||||
host = host.replacingOccurrences(of: "www.", with: "")
|
||||
|
||||
if let alternateHost = redirectRules[host] {
|
||||
components.host = alternateHost
|
||||
return components.url
|
||||
|
||||
Reference in New Issue
Block a user