Don't display default port in URL
This commit is contained in:
parent
80fcfd3b91
commit
f59c43afa7
@ -19,10 +19,18 @@ class NavigationManager: NSObject, ObservableObject {
|
||||
|
||||
func changeURL(_ url: URL) {
|
||||
backStack.append(currentURL)
|
||||
currentURL = url
|
||||
currentURL = cannonicalizeURL(url)
|
||||
forwardStack = []
|
||||
}
|
||||
|
||||
private func cannonicalizeURL(_ url: URL) -> URL {
|
||||
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)!
|
||||
if components.scheme == "gemini" && components.port == 1965 {
|
||||
components.port = nil
|
||||
}
|
||||
return components.url!
|
||||
}
|
||||
|
||||
@objc func back() {
|
||||
guard !backStack.isEmpty else { return }
|
||||
forwardStack.insert(currentURL, at: 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user