5a7a6f3ff246ca2c234acccace5e60b6c1161dd0

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Allow plain http server URLs

Diff

 1diff --git a/Sources/japanese/SettingsView.swift b/Sources/japanese/SettingsView.swift
 2index 8087ed2b886ccf5a0f2253e9bdf4e4f181b36ea9..f5ea171fc8f769e2b32fb6594306d2d294878a2a 100644
 3--- a/Sources/japanese/SettingsView.swift
 4+++ b/Sources/japanese/SettingsView.swift
 5@@ -25,7 +25,7 @@ struct SettingsView: View {
 6                 Button("Save settings", action: save)
 7                     .buttonStyle(.borderedProminent)
 8             } footer: {
 9-                Text("The app connects only to HTTPS servers. The token is stored in the device keychain.")
10+                Text("The token is stored in the device keychain.")
11             }
12         }
13         .navigationTitle("Settings")
14diff --git a/Sources/japaneseShared/ServerConfiguration.swift b/Sources/japaneseShared/ServerConfiguration.swift
15index f6a003fd4ba07123a951bf88f064766b36fee44a..5a4a01d5ee6b4e05e05344b3415a331020176723 100644
16--- a/Sources/japaneseShared/ServerConfiguration.swift
17+++ b/Sources/japaneseShared/ServerConfiguration.swift
18@@ -9,7 +9,7 @@ public struct ServerConfiguration: Sendable {
19 
20         guard !trimmedServerURL.isEmpty,
21               let url = URL(string: trimmedServerURL),
22-              url.scheme?.lowercased() == "https",
23+              ["http", "https"].contains(url.scheme?.lowercased()),
24               url.host != nil,
25               url.user == nil,
26               url.password == nil,
27@@ -38,7 +38,7 @@ public enum ConfigurationError: LocalizedError {
28     public var errorDescription: String? {
29         switch self {
30         case .invalidServerURL:
31-            "Enter a valid HTTPS server URL."
32+            "Enter a valid server URL."
33         case .missingToken:
34             "Enter the API token."
35         }