25 lines
472 B
Swift
25 lines
472 B
Swift
|
//
|
||
|
// BrowserHelper.swift
|
||
|
// BrowserCore
|
||
|
//
|
||
|
// Created by Shadowfacts on 9/30/21.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
public struct BrowserHelper {
|
||
|
private init() {}
|
||
|
|
||
|
public static func urlForDisplay(_ url: URL) -> String {
|
||
|
var str = url.host!
|
||
|
if let port = url.port,
|
||
|
url.scheme != "gemini" || port != 1965 {
|
||
|
str += ":\(port)"
|
||
|
}
|
||
|
if url.path != "/" {
|
||
|
str += url.path
|
||
|
}
|
||
|
return str
|
||
|
}
|
||
|
}
|