Skip to content

Commit efb9ecc

Browse files
committed
add option for -custom-sofa-feed-url
1 parent 73656af commit efb9ecc

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Nudge/3rd Party Assets/sofa.swift

+9
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ extension MacOSDataFeed {
223223

224224
class SOFA: NSObject, URLSessionDelegate {
225225
func URLSync(url: URL, maxRetries: Int = 3) -> (data: Data?, response: URLResponse?, error: Error?, responseCode: Int?, eTag: String?) {
226+
if url.scheme == "file" {
227+
do {
228+
let data = try Data(contentsOf: url)
229+
return (data, nil, nil, 200, nil)
230+
} catch {
231+
return (nil, nil, error, nil, nil)
232+
}
233+
}
234+
226235
let semaphore = DispatchSemaphore(value: 0)
227236
let lastEtag = Globals.nudgeDefaults.string(forKey: "LastEtag") ?? ""
228237
var request = URLRequest(url: url)

Nudge/Preferences/DefaultPreferencesNudge.swift

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ struct OptionalFeatureVariables {
145145
}
146146

147147
static var customSOFAFeedURL: String {
148+
CommandLineUtilities().customSOFAFeedURLOption() ??
148149
optionalFeaturesProfile?["customSOFAFeedURL"] as? String ??
149150
optionalFeaturesJSON?.customSOFAFeedURL ??
150151
"https://sofafeed.macadmins.io/v1/macos_data_feed.json"

Nudge/Utilities/Utils.swift

+4
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ struct CommandLineUtilities {
366366
return checkAndLogArgument("-bundle-mode-profile", logStateKey: &nudgeLogState.hasLoggedBundleMode)
367367
}
368368

369+
func customSOFAFeedURLOption() -> String? {
370+
return valueForArgument("-custom-sofa-feed-url")
371+
}
372+
369373
func debugUIModeEnabled() -> Bool {
370374
return checkAndLogArgument("-debug-ui-mode", logStateKey: &nudgeLogState.afterFirstRun)
371375
}

0 commit comments

Comments
 (0)