Restore EzDent application login over LAN
This commit is contained in:
1 parent
0aad4f27eb
commit
96fb58fa4e
4 files changed
+75
-10
No files matched your search
@@ -129,7 +129,7 @@ final class LocalServer {
|
||||
if lower.starts(with: ["api", "v1"]) || apiPrefix == 3 {
|
||||
let route = Array(lower.dropFirst(apiPrefix))
|
||||
if webConsole.handles(route, method: method) {
|
||||
guard localConsole else {
|
||||
guard localConsole || webConsole.allowsNetworkAccess(route, method: method) else {
|
||||
send(["error": "Web Console is local only"], status: "403 Forbidden", on: connection)
|
||||
return
|
||||
}
|
||||
@@ -217,8 +217,9 @@ final class LocalServer {
|
||||
|
||||
private static func requestHost(_ authority: String) -> String? {
|
||||
let parts = authority.split(separator: ":", omittingEmptySubsequences: false)
|
||||
guard let name = parts.first?.lowercased(),
|
||||
name == "localhost" || IPv4Address(name) != nil,
|
||||
guard let name = parts.first?.lowercased(), name.utf8.count <= 253,
|
||||
name.range(of: #"\A[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?\z"#,
|
||||
options: .regularExpression) != nil,
|
||||
parts.count == 1 || (parts.count == 2 && parts[1].utf8.count <= 5 &&
|
||||
parts[1].utf8.allSatisfy({ (48...57).contains($0) }) &&
|
||||
UInt16(parts[1]).map({ $0 > 0 }) == true) else { return nil }
|
||||
|
||||
Reference in new issue
Block a user