diff --git a/SYM-Helper/Base.lproj/Main.storyboard b/SYM-Helper/Base.lproj/Main.storyboard index bf16555..88db1ef 100644 --- a/SYM-Helper/Base.lproj/Main.storyboard +++ b/SYM-Helper/Base.lproj/Main.storyboard @@ -1827,7 +1827,7 @@ DQ - + @@ -1835,7 +1835,7 @@ DQ - + @@ -1862,18 +1862,6 @@ DQ - - - - - - - - - - - - @@ -1918,20 +1906,20 @@ DQ - - + + - - + + - + @@ -1940,8 +1928,8 @@ DQ - - + + @@ -1958,12 +1946,6 @@ DQ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + - + - + + + + + - + + - @@ -2210,6 +2251,8 @@ DQ + + @@ -2236,7 +2279,7 @@ DQ - + @@ -2270,7 +2313,7 @@ DQ - + diff --git a/SYM-Helper/Credentials.swift b/SYM-Helper/Credentials.swift index b55582a..61e2aeb 100644 --- a/SYM-Helper/Credentials.swift +++ b/SYM-Helper/Credentials.swift @@ -94,10 +94,7 @@ class Credentials { var keychainResult = [String:String]() var theService = service - -// if account != "" { -// theService = account + "-" + theService -// } + // print("[credentials] JamfProServer.sourceApiClient: \(JamfProServer.sourceUseApiClient)") if useApiClient == 1 { diff --git a/SYM-Helper/SYMScript.swift b/SYM-Helper/SYMScript.swift index f6c66e8..74f7eec 100644 --- a/SYM-Helper/SYMScript.swift +++ b/SYM-Helper/SYMScript.swift @@ -24,20 +24,17 @@ class SYMScript: NSObject, URLSessionDelegate { session.finishTasksAndInvalidate() if let httpResponse = response as? HTTPURLResponse { if httpSuccess.contains(httpResponse.statusCode) { - print("[SYMScript] statusCode: \(httpResponse.statusCode)") + print("[SYMScript] get script statusCode: \(httpResponse.statusCode)") if let _ = String(data: data!, encoding: .utf8) { responseData = String(data: data!, encoding: .utf8)! -// writeToLog.message(stringOfText: "[CreateEndpoints] \n\nfull response from create:\n\(responseData)") } // print("[SYMScript] done fetching script") // print("[SYMScript] script: \(responseData)") - // print("getScript: \(symScript)") (.|\n|\r) - // if let versionLineRange = responseData.range(of:"# Version [0-9](.*?)[0-9],(.*?)\\)", options: .regularExpression) { +// print("getScript: \(responseData)") //(.|\n|\r) + if let versionLineRange = responseData.range(of:"scriptVersion=\"[0-9](.*?)\"", options: .regularExpression) { -// if let versionLineRange = responseData.range(of:"# Version [0-9](.|[0-9]|\\.).[0-9](.|[0-9]|\\.).[0-9](.|[0-9]|\\,)", options: .regularExpression) { let versionLine = responseData[versionLineRange] -// let versionString = versionLine.replacing("# Version ", with: "").dropLast() let versionString = versionLine.replacing("scriptVersion=\"", with: "").dropLast() // print("[SYMScript.get] scriptVersion: \(String(describing: versionString))") scriptVersion = toTuple(versionString: String(versionString)) diff --git a/SYM-Helper/SettingsVC.swift b/SYM-Helper/SettingsVC.swift index d12b7f1..01ad3a6 100644 --- a/SYM-Helper/SettingsVC.swift +++ b/SYM-Helper/SettingsVC.swift @@ -67,13 +67,15 @@ class SettingsVC: NSViewController, NSTextFieldDelegate, NSTextViewDelegate, Sen @IBOutlet weak var pfrn_Switch: NSSwitch! @IBOutlet weak var prn_Switch: NSSwitch! @IBOutlet weak var pfe_Switch: NSSwitch! - @IBOutlet weak var pfp_Switch: NSSwitch! + @IBOutlet weak var pe_Switch: NSSwitch! @IBOutlet weak var pfcn_Switch: NSSwitch! + @IBOutlet weak var pcn_Switch: NSSwitch! @IBOutlet weak var pfat_Switch: NSSwitch! @IBOutlet weak var disableAssetTagRegex_Button: NSButton! @IBOutlet weak var pfr_Switch: NSSwitch! @IBOutlet weak var pfb_Switch: NSSwitch! @IBOutlet weak var pfd_Switch: NSSwitch! + @IBOutlet weak var pfp_Switch: NSSwitch! @IBOutlet weak var pfc_Switch: NSSwitch! @IBOutlet weak var mip_Switch: NSSwitch! @@ -221,9 +223,11 @@ class SettingsVC: NSViewController, NSTextFieldDelegate, NSTextViewDelegate, Sen promptForDict["promptForUsername"] = pfu_Switch.state.rawValue promptForDict["prefillUsername"] = pu_Switch.state.rawValue promptForDict["promptForComputerName"] = pfcn_Switch.state.rawValue + promptForDict["prefillComputerName"] = pcn_Switch.state.rawValue promptForDict["promptForRealName"] = pfrn_Switch.state.rawValue promptForDict["prefillRealname"] = prn_Switch.state.rawValue promptForDict["promptForEmail"] = pfe_Switch.state.rawValue + promptForDict["prefillEmail"] = pe_Switch.state.rawValue promptForDict["promptForPosition"] = pfp_Switch.state.rawValue promptForDict["promptForAssetTag"] = pfat_Switch.state.rawValue promptForDict["disableAssetTagRegex"] = disableAssetTagRegex_Button.state.rawValue @@ -399,12 +403,14 @@ class SettingsVC: NSViewController, NSTextFieldDelegate, NSTextViewDelegate, Sen // prompt for if (Settings.shared.dict["promptFor"] as? [String:Any]) == nil { - pfu_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForUsername")) + pfu_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForUsername")) pu_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "prefillUsername")) pfcn_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForComputerName")) + pcn_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "prefillComputerName")) pfrn_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForRealName")) prn_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "prefillRealname")) pfe_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForEmail")) + pe_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "prefillEmail")) pfp_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForPosition")) pfat_Switch.state = NSControl.StateValue(rawValue: onOff(whichButton: "promptForAssetTag")) disableAssetTagRegex_Button.state = .off @@ -420,9 +426,11 @@ class SettingsVC: NSViewController, NSTextFieldDelegate, NSTextViewDelegate, Sen pfu_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForUsername"] as? Int ?? 1) pu_Switch.state = NSControl.StateValue(rawValue: promptForDict["prefillUsername"] as? Int ?? 1) pfcn_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForComputerName"] as? Int ?? 1) + pcn_Switch.state = NSControl.StateValue(rawValue: promptForDict["prefillComputerName"] as? Int ?? 1) pfrn_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForRealName"] as? Int ?? 1) prn_Switch.state = NSControl.StateValue(rawValue: promptForDict["prefillRealname"] as? Int ?? 1) pfe_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForEmail"] as? Int ?? 1) + pe_Switch.state = NSControl.StateValue(rawValue: promptForDict["prefillEmail"] as? Int ?? 1) pfp_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForPosition"] as? Int ?? 1) pfat_Switch.state = NSControl.StateValue(rawValue: promptForDict["promptForAssetTag"] as? Int ?? 1) disableAssetTagRegex_Button.state = NSControl.StateValue(rawValue: promptForDict["disableAssetTagRegex"] as? Int ?? 1) diff --git a/SYM-Helper/ViewController.swift b/SYM-Helper/ViewController.swift index 48275be..3f509a1 100644 --- a/SYM-Helper/ViewController.swift +++ b/SYM-Helper/ViewController.swift @@ -764,8 +764,10 @@ class ViewController: NSViewController, NSTextFieldDelegate, URLSessionDelegate, setPrompt(whichPrompt: "promptForRealName") setPrompt(whichPrompt: "prefillRealname") setPrompt(whichPrompt: "promptForEmail") + setPrompt(whichPrompt: "prefillEmail") setPrompt(whichPrompt: "promptForPosition") setPrompt(whichPrompt: "promptForComputerName") + setPrompt(whichPrompt: "prefillComputerName") setPrompt(whichPrompt: "promptForAssetTag") setPrompt(whichPrompt: "disableAssetTagRegex") @@ -1109,7 +1111,7 @@ class ViewController: NSViewController, NSTextFieldDelegate, URLSessionDelegate, writeToLog.message(stringOfText: "convert prompt for... settings to new format") var promptForDict = [String:Any]() - for whichPrompt in ["promptForUsername", "prefillUsername", "promptForRealName", "prefillRealname", "promptForEmail", "promptForPosition", "promptForComputerName", "promptForAssetTag", "promptForRoom", "promptForBuilding", "promptForDepartment", "promptForConfiguration", "moveableInProduction"] { + for whichPrompt in ["promptForUsername", "prefillUsername", "promptForRealName", "prefillRealname", "promptForEmail", "prefillEmail", "promptForPosition", "promptForComputerName", "prefillComputerName", "promptForAssetTag", "promptForRoom", "promptForBuilding", "promptForDepartment", "promptForConfiguration", "moveableInProduction"] { if Settings.shared.dict["\(whichPrompt)"] != nil { promptForDict["\(whichPrompt)"] = Settings.shared.dict["\(whichPrompt)"] as Any Settings.shared.dict["\(whichPrompt)"] = nil