Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Nudge/Preferences/DefaultPreferencesNudge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ struct UserInterfaceVariables {
userInterfaceUpdateElementsJSON?.actionButtonTextUnsupported ??
"Replace Your Device"
}

static var activelyExploitedOutput: String {
userInterfaceUpdateElementsProfile?["activelyExploitedOutput"] as? String ??
userInterfaceUpdateElementsJSON?.activelyExploitedOutput ??
"TorF"
}

static var activelyExploitedText: String {
userInterfaceUpdateElementsProfile?["activelyExploitedText"] as? String ??
userInterfaceUpdateElementsJSON?.activelyExploitedText ??
"Actively Exploited CVEs:"
}

static var applicationTerminatedNotificationImagePath: String {
userInterfaceProfile?["applicationTerminatedNotificationImagePath"] as? String ??
Expand Down
8 changes: 6 additions & 2 deletions Nudge/Preferences/PreferencesStructure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,14 @@ extension UserInterface {

// MARK: - UpdateElement
struct UpdateElement: Codable {
var language, actionButtonText, actionButtonTextUnsupported, applicationTerminatedTitleText, applicationTerminatedBodyText, customDeferralButtonText, customDeferralDropdownText: String?
var language, actionButtonText, actionButtonTextUnsupported, activelyExploitedOutput, activelyExploitedText, applicationTerminatedTitleText, applicationTerminatedBodyText, customDeferralButtonText, customDeferralDropdownText: String?
var informationButtonText, mainContentHeader, mainContentHeaderUnsupported, mainContentNote, mainContentNoteUnsupported: String?
var mainContentSubHeader, mainContentSubHeaderUnsupported, mainContentText, mainContentTextUnsupported, mainHeader, mainHeaderUnsupported: String?
var oneDayDeferralButtonText, oneHourDeferralButtonText, primaryQuitButtonText, screenShotAltText, secondaryQuitButtonText, subHeader, subHeaderUnsupported: String?

enum CodingKeys: String, CodingKey {
case language = "_language"
case actionButtonText, actionButtonTextUnsupported, applicationTerminatedTitleText, applicationTerminatedBodyText, customDeferralButtonText, customDeferralDropdownText, informationButtonText, mainContentHeader, mainContentHeaderUnsupported, mainContentNote, mainContentNoteUnsupported, mainContentSubHeader, mainContentSubHeaderUnsupported, mainContentText, mainContentTextUnsupported, mainHeader, mainHeaderUnsupported, oneDayDeferralButtonText, oneHourDeferralButtonText, primaryQuitButtonText, screenShotAltText, secondaryQuitButtonText, subHeader, subHeaderUnsupported
case actionButtonText, actionButtonTextUnsupported, activelyExploitedText, applicationTerminatedTitleText, applicationTerminatedBodyText, customDeferralButtonText, customDeferralDropdownText, informationButtonText, mainContentHeader, mainContentHeaderUnsupported, mainContentNote, mainContentNoteUnsupported, mainContentSubHeader, mainContentSubHeaderUnsupported, mainContentText, mainContentTextUnsupported, mainHeader, mainHeaderUnsupported, oneDayDeferralButtonText, oneHourDeferralButtonText, primaryQuitButtonText, screenShotAltText, secondaryQuitButtonText, subHeader, subHeaderUnsupported
}
}

Expand All @@ -556,6 +556,8 @@ extension UpdateElement {
language: String? = nil,
actionButtonText: String? = nil,
actionButtonTextUnsupported: String? = nil,
activelyExploitedOutput: String? = nil,
activelyExploitedText: String? = nil,
applicationTerminatedTitleText: String? = nil,
applicationTerminatedBodyText: String? = nil,
customDeferralButtonText: String? = nil,
Expand Down Expand Up @@ -583,6 +585,8 @@ extension UpdateElement {
language: language ?? self.language,
actionButtonText: actionButtonText ?? self.actionButtonText,
actionButtonTextUnsupported: actionButtonTextUnsupported ?? self.actionButtonTextUnsupported,
activelyExploitedOutput: activelyExploitedOutput ?? self.activelyExploitedOutput,
activelyExploitedText: activelyExploitedText ?? self.activelyExploitedText,
applicationTerminatedTitleText: applicationTerminatedTitleText ?? self.applicationTerminatedTitleText,
applicationTerminatedBodyText: applicationTerminatedBodyText ?? self.applicationTerminatedBodyText,
customDeferralButtonText: customDeferralButtonText ?? self.customDeferralButtonText,
Expand Down
1 change: 1 addition & 0 deletions Nudge/UI/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct UIConstants {

class AppState: ObservableObject {
@Published var activelyExploitedCVEs = false
@Published var activelyExploitedCVEsCount = 0
@Published var afterFirstStateChange = false
@Published var allowButtons = true
@Published var daysRemaining = DateManager().getNumberOfDaysBetween()
Expand Down
1 change: 1 addition & 0 deletions Nudge/UI/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
nudgePrimaryState.requiredMinimumOSVersion = selectedOS!.productVersion
nudgePrimaryState.sofaAboutUpdateURL = selectedOS!.securityInfo
nudgePrimaryState.activelyExploitedCVEs = activelyExploitedCVEs
nudgePrimaryState.activelyExploitedCVEsCount = selectedOS!.activelyExploitedCVEs.count
switch (activelyExploitedCVEs, presentCVEs, AppStateManager().requireMajorUpgrade()) {
case (false, true, true):
LogManager.notice("Non Actively Exploited Major Upgrade detected. Using nonActivelyExploitedCVEsMajorUpgradeSLA value: \(OSVersionRequirementVariables.nonActivelyExploitedCVEsMajorUpgradeSLA)", logger: sofaLog)
Expand Down
10 changes: 9 additions & 1 deletion Nudge/UI/StandardMode/LeftSide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ struct StandardModeLeftSide: View {
InfoRow(label: "Required Date:", value: DateManager().coerceDateToString(date: requiredInstallationDate, formatterString: UserInterfaceVariables.requiredInstallationDisplayFormat))
}
if OptionalFeatureVariables.utilizeSOFAFeed && UserInterfaceVariables.showActivelyExploitedCVEs {
InfoRow(label: "Actively Exploited CVEs:", value: String(appState.activelyExploitedCVEs).capitalized, isHighlighted: appState.activelyExploitedCVEs ? true : false, boldText: appState.activelyExploitedCVEs)
switch UserInterfaceVariables.activelyExploitedOutput {
case "YorN", "yorn":
let resultTempText = String(appState.activelyExploitedCVEs ? "Yes" : "No").localized(desiredLanguage: getDesiredLanguage(locale: appState.locale))
InfoRow(label: UserInterfaceVariables.activelyExploitedText.localized(desiredLanguage: getDesiredLanguage(locale: appState.locale)), value: resultTempText.capitalized, isHighlighted: appState.activelyExploitedCVEs ? true : false, boldText: appState.activelyExploitedCVEs)
case "Count", "count":
InfoRow(label: UserInterfaceVariables.activelyExploitedText.localized(desiredLanguage: getDesiredLanguage(locale: appState.locale)), value: String(appState.activelyExploitedCVEsCount), isHighlighted: appState.activelyExploitedCVEs ? true : false, boldText: appState.activelyExploitedCVEs)
default:
InfoRow(label: UserInterfaceVariables.activelyExploitedText.localized(desiredLanguage: getDesiredLanguage(locale: appState.locale)), value: String(appState.activelyExploitedCVEs).capitalized, isHighlighted: appState.activelyExploitedCVEs ? true : false, boldText: appState.activelyExploitedCVEs)
}
}
InfoRow(label: "Current OS Version:", value: GlobalVariables.currentOSVersion)
if UserInterfaceVariables.showDaysRemainingToUpdate {
Expand Down
37 changes: 37 additions & 0 deletions Schema/jamf/com.github.macadmins.Nudge.json
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,43 @@
}
]
},
"activelyExploitedOutput": {
"description": "Modifies the output format of the Actively Exploited CVEs field. Use TorF for True/False, YorN for Yes/No, use Count for actual count of CVEs. Lowercase is accepted, any other values will result in default of True/False (Note: This key is only used with Nudge v2.2 and higher)",
"anyOf": [
{
"type": "null",
"title": "Not Configured"
},
{
"title": "Configured",
"type": "string",
"enum": [
"TorF",
"YorN",
"Count"
],
"default": "TorF"
}
]
},
"activelyExploitedText": {
"description": "Modifies the label for Actively Exploited CVEs (if enabled). Length of text may cause label to span more than one line. (Note: This key is only used with Nudge v2.2 and higher)",
"anyOf": [
{
"type": "null",
"title": "Not Configured"
},
{
"title": "Configured",
"type": "string",
"options": {
"inputAttributes": {
"placeholder": "Actively Exploited CVEs:"
}
}
}
]
},
"applicationTerminatedTitleText": {
"description": "Modifies the terminated application notification title. (Note: This key is only used with Nudge v2.0 and higher)",
"anyOf": [
Expand Down