aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/Server.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-01-03 23:55:39 -0800
committerDustin Mierau <dustin@mierau.me>2024-01-03 23:55:39 -0800
commitcc6e0e35cf6e662ffc3ad24e2510265caa5cf52a (patch)
tree908b99f7995edf9dc911209be656fb731c47c5ad /Hotline/Models/Server.swift
parent2286040715ff8c08c4114c60e81f087f92d53800 (diff)
Server windows restore with app session now. Implemented new login view so you can connect to specific IP servers no listed by tracker, login/pass supported (I think?), and a nicer connect progress display.
Diffstat (limited to 'Hotline/Models/Server.swift')
-rw-r--r--Hotline/Models/Server.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/Hotline/Models/Server.swift b/Hotline/Models/Server.swift
index da4f01f..62c6867 100644
--- a/Hotline/Models/Server.swift
+++ b/Hotline/Models/Server.swift
@@ -14,6 +14,13 @@ struct Server: Codable {
self.port = port
self.users = users
}
+
+ static func parseServerAddressAndPort(_ address: String) -> (String, Int) {
+ let url = URL(string: "hotline://\(address)")
+ let port = url?.port ?? HotlinePorts.DefaultServerPort
+ let host = url?.host(percentEncoded: false) ?? address
+ return (host, port)
+ }
}
extension Server: Identifiable {