diff --git a/TAKTracker.xcodeproj/project.pbxproj b/TAKTracker.xcodeproj/project.pbxproj index 5547792..ad3ef95 100644 --- a/TAKTracker.xcodeproj/project.pbxproj +++ b/TAKTracker.xcodeproj/project.pbxproj @@ -781,7 +781,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = TAKTracker/TAKTracker.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_ASSET_PATHS = "TAKTracker/Preview\\ Content"; DEVELOPMENT_TEAM = 5LZ5HR44P3; ENABLE_PREVIEWS = YES; @@ -820,7 +820,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = TAKTracker/TAKTracker.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 55; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_ASSET_PATHS = "TAKTracker/Preview\\ Content"; DEVELOPMENT_TEAM = 5LZ5HR44P3; ENABLE_PREVIEWS = YES; @@ -857,12 +857,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 53; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 5LZ5HR44P3; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.4; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.flighttactics.TAK-SpikeTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; @@ -879,12 +879,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 53; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 5LZ5HR44P3; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.4; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.flighttactics.TAK-SpikeTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; @@ -899,10 +899,10 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 53; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 5LZ5HR44P3; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.flighttactics.TAK-SpikeUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; @@ -917,10 +917,10 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 53; + CURRENT_PROJECT_VERSION = 57; DEVELOPMENT_TEAM = 5LZ5HR44P3; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.flighttactics.TAK-SpikeUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; diff --git a/TAKTracker/Communications/CSRRequestor.swift b/TAKTracker/Communications/CSRRequestor.swift index 72c65b7..b0a34f0 100644 --- a/TAKTracker/Communications/CSRRequestor.swift +++ b/TAKTracker/Communications/CSRRequestor.swift @@ -43,7 +43,6 @@ class CSRRequestor: NSObject, ObservableObject, URLSessionDelegate { var derEncodedCertificate: [UInt8] = [] var derEncodedPrivateKey: Data = Data() - var csrPort = TAKConstants.DEFAULT_CSR_PORT var tlsConfigPath = TAKConstants.CERT_CONFIG_PATH var csrRequestPath = TAKConstants.certificateSigningPath( clientUid: AppConstants.getClientID(), @@ -84,6 +83,7 @@ class CSRRequestor: NSObject, ObservableObject, URLSessionDelegate { let caConfigMethod = "GET" let csrMethod = "POST" let host = "https://\(SettingsStore.global.takServerUrl)" + let csrPort = SettingsStore.global.takServerCSRPort var caConfigEntries : [String:String] = [:] var orgNameEntry = "" var orgUnitNameEntry = "" @@ -139,7 +139,7 @@ class CSRRequestor: NSObject, ObservableObject, URLSessionDelegate { } // create the request - let csrURL = URL(string: "\(host):\(self.csrPort)\(self.csrRequestPath)")! + let csrURL = URL(string: "\(host):\(csrPort)\(self.csrRequestPath)")! var csrRequest = URLRequest(url: csrURL) csrRequest.httpMethod = csrMethod csrRequest.setValue("text/plain; charset=utf-8", forHTTPHeaderField: "Content-Type") // the request is JSON diff --git a/TAKTracker/Data Models/SettingsStore.swift b/TAKTracker/Data Models/SettingsStore.swift index 9345305..ec364a0 100644 --- a/TAKTracker/Data Models/SettingsStore.swift +++ b/TAKTracker/Data Models/SettingsStore.swift @@ -109,6 +109,12 @@ class SettingsStore: ObservableObject { } } + @Published var takServerCSRPort: String { + didSet { + UserDefaults.standard.set(takServerPort, forKey: "takServerCSRPort") + } + } + @Published var takServerProtocol: String { didSet { UserDefaults.standard.set(takServerProtocol, forKey: "takServerProtocol") @@ -247,7 +253,9 @@ class SettingsStore: ObservableObject { self.takServerUrl = (UserDefaults.standard.object(forKey: "takServerUrl") == nil ? "" : UserDefaults.standard.object(forKey: "takServerUrl") as! String) - self.takServerPort = (UserDefaults.standard.object(forKey: "takServerPort") == nil ? "8089" : UserDefaults.standard.object(forKey: "takServerPort") as! String) + self.takServerPort = (UserDefaults.standard.object(forKey: "takServerPort") == nil ? TAKConstants.DEFAULT_STREAMING_PORT : UserDefaults.standard.object(forKey: "takServerPort") as! String) + + self.takServerCSRPort = (UserDefaults.standard.object(forKey: "takServerCSRPort") == nil ? TAKConstants.DEFAULT_CSR_PORT : UserDefaults.standard.object(forKey: "takServerCSRPort") as! String) self.takServerProtocol = (UserDefaults.standard.object(forKey: "takServerProtocol") == nil ? "ssl" : UserDefaults.standard.object(forKey: "takServerProtocol") as! String) diff --git a/TAKTracker/Screens/SettingsScreens/ConnectionOptions.swift b/TAKTracker/Screens/SettingsScreens/ConnectionOptions.swift index 742b2e1..6176a7e 100644 --- a/TAKTracker/Screens/SettingsScreens/ConnectionOptions.swift +++ b/TAKTracker/Screens/SettingsScreens/ConnectionOptions.swift @@ -19,6 +19,20 @@ struct CertificateEnrollmentParameters: View { var body: some View { List { ServerInformation() + Group { + VStack { + HStack { + Text("CSR Port") + .font(.system(size: 18, weight: .medium)) + .foregroundColor(.secondary) + Spacer() + } + TextField("CSR Port", text: $settingsStore.takServerCSRPort) + .keyboardType(.numberPad) + } + .padding(.top, 20) + } + Group { VStack { HStack {