Compare commits

...
256 Commits
Author SHA1 Message Date
Kornel e1d4b19ce7 Bump 2018-07-17 16:37:50 +01:00
sagecook 360c2ce7a9 Fix binary delta creation on network drives
Closes  #1156
2018-07-17 16:33:58 +01:00
Kornel f9740292d4 Merge pull request #1261 from kenohori/master
New Spanish localisation
2018-06-28 12:55:05 +02:00
Ken Arroyo Ohori 558be04121 New Spanish localisation 2018-06-27 21:22:56 -05:00
Kornel b426426905 Merge pull request #1257 from LeoNatan/master
Fix compilation issues on Xcode 10 with new build system
2018-06-20 16:04:39 +01:00
Leo Natan 75835a5874 Fix compilation issues on Xcode 10 with new build system 2018-06-20 15:29:50 +03:00
Kornel 50c12d1c2b Bump 2018-06-19 22:36:19 +01:00
Kornel e452b7f6ba Merge pull request #1251 from ksuther/objc-messaging-id-fixes
Silence Xcode 10 "Messaging unqualified id" warnings by specifying types
2018-06-14 21:56:05 +03:00
Kent Sutherland 3034eca85b Updated readme to indicate that the 10.11 SDK is required to compile
Xcode 7 was released with 10.11, the reference to the 10.8 SDK is out of date.
2018-06-14 20:31:58 +02:00
Kent Sutherland 9ae41fe4ab Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10.
Removed __has_feature(objc_generics) check and use generisc to help silence the warnings.
2018-06-14 20:31:20 +02:00
Kornel 7d931e22d7 Merge pull request #1249 from JasonLPollack/update-finnish
Updated Finnish language resources
2018-06-14 18:57:56 +03:00
Jason Pollack b303ee312b Updated Finnish language resources 2018-06-14 10:05:31 -04:00
Kornel d19c98a877 Merge pull request #1245 from grahammiln/master
Remove executable bit on distributed source files.
2018-06-04 12:32:30 +01:00
Graham Miln 7a4caad5fe Remove executable bit on distributed source files. 2018-06-04 08:27:05 +02:00
Kornel 8f546c93f4 Merge pull request #1237 from ProsoftEngineering/spudownloadersession-main
#1236: SPUDownloaderSession main thread
2018-05-25 22:04:08 +01:00
Brian Bergstrand 1c4bcda012 Fix potential hang with dispatch_sync to main thread 2018-05-25 14:32:57 -05:00
Brian Bergstrand a18282ec79 Deliver SPUDownloaderSession delegate messages on the main queue
This is the behavior of SPDownloaderDeprecated.

Github #1236
2018-05-25 14:32:57 -05:00
Kornel 8a8ce49a23 Merge pull request #1235 from sunwenli/sunwenli
add tips for user to install doxygen
2018-05-25 12:22:32 +01:00
sunwenli 2561af8270 add tips for user to install doxygen 2018-05-25 17:12:11 +08:00
Kornel 035ad6a277 Merge pull request #1234 from horcs/add-delegate-callback-to-track-update-events
delegate callbacks for fininshed download and extraction related events
2018-05-22 17:08:25 +01:00
Csaba Horony 9cbae0edb6 add delegate callbacks for fininshed download and extraction related events 2018-05-22 10:07:50 +02:00
Kornel 3bbf84e332 Merge pull request #1230 from tamasprezi/private-key-from-keychain
Support for getting the private key from keychain for signing deltas
2018-05-13 23:22:14 +01:00
Tamás Lustyik a582d46096 Restored legacy CLI for backward compatibility 2018-05-13 21:33:03 +02:00
Tamás Lustyik 3f3ace055d Fixed index out of bounds 2018-05-13 17:28:29 +02:00
Tamás Lustyik 886e4b2c81 More complex argument parsing to support both inputs 2018-05-13 16:28:05 +02:00
Tamás Lustyik a418d8fe64 Function to load the private key directly from the keychain 2018-05-13 16:04:48 +02:00
Tamás Lustyik b48e80aa27 Minor naming improvement 2018-05-13 15:50:46 +02:00
Kornel a19dfb2be0 Bump 2018-04-29 13:36:22 +01:00
Kornel 7394593743 Explain why auth is requested
It can't be SULog, because it's not linked in tool using SUFileManager
2018-04-29 13:34:28 +01:00
Kornel 4973c0143f Whitespace 2018-04-29 13:34:06 +01:00
Kornel c171f381d4 Merge pull request #1222 from zyves72/master
French translation for critical update
2018-04-26 14:39:02 +01:00
zyves72 dde4a0aae2 Add files via upload
Translation
2018-04-26 14:53:59 +02:00
Kornel d5a1ba44ff Don't check for updates if Do Not Disturb is on 2018-04-24 04:20:51 +01:00
Kornel 0d03b4006d Merge pull request #1216 from mallexxx/master
Fix closeCheckingWindow called from background thread
2018-04-20 16:33:12 +01:00
Alexey Martemyanov 25993d0776 Fix closeCheckingWindow called from background thread 2018-04-20 22:22:16 +07:00
Kornel 276707b3da Merge pull request #1212 from sunuslee/master
expose CodesigningVerifier, add codesign info api
2018-04-17 17:51:24 +01:00
Kornel 23e88737ec Merge pull request #1211 from horcs/hungarian-localization
Hungarian localization
2018-04-16 20:54:34 +01:00
Csaba Horony d400a53ebd add missing hungarian translation 2018-04-16 13:40:34 +02:00
sunuslee f39b07fd59 expose CodesigningVerifier, add codesign info api
Signed-off-by: sunuslee <sunuslee@gmail.com>
2018-04-16 10:08:31 +08:00
Csaba Horony 5bc8f3e535 Hungarian localization 2018-04-13 10:56:17 +02:00
Csaba Horony 503a292084 added localization files for Hungarian translation 2018-04-13 10:55:50 +02:00
Karl Moskowski d60b16f633 Ensure cocoapods is installed before performing the release “sanity check” (#860) 2018-04-06 01:35:34 +01:00
Kornel de3e73b589 Merge pull request #1201 from DaveWoodCom/master
Silence some Xcode warnings
2018-03-26 12:32:08 +01:00
Dave Wood ad863775db Silence ‘This block declaration is not a prototype’ Xcode warning 2018-03-25 23:05:37 -04:00
Dave Wood 79511c982a Silence ‘decodeObjectOfClass:forKey: is only available on macOS 10.8’ Xcode warnings, similar to commit ea94969188 2018-03-25 23:05:25 -04:00
Kornel 189ed9d315 Merge pull request #1172 from nivekkagicom/fix_warnings
silence 10.9 availability and other warnings and use modules when available
2018-03-19 20:11:27 +00:00
Kornel ea94969188 10.7 compatibility 2018-03-18 13:52:13 +00:00
Kornel 57731f44d7 Avoid invalid use of main thread
Fixes #1189
2018-03-18 13:41:08 +00:00
Kornel 2a0514c93b Update wording of read-only error 2018-03-18 13:37:46 +00:00
Adrian Thomas 467e1495c0 Improve 'read-only' error message (#1192)
* Improver read-only error message German

Updated the "read-only volume" error to reflect the real-world scenarios users run into.
It's almost never a CD, it's nearly always running from ~/Downloads or the .dmg if you still ship your app that way.
2018-03-18 13:34:19 +00:00
Kornel Lesiński 8ac254951a "all" target 2018-03-18 13:27:56 +00:00
Kornel c83c9221f7 Hidden verbose flag 2018-03-18 13:27:45 +00:00
Kornel b46315df9c Outdated comment 2018-03-18 13:27:43 +00:00
Kornel 9c505dee2f Merge pull request #1181 from vitu/master
Amend to avoid gender issue
2018-02-02 17:22:50 +00:00
BR Lingo 2ed7402367 Amend to avoid gender issue
Amend to avoid gender issue

Victor committed
a01979c
1 changed file
Instead of addressing the user, which might cause gender issues, string has been adapted to include “app” (masculine, in accordance with Apple's terminology).

Would translate back as “The app is up-to-date!”
2018-02-02 10:51:47 -05:00
Kornel 3afa47b092 Changelog 2018-01-29 23:03:33 +00:00
Kornel 874d6bce36 Bump 2018-01-29 22:55:32 +00:00
B. Kevin Hardman 51a335b3fd move Xcode 9.2 automatic changes from project to xcconfig files 2018-01-18 11:19:50 -05:00
B. Kevin Hardman 578bb9ecb8 Bring project up to Xcode 9.2 settings 2018-01-18 08:02:18 -05:00
B. Kevin Hardman 76e8838eb3 silence 10.9 availability and other warnings and use modules when available 2018-01-18 07:37:26 -05:00
Kornel 0a101b7902 Merge pull request #1167 from sparkle-project/mainthread
Ensure UI is changed only on the main thread
2018-01-09 00:18:36 +00:00
Kornel 865dd2e187 Ensure UI is changed only on the main thread 2017-12-29 19:27:56 +00:00
Kornel 083bd9b453 nil checks 2017-12-29 19:26:56 +00:00
Kornel b48bc4dcac Merge pull request #1165 from Deadpikle/feature/spudownloader
[WIP] Port SPUDownloader to 1.x w/NSURLSession & NSURLDownload
2017-12-29 17:47:45 +00:00
Deadpikle bb6203f40a Fix typo in expectation description 2017-12-28 22:41:22 -05:00
Deadpikle 25204a66e0 Finish tests for persistent download 2017-12-28 22:35:27 -05:00
Deadpikle c886947f55 Set NSOperationQueue op count to 1 2017-12-28 22:34:43 -05:00
Deadpikle f0460033ba Remove commented out code 2017-12-28 21:58:42 -05:00
Deadpikle 1a71456ed9 Slight refactor of temp download test 2017-12-28 21:50:46 -05:00
Deadpikle e7cdbfc45e Add tests for temp SPUDownloader dl 2017-12-28 21:40:31 -05:00
Deadpikle 8b5c8b5cdf Fix SUAppcast tests 2017-12-28 15:52:47 -05:00
Deadpikle a7af48f0d1 Refactor cache clearing & errors to super 2017-12-24 09:38:04 -05:00
Deadpikle 03e28780d9 Fix AppKitPrevention not being included 2017-12-21 09:35:06 -05:00
Deadpikle 5b1c76db26 Fix a few header comments 2017-12-20 13:22:47 -05:00
Deadpikle 703e611eb5 Remove a bunch of warnings 2017-12-20 13:01:44 -05:00
Deadpikle 6ee88124ad SUAppcast now uses SPUDownloader 2017-12-20 12:58:45 -05:00
Deadpikle 1cc5f230a5 Check OS version before creating downloader 2017-12-20 12:40:48 -05:00
Deadpikle 429f950434 Only send back error if non-nil 2017-12-20 12:40:37 -05:00
Deadpikle 7df50ccfd3 Download path should be full path 2017-12-20 12:25:42 -05:00
Deadpikle 9c301bfbf3 Drivers now use SPUDownloader 2017-12-20 12:11:49 -05:00
Deadpikle 8a0474d644 Continue refactor of downloader to two classes 2017-12-20 11:43:13 -05:00
Deadpikle dc85d63861 Refactor download NSURLSession to a child class 2017-12-20 11:14:02 -05:00
Deadpikle dc8e8b775a Remove unnecessary delegate name in header 2017-12-20 11:13:41 -05:00
Deadpikle ecb608bb40 Bring 2.0 files for SPUDownloader to 1.x 2017-12-20 10:48:51 -05:00
Kornel c3e546d7f8 Merge pull request #1154 from 1024jp/updateJapanese
Update Japanese localization
2017-11-25 13:50:32 +00:00
1024jp 2477a92b0f Update Japanese localization 2017-11-25 15:34:15 +09:00
Kornel 7f0bc6a244 Merge pull request #1141 from stefanhp/patch-1
Update Sparkle.strings
2017-10-21 22:28:44 +01:00
Stefan Paychère 68f62e5955 Update Sparkle.strings
Translation of "Description text for SUUpdateAlert when the update informational with no download."
2017-10-21 20:29:51 +02:00
Kornel 0cb0b2f2c7 Update for newer OpenSSL 2017-10-10 12:26:01 +01:00
Kornel b590722aad Merge pull request #1135 from jkbullard/fix-frequent-polling
Fix #1061 & #835: Sparkle clients polling too frequently
2017-10-05 15:43:24 +01:00
Jonathan Bullard 10f831fce8 Move [NSDate date] to be after willChangeValueForKey
Per comment by Pornel
2017-10-05 09:36:31 -04:00
Jonathan Bullard a2ecdd2744 Fix #1061 & #835: Sparkle clients polling too frequently
The SULastCheckTimeKey preference (a/k/a "default"), which is stored
in ~/Library/Preferences/….plist, was used to store the date of the
last update check.

That causes a problem if the storage is read-only (for example, if the
.plist file is “locked” (has the uchg or schg flag set) or if the
SULastCheckTimeKey key "exists in a domain that precedes the
application domain the search list"). The date would never be modified,
and the old date would cause a new update check to be queued at the end
of an update check. If application or bundle was up-to-date, or the
user had chosen to skip the update that was available, this would cause
update checks to happen as often as the computer and network would
allow, many times each second.

The new code uses an instance variable to store the value. The variable
is initially loaded from the “SULastCheckTimeKey” preference, and each
time the variable is modified its new value is stored to that
preference. However, the variable, not the preference, is used when
calculating whether enough time has passed since the last update check
to warrant another check. The variable will always (after the first
update check) have the "correct" value, and update checks will not be
done more frequently than desired.
2017-10-05 08:57:04 -04:00
Kornel ec7f55d173 Handle SecTransformExecute errors
Fixes #1129
2017-09-27 18:45:52 +02:00
Kornel ddfc4089d2 Merge pull request #1126 from ksuther/touchbar-warnings
Silence Touch Bar availability warnings on Xcode 9
2017-09-18 23:06:08 +01:00
Kent Sutherland 80c34526e8 Silence Touch Bar availability warnings on Xcode 9 by using API_AVAILABLE.
Disable gnu-zero-variadic-macro-arguments to prevent warnings from use of API_AVAILABLE.
2017-09-18 12:17:58 -05:00
Kornel 0c3994c571 Merge pull request #1124 from dfuhrmann/xcode-7-macOS-10.11-compatibility
Restore Xcode 7 and macOS 10.11 SDK compatibility
2017-09-11 14:19:31 +01:00
David Fuhrmann fbda90ad64 Sparkle: Convert all xib files to Xcode 7 format
Only this format can be opened with Xcode 7. The previously used
Xcode 8 format only opens and compiles with Xcode 8.
2017-09-11 11:24:10 +02:00
David Fuhrmann 40750b6f24 Sparkle: Add 10.11 SDK compatibility for touch bar declarations
Those annotations are not available in 10.11 SDK yet.
2017-09-11 11:23:48 +02:00
David Fuhrmann a7ba0bea6e Sparkle: Add backwards compatibility with 10.11 SDK for logging
10.11 SDK does not contain the os_log API yet. Code is modified
in such a way that it compiles with older SDKs, and falls back
to the old implementation even if it runs on 10.12.
2017-09-11 11:22:27 +02:00
Kornel 558cfd2153 Bump 2017-08-14 13:19:03 +01:00
Kornel 94074e2bdc Merge pull request #1111 from sparkle-project/swift4
Update to Xcode 9/Swift 4
2017-08-14 13:02:21 +01:00
Kornel 56065fcf95 Merge pull request #1119 from 1024jp/patch-1
Update Xcode version for Travis CI
2017-08-14 12:46:30 +01:00
1024jp f24189e848 Update Xcode version for Travis CI 2017-08-14 18:05:49 +09:00
Kornel 65b12a2be1 Merge pull request #1116 from fujisoft/patch-3
Workaround for timing issue of termination detection.

Not sure if that is correct.
2017-08-11 19:03:05 +01:00
fujisoft 900de556a8 Fix for the timing issue of termination detection. 2017-08-08 11:12:47 +09:00
App Tyrant 7c8ff2b969 Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115)
* Added updaterDidRelaunchApplication: delegate method.

* Removed isUpdaterRelaunching property.

* Revert SUHost.
2017-08-08 00:21:51 +01:00
Kornel 43b4472d3c Better error message 2017-08-01 15:55:25 +01:00
Kornel 260170f372 Warning 2017-08-01 15:54:52 +01:00
Kornel ea85fc6442 Update to Xcode 9/Swift 4 2017-07-27 16:42:44 +01:00
Kornel a52604a264 Revert "Ensure UI code always runs on the main thread"
This reverts commit 423ee5a9d6.
2017-07-20 13:20:20 +01:00
Kornel 39d6c616b0 Merge pull request #1051 from sparkle-project/mainalert
Ensure UI code always runs on the main thread
2017-07-16 21:03:20 +01:00
Kornel 043ad0464a Merge pull request #1098 from Eitot/dutch
Update Dutch localization for informal style and changed terminology
2017-06-24 22:19:09 +01:00
Kornel d99339cf08 Merge pull request #1097 from Eitot/german
Update German localization for informal style and changed terminology
2017-06-24 22:11:16 +01:00
Eitot c541f95036 Update German localization with some terminology changes
Apple uses the term "Update" instead of "Aktualisierung" and
"laden" instead of "herunterladen".
2017-06-23 10:00:05 +02:00
Eitot e678ffb3ca Update German localization for informal style
This is the style in Apple's localizations in macOS Sierra.
Also makes some slight changes to wording.
2017-06-23 09:59:48 +02:00
Eitot 070ea362a2 Update Dutch localization for informal style
This is the style in Apple's localizations in macOS Sierra.
2017-06-23 09:57:55 +02:00
Eitot c4db636d0b Update Dutch localization with some style changes
This reflects Apple's localizations a bit better.
2017-06-23 09:57:49 +02:00
Kornel 7e9f05865a Merge pull request #1094 from keith/ks/cocoapods-bin
Include bin files in CocoaPods installation
2017-06-19 10:24:38 +01:00
Keith Smiley 3c14c950ef Include bin files in CocoaPods installation
This updates the podspec to include the bin scripts in Pods directory
when using CocoaPods. This way users don't also have to download the
Sparkle repo out of band to sign releases.
2017-06-18 20:33:24 -07:00
Kornel 4438b69b50 Simplified check 2017-06-07 23:56:45 +01:00
Kornel 6d0c734c26 Rename OSX macOS 2017-06-07 23:55:34 +01:00
Kornel e8805e0563 Merge pull request #1089 from Memphiz/add_osx_attribute
Add support for the sparkle:os attribute in the enclosure tag
2017-06-07 23:51:10 +01:00
Memphiz 193036b2c4 [BasicUpdateDriver] - extend hostSupportsItem method to also check the sparkle:os attribute from the enclosure element to decide if an update item is valid for the host 2017-06-07 22:11:08 +02:00
Memphiz 33bf6732ea [AppcastItem] - parse and save the sparkle:os attribute of the enclosure element and add isOsxUpdate method to item class 2017-06-07 22:10:56 +02:00
Kornel e94fb63ff0 Merge pull request #1087 from 1024jp/japanese
Updated Japanese translation to reflect change on 55be13c
2017-06-04 15:12:32 +01:00
Kornel 84e5925578 Merge pull request #1086 from vitu/master
Updated translation to reflect change on 55be13c
2017-06-04 15:11:51 +01:00
1024jp bb83e9a0da Updated Japanese translation to reflect change on 55be13c 2017-06-04 10:55:45 +09:00
Victor 26d4d75c36 Updated translation to reflect change on “Update error message to mention temp folders rather than optical drives”. 2017-06-03 20:23:14 -04:00
Kornel fe5737f0b6 Changelog 2017-06-02 12:21:08 +01:00
Kornel ac49a3b5b6 Merge pull request #1081 from sparkle-project/autoname
Prepend app name to Autoupdate.app name
2017-06-02 12:01:22 +01:00
Kornel cbeaeb29ec Merge pull request #1084 from ksuther/nil-progress-block
Don't assume that the progress block exists (the parameter is nullable)
2017-06-02 04:14:22 +01:00
Kent Sutherland d0a6c699da Don't assume that the progress block exists (the parameter is nullable) 2017-06-01 16:55:52 -05:00
Kornel 84b7e5e22f Prepend app name to Autoupdate.app name 2017-05-27 11:38:19 +01:00
Kornel 61774b3f7d Error message tweak 2017-05-27 11:37:06 +01:00
Kornel 55be13ca6f Update error message to mention temp folders rather than optical drives
Finder is required to remove quarantine from downloaded apps
2017-05-20 17:09:56 +01:00
Kornel fc48e5e4df 1.18.0 2017-05-18 21:54:56 +01:00
Kornel bfada07a2c Log more errors 2017-05-18 21:48:51 +01:00
Kornel 4f965660f3 Merge pull request #1072 from sparkle-project/autoerror
Unify handling of aborted updates
2017-05-03 16:51:06 +01:00
Kornel a2764158d6 Unify handling of aborted updates 2017-05-03 12:34:28 +01:00
Kornel 60727bffa5 Log key read failure 2017-04-24 18:05:13 +01:00
Kornel 715163fe0d Formatting 2017-04-24 18:05:13 +01:00
Kornel 629c42d62d Merge pull request #1050 from sparkle-project/genapp
generate_appcast improvements
2017-04-14 21:28:07 +02:00
Kornel 3e45211bbe Escape + as well 2017-03-31 15:15:22 +01:00
Kornel 89acca1318 Escape profile URLs better
Fixes #1059
2017-03-31 11:08:03 +01:00
Kornel Lesiński 4bc2e6e891 %s is deliberate in this format string
Fixes #1053
2017-03-24 12:00:12 +00:00
Kornel Lesiński 405c9fd9a1 Unused 2017-03-24 12:00:12 +00:00
Kornel 9232316b19 Merge pull request #1052 from sparkle-project/scheme
Make generate_appcast available as a shared scheme
2017-03-24 11:05:33 +00:00
Kornel Lesiński 0569c73391 Make generate_appcast available as a shared scheme
#1049
2017-03-17 09:27:00 +00:00
Kornel Lesiński 423ee5a9d6 Ensure UI code always runs on the main thread 2017-03-15 21:31:11 +00:00
Kornel Lesiński ac042821d8 Special case for .tar.gz extension 2017-03-15 18:42:08 +00:00
Kornel Lesiński 36139c57bc Shush Xcode 2017-03-15 18:42:08 +00:00
Kornel Lesiński 662e84400a Inline release notes if they don't look like a standalone HTML document 2017-03-15 18:42:08 +00:00
Kornel Lesiński b6b5c6d927 Link straight to docs from the readme 2017-03-15 18:42:08 +00:00
Kornel Lesiński 1683d2de34 Simplify release notes link check 2017-03-15 18:42:08 +00:00
Kornel Lesiński 615a08bc32 Feed formatting 2017-03-15 18:42:08 +00:00
Kornel c7bf998913 Merge pull request #1016 from sparkle-project/installprogress
Report installation progress from Installer
2017-03-12 14:39:43 +00:00
Kornel 1dd9d93090 Merge pull request #1046 from digitalmoksha/master
generate_appcast: if an .html file exists of the same name, create the releaseNotesLink
2017-03-11 11:31:58 +00:00
Brett Walker ac8c37096e ignore .html files when scanning for archives 2017-03-11 12:09:53 +01:00
Kornel c86e825a5f Merge pull request #1048 from vitu/master
Missing strings translation.
2017-03-09 17:03:57 +00:00
vitu 40a777f5d9 Missing strings translation. 2017-03-09 11:58:52 -05:00
Kornel Lesiński 3098afc90b Updated swift 2017-03-09 13:32:05 +00:00
Kornel Lesiński 3809da20bf Warn against abusing installUpdatesIfAvailable 2017-03-09 13:13:29 +00:00
Brett Walker c623480f72 when generating the appcast, if an .html file exists of the same name as
the archive, then it will be linked in as the releaseNotesLink
2017-03-08 10:57:59 +01:00
Kornel Lesiński 72ee4aa2c6 Revert "Fix pt_BR translations"
This reverts commit 83195a802e.
2017-03-08 00:36:46 +00:00
Kornel Lesiński e160f994b4 Revert "Fix pt_BR translations (#1039)"
This reverts commit 3b04c45ee9.
2017-03-08 00:36:40 +00:00
Kornel e7810c970b Merge pull request #1044 from 1024jp/fixJapanese
Fix Japanse localization
2017-03-01 10:39:35 +00:00
1024jp 0a94a6ce88 Fix Japanse localization
Generalize message to user as the previous setence was more like "Anonymous system profile information is used to help **our company** plan future development work."
2017-02-28 13:54:47 +09:00
Kornel Lesiński e54748ac87 Add more info to auth tool run failure 2017-02-26 18:03:42 +00:00
fujisoft 3b04c45ee9 Fix pt_BR translations (#1039)
* Fix pt_BR translations
2017-02-20 10:22:15 +00:00
Kornel 792e13a067 Merge pull request #1038 from fujisoft/patch-1
Fix pt_BR translations
2017-02-19 16:09:37 +00:00
fujisoft 83195a802e Fix pt_BR translations
"Translation Error Correction"
It must have a faithful consistency to the translation terminologies of Apple Inc.
2017-02-20 00:50:36 +09:00
Kornel 46d2a6aeab Merge pull request #1036 from gnachman/preventAccidentalInstalls
Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs.
2017-02-16 17:21:55 +00:00
George Nachman 40347c0d43 Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. 2017-02-13 19:41:02 -08:00
Kornel e1f67cf8db Merge pull request #1034 from digitalmoksha/master
added `sparkle:shortVersionString` to the enclosure, #1032
2017-02-10 21:39:00 +00:00
Brett Walker 5210e1d3ac added sparkle:shortVersionString to the enclosure, #1032 2017-02-10 16:53:30 +01:00
Kornel Lesiński f43c83688d Changelog 2017-02-09 00:04:10 +00:00
Kornel 83709f4b30 Merge pull request #1028 from digitalmoksha/master
percent encode the filename used in the delta url, for #995
2017-02-08 22:27:17 +00:00
Brett Walker c0d4640508 percent encode the filename used in the delta url 2017-02-08 22:40:37 +01:00
Kornel c6fb841868 Merge pull request #1026 from zorgiepoo/coupling-ci
Detect and fail if any two-way dependencies exist in the project
2017-02-06 16:22:59 +00:00
Zorg 9a07c5125e Detect and fail if any two-way dependencies exist in the project
While this may or may not be perfect, this should improve code quality by preventing new code that is introduced that creates tight coupling. This test is performed when make test is executed.

I avoided retrieving objc_dep in a way that make test would require an internet connection. I also added the executable bit to the objc_dep script, and a source.txt file indicating where the source came from.
2017-02-06 08:27:10 -05:00
Kornel fb6fe6d6da Merge pull request #1025 from vitu/master
Terminology consistency update.
2017-02-06 10:22:21 +00:00
BR Lingo 9318b9f896 Update Sparkle.strings
Terminology consistency update.
2017-02-06 01:18:26 -05:00
BR Lingo d27c12f1fc Update Sparkle.strings
Terminology consistency update.
2017-02-06 01:15:22 -05:00
Kornel 016dad176e Merge pull request #1024 from vslavik/faster-noop-builds
Don't touch Info.plist unless git version changes
2017-02-05 21:31:45 +00:00
Václav Slavík 1f98f9eb36 Don't touch Info.plist unless git version changes
PlistBuddy always touches its output file, even if the value written is
identical to the value already there. In such case, Xcode sees
Info.plist as modified, therefore sees the entire target as modified and
re-runs potentially expensive operations like copying frameworks or
signing.

Avoid unnecessary build operations by checking the previous
CFBundleShortVersionString if Info.plist already exists and only
updating it if necessary.
2017-02-05 18:29:22 +01:00
Kornel 6e51231966 Merge pull request #1021 from zorgiepoo/copyright
Add my name to LICENSE
2017-02-02 08:54:51 +00:00
Zorg dc1d83e904 Add my name to LICENSE 2017-02-01 23:56:17 -05:00
Kornel Lesiński 9d966e68f0 Merge remote-tracking branch 'origin/1.16.x'
* origin/1.16.x:
  Fix #1020
2017-01-28 12:15:28 +00:00
Kornel Lesiński 03abfe2739 Fix #1020 2017-01-28 12:10:03 +00:00
Kornel Lesiński 155816b609 Formatting 2017-01-28 12:07:10 +00:00
Kornel 313352fe26 Merge pull request #1018 from sparkle-project/filesystemnormalization
fileSystemRepresentation normalization
2017-01-28 12:06:32 +00:00
Kornel Lesiński 67b1e08a45 Delta minor version fix 2017-01-28 11:31:08 +00:00
Kornel Lesiński 21214e8623 Simplify minor delta version down to int
+ minor version bump
2017-01-28 11:08:53 +00:00
Kornel Lesiński ed16c5c2a0 Use the same fileSystemRepresentation function for both parts of the path 2017-01-27 18:37:35 +00:00
Kornel Lesiński 0a869e87bf Make normalizedInstallationPathForHost also normalize Unicode 2017-01-27 18:34:56 +00:00
Kornel Lesiński 14c543ccb3 Test with non-ASCII names 2017-01-27 18:17:05 +00:00
Kornel Lesiński 0fd0331464 Typo 2017-01-27 18:04:43 +00:00
Kornel Lesiński 0cba214f07 1.17.0 2017-01-24 14:07:32 +00:00
Kornel Lesiński 2a644672ca Report installer progress 2017-01-24 13:46:21 +00:00
Kornel Lesiński 81e71844d6 Report plain install progress 2017-01-24 13:46:01 +00:00
Kornel Lesiński e4821e0454 Ability to report installation progress 2017-01-24 13:45:50 +00:00
Kornel a97538f931 Merge pull request #1014 from zorgiepoo/fix-unarchive-temp-removal
Don't remove the temporary unarchive directory in unit tests
2017-01-23 09:48:22 +00:00
Zorg c61767f501 Don't remove the temporary unarchive directory in unit tests
This should fix a potential bug where the unit tests try to unarchive a file that does not exist.
2017-01-22 22:02:45 -05:00
Kornel Lesiński 06629310e2 Updated changelog 2017-01-22 18:40:39 +00:00
Kornel 7e99561d9c Merge pull request #1010 from zorgiepoo/termination-autoupdate
Termination autoupdate
2017-01-20 13:56:05 +00:00
Zorg 5c71eebf59 Remove nonsense logging I had for debugging purposes 2017-01-19 23:28:56 -05:00
Zorg 5368dbfb41 Merge branch '1.17.x' into termination-autoupdate 2017-01-19 23:22:27 -05:00
Zorg 0e978e3faf Add kqueue based termination listener
Note this termination listener is not polling or timer based and will work on processes that aren't GUI applications.
2017-01-19 23:21:26 -05:00
Kornel f9dfa3dd9d Merge pull request #1006 from sparkle-project/subsystem
Use app-independent subsystem identifier
2017-01-18 22:33:22 +00:00
Kornel Lesiński c104c1b27e Fix facility identifier 2017-01-18 22:31:03 +00:00
Kornel Lesiński 7e7c97a09f Use app-independent subsystem identifier 2017-01-18 19:01:45 +00:00
Kornel a75ad96719 Merge pull request #1005 from Bi11/touchbar
Update button outlets for all xib files
2017-01-18 12:32:03 +00:00
Bi11 22f5d1f0f8 Update button outlets for all xib 2017-01-18 15:45:00 +08:00
Kornel b9753cbd81 Merge pull request #1003 from Bi11/touchbar
Add forward declaration for Xcode7
2017-01-17 22:53:21 +00:00
Bi11 548ae6e2b6 Change SDK checking macro to match existing code base 2017-01-18 05:34:37 +08:00
Bi11 db7f4acc83 Add forward declaration for Xcode7 2017-01-18 05:06:09 +08:00
Bi11 942d70d3aa Suppress partial availability warning on line level 2017-01-18 04:53:37 +08:00
Kornel Lesiński 2ccac610f6 Added declaration for Xcode 7 2017-01-17 20:38:22 +00:00
Kornel Lesiński 7a0d402a01 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Explain why I'm not relying on the compiler to throw linkage errors
  Add AppKitPrevention header to reduce redundancy.
  Add AppKit prevention guards to modules that shouldn't import it
  Add Obj-C generics where applicable
  Adds test cases for "sparkle:criticalUpdate" tag. (#999)
2017-01-17 19:39:48 +00:00
Kornel Lesiński d070bca0b0 Sort project file 2017-01-17 19:38:02 +00:00
Kornel 682f8f32c6 Merge pull request #1002 from Bi11/touchbar
Add touch bar build support for Xcode 8.0 and earlier
2017-01-17 19:36:28 +00:00
Bi11 56db200f06 Add touch bar build support for Xcode 8.0 and earlier 2017-01-18 01:44:16 +08:00
Kornel Lesiński 55e1a24431 Formatting 2017-01-16 22:25:37 +00:00
Kornel Lesiński 9fa0519811 Comments 2017-01-16 22:07:55 +00:00
Kornel ecc72f834d Merge pull request #987 from Bi11/touchbar
Add Touch Bar Support
2017-01-16 12:12:47 +00:00
Bi11 aa29a754e6 Merge branch '1.17.x' into touchbar 2017-01-13 21:30:09 +08:00
Bi11 65bd11df8a Use NSView’s designated initializer 2017-01-13 20:33:41 +08:00
Kornel Lesiński 397eb8a379 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Proper fix for #995
2017-01-13 01:03:21 +00:00
Kornel Lesiński 5121d74ad9 Merge remote-tracking branch 'origin/master' into 1.17.x
* origin/master:
  Fix URL/path confusion
  Add 10.12 as SDK to run in Makefile and use Xcode 8.2 for Travis
2017-01-13 00:45:50 +00:00
Bi11 e2426784ac Add constrains to set touch bar buttons width equally 2017-01-13 01:35:09 +08:00
Bi11 118c72e61c Add touch bar button group view to replace NSGroupTouchBarItem 2017-01-13 01:22:33 +08:00
Bi11 6f11c1ce02 Set up touch bar in each window controller 2017-01-12 03:44:01 +08:00
Bi11 d5f4c312ee Keep consistent coding style 2017-01-11 23:11:02 +08:00
Kornel 9b3753f5d7 Merge pull request #990 from sparkle-project/bgnet
Tell OS when networking happens without UI
2017-01-11 04:45:24 +00:00
Bi11 5dda7462c1 Merge sparkle-project/master into touchbar 2017-01-11 02:20:28 +08:00
Bi11 c059dc8ae8 remove hardcoded array capacity 2017-01-11 02:07:48 +08:00
Bi11 6ca4b05cad Change touch bar identifier prefix to sparkle bundle identifier 2017-01-11 01:57:16 +08:00
Bi11 d95f420360 Set touch bar default button directly instead of changing its keyEquivalent 2017-01-11 00:44:15 +08:00
Bi11 7ae0e71b02 Fix compile issue with older SDK < 10.12.2 2017-01-11 00:42:03 +08:00
Bi11 b16d881808 Fix default button on touch bar 2017-01-10 18:44:48 +08:00
Kornel Lesiński 392cb65716 Tell OS when networking happens without UI 2017-01-10 02:37:00 +00:00
Bi11 6e01dd272f Use outlets instead of iterating through subviews 2017-01-10 08:34:25 +08:00
Bi11 762d527463 Merge branch 1.17.x into touchbar 2017-01-10 07:43:35 +08:00
Bi11 07599c2ffd Bind enabled and title for touch bar buttons by default 2017-01-10 07:34:52 +08:00
Bi11 f795802d60 Use NSTouchBarDelegate to avoid subclassing NSTouchBar 2017-01-10 07:22:44 +08:00
Kornel 073ce22015 Merge pull request #988 from zorgiepoo/host-info-dict
Re-read SUHost Info dictionary when necessary
2017-01-08 21:38:28 +00:00
Zorg 7ef468e8ea Use -[SUHost objectForInfoDictionaryKey:] in couple more places 2017-01-08 15:47:44 -05:00
Zorg fc9b2b38fa Make SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle
When we retrieve the "CFBundleIconFile" key from the Info dictionary, we should rely on SUHost's method of obtaining that value now.
2017-01-08 15:36:30 -05:00
Kornel 717921cfa1 Merge pull request #977 from sparkle-project/skipcrit
Disable skip button if update is critical
2017-01-08 11:44:09 +00:00
Kornel e621622c8b Merge pull request #983 from zorgiepoo/logging
Upgrade SULog to use logging APIs that Apple provides built in
2017-01-08 11:43:44 +00:00
Bi11 6902b80ab6 Fix UITests multiple matches issue introduced in touch bar 2017-01-08 15:23:26 +08:00
Bi11 d44a122a21 Add Touch Bar support 2017-01-08 15:17:47 +08:00
Zorg 0b6b6fe4ca Improve -[SUHost objectForInfoDictionaryKey:]
We use the cached host bundle if the host bundle is equal to the main bundle.
Otherwise we read in the latest Info dictionary every time.

The cached case is the most common case. The odd case (updating other bundles) is less common. Thus we have better performance for the common case, and we retain correct code in both cases.

Also we invoke our own implementation of -objectForInfoDictionaryKey: rather than NSBundle's implementation in a few places.
2017-01-07 23:52:56 -05:00
Zorg b9d113924e Upgrade SULog to use logging APIs that Apple provides built in
With this change, we ensure distinct per-app, per-process logging.
Note that the global file ~/Library/Logs/SparkleUpdateLog.log is no longer written into.

On 10.12 and above, SULog uses the os_log APIs. You may want to use log(1) to view logs in addition to Console.app. See the WWDC video on the new logging API and how the Console app has changed.

On older systems, this uses ASL (Apple System Log).

We don't want to reinvent logging, or rely on 3rd party libraries, thus we use what the system provides to us.

Two logging levels were added: Default and Error. The code documents their intended purpose. Now when you call SULog you must make a decision which level to use rather than rely on an implicit level.
2017-01-07 11:02:11 -05:00
Kornel Lesiński d9d62299be Disable Skip if the update is critical
Fixes #976
2017-01-04 15:23:47 +00:00
Kornel Lesiński 478bbf303b XIB churn 2017-01-04 15:23:47 +00:00
229 changed files with 5774 additions and 2406 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.2
osx_image: xcode9
before_install:
- brew update
script: make ci
+74
View File
@@ -1,3 +1,77 @@
# 1.20.0
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
* Add delegate callbacks for fininshed download and extraction related events (Csaba Horony)
* Don't check for updates if Do Not Disturb is on (Kornel)
* Expose `CodesigningVerifier`, add codesign info API (sunuslee)
* Threading fixes:
* Fix potential hang with `dispatch_sync` to main thread (Brian Bergstrand)
* Fix closeCheckingWindow called from background thread (Alexey Martemyanov)
* Improve 'read-only' error message (#1192) (Adrian Thomas)
* New Spanish localisation (Ken Arroyo Ohori)
* Updated Finnish language resources (Jason Pollack)
* Hungarian localization (Csaba Horony)
* Log more information about authentication requests (Kornel)
* Explicitly specify types to silence "Messaging unqualified id" warning that's new in Xcode 10. Removed __has_feature(objc_generics) check and use generisc to help silence the warnings. (Kent Sutherland)
* Fix binary delta creation on network drives (sagecook)
* Fix compilation issues on Xcode 10 with new build system (Leo Natan)
# 1.19.0
* Refactoring of downloader code to avoid deprecated methods (Deadpikle)
* Changes to which methods run on the main thread.
Note: some delegate methods may be called on non-main thread now. (Kornel)
* Update Japanese localization (1024jp)
* Update Sparkle.strings (Stefan Paychère)
* Fix Sparkle clients polling too frequently (Jonathan Bullard)
* Handle SecTransformExecute errors (Kornel)
* Silence Touch Bar availability warnings on Xcode 9 by using API_AVAILABLE. Disable gnu-zero-variadic-macro-arguments to prevent warnings from use of API_AVAILABLE. (Kent Sutherland)
* 10.11 SDK compatibility (David Fuhrmann)
# 1.18.1
* Add optional updaterDidRelaunchApplication: method on SUUpdaterDelegate (#1115) (App Tyrant)
* Implemented sparkle:os attribute as documented (Memphiz)
* Additional termination detection in case kpoll fails. (fujisoft)
* Included bin files in CocoaPods installation (Keith Smiley)
* Updated Dutch localization (Eitot)
* Updated German localization (Eitot)
* Updated Japanese translation (1024jp)
* Updated Portuguese translation (Victor)
* Updated to Xcode 9/Swift 4
# 1.18.0
* Name of the host app is used in authorization prompt (the `SPARKLE_RELAUNCH_TOOL_NAME` setting is now obsolete)
* More detailed progress bar for package installers (Kornel Lesiński)
* Disabled the keyboard shortcut for the install button for scheduled updates to avoid accidental installs. (George Nachman)
* generate_appcast tool adds release notes if there's an .html file with the same base name as the archive (Brett Walker)
* Added `sparkle:shortVersionString` to the enclosure, #1032 (Brett Walker)
* Fixed Japanese localization (1024jp)
* Fixed escaping of system profile URLs
* Added more logging in various failure cases (Kornel Lesiński)
* Better error message for quarantined apps that can't be updated
# 1.17.0
* Added Touch Bar support (Bi11)
* Upgraded SULog to use logging APIs that Apple provides built-in (Zorg)
* Skip buttons are disabled if the update is marked as critical (Kornel Lesiński)
* Background updates ask OS for lower-priority networking (Kornel Lesiński)
* Refactorings to sync with upcoming 2.0
* Added kqueue based termination listener (Zorg)
* Added AppKit prevention guards to modules that shouldn't import it (Zorg)
* Added Obj-C generics where applicable (Zorg)
* Made SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle (Zorg)
* Improved -[SUHost objectForInfoDictionaryKey:] (Zorg)
* Detect and fail if any two-way dependencies exist in the project (Zorg)
* generate_appcast:
* fixed handling of multiple directories in an archive
* percent encode the filename used in the delta url (Brett Walker)
* Update Sparkle.strings (BR Lingo)
* Improved handling of non-ASCII names in delta archives (Kornel Lesiński)
* Don't touch Info.plist unless git version changes (Václav Slavík)
# 1.16.0
* Guided package installs are now the default for updating packages (Zorg)
+2 -2
View File
@@ -16,7 +16,7 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_VERSION_MAJOR = 1
SPARKLE_VERSION_MINOR = 16
SPARKLE_VERSION_MINOR = 20
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
@@ -88,4 +88,4 @@ CLANG_ENABLE_MODULES[sdk=macosx10.8] = NO
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
// Turn on all warnings, then disable a few which are almost impossible to avoid
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import $(WARNING_CFLAGS_EXTRA)
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments $(WARNING_CFLAGS_EXTRA)
@@ -1,4 +1,10 @@
#include "ConfigCommonDebug.xcconfig"
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = YES
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES
@@ -2,6 +2,12 @@
// Debug only
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = 0
DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES
@@ -2,6 +2,12 @@
// Release only
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
GCC_OPTIMIZATION_LEVEL = s
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
+2 -1
View File
@@ -1 +1,2 @@
SWIFT_VERSION = 3.0
SWIFT_VERSION = 4.0
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
+7 -5
View File
@@ -2,11 +2,13 @@
set -e
if [ "$ACTION" = "" ] ; then
# Sanity check that the Podspec version matches the Sparkle version
spec_version=$(printf "require 'cocoapods'\nspec = %s\nprint spec.version" "$(cat "$SRCROOT/Sparkle.podspec")" | LANG=en_US.UTF-8 ruby)
if [ "$spec_version" != "$CURRENT_PROJECT_VERSION" ] ; then
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
exit 1
# If using cocoapods, sanity check that the Podspec version matches the Sparkle version
if [ -x "$(command -v pod)" ]; then
spec_version=$(printf "require 'cocoapods'\nspec = %s\nprint spec.version" "$(cat "$SRCROOT/Sparkle.podspec")" | LANG=en_US.UTF-8 ruby)
if [ "$spec_version" != "$CURRENT_PROJECT_VERSION" ] ; then
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
exit 1
fi
fi
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
+8 -2
View File
@@ -30,5 +30,11 @@ fi
# and use it to set the CFBundleShortVersionString value
export PATH="$PATH:/usr/libexec"
PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \
"$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
if [ -f "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" ] ; then
oldversion=$(PlistBuddy -c "Print :CFBundleShortVersionString" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH")
fi
if [ "$version" != "$oldversion" ] ; then
PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \
"$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
fi
+1
View File
@@ -5,6 +5,7 @@ if [ "$ACTION" = "" ] ; then
doxygen Documentation/Doxyfile
else
echo "warning: Doxygen not found in PATH"
echo "open Terminal and type this command `brew install doxygen` then click `enter/return` key. finally build this target again"
fi
elif [ "$ACTION" = "clean" ] ; then
rm -rf "$SRCROOT/Documentation/html"
+1
View File
@@ -1,6 +1,7 @@
Copyright (c) 2006-2013 Andy Matuschak.
Copyright (c) 2009-2013 Elgato Systems GmbH.
Copyright (c) 2011-2014 Kornel Lesiński.
Copyright (c) 2015-2017 Mayur Pawashe.
Copyright (c) 2014 C.W. Betts.
Copyright (c) 2014 Petroules Corporation.
Copyright (c) 2014 Big Nerd Ranch.
+3
View File
@@ -1,5 +1,7 @@
.PHONY: all localizable-strings release build test ci
all: build
ifndef BUILDDIR
BUILDDIR := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX")
endif
@@ -21,6 +23,7 @@ build:
test:
xcodebuild -scheme Distribution -configuration Debug test
./objc_dep/objc_dep.py -t .
uitest:
xcodebuild -scheme UITests -configuration Debug test
+10 -4
View File
@@ -30,21 +30,27 @@ Secure and reliable software update framework for Cocoa developers.
## Requirements
* Runtime: macOS 10.7 or greater
* Build: Xcode 7 and 10.8 SDK or greater
* Build: Xcode 7 and 10.11 SDK or greater
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
## API
## Usage
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required.
## Development
### API symbols
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
If you are adding a symbol to the public API you must decorate the declaration with the `SU_EXPORT` macro (grep the source code for examples).
## Building the distribution package
### Building the distribution package
`cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.bz2 will be created in a temporary directory and revealed in Finder after the build has completed.
Alternatively, build the Distribution scheme in the Xcode UI.
## Code of Conduct
### Code of Conduct
We pledge to have an open and welcoming environment. See our [Code of Conduct](CODE_OF_CONDUCT.md).
+2 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "1.16.0"
s.version = "1.20.0"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
s.homepage = "http://sparkle-project.org"
@@ -22,6 +22,7 @@ Pod::Spec.new do |s|
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.bz2" }
s.source_files = 'Sparkle.framework/Versions/A/Headers/*.h'
s.preserve_paths = 'bin/*'
s.public_header_files = 'Sparkle.framework/Versions/A/Headers/*.h'
s.vendored_frameworks = 'Sparkle.framework'
s.xcconfig = {
+134 -10
View File
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 47;
objects = {
/* Begin PBXAggregateTarget section */
@@ -49,6 +49,21 @@
14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */ = {isa = PBXBuildFile; fileRef = 14958C6B19AEBC530061B14F /* signed-test-file.txt */; };
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */ = {isa = PBXBuildFile; fileRef = 14958C6C19AEBC610061B14F /* test-pubkey.pem */; };
34074B901FEABD08001CB3A5 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074B8C1FEABD08001CB3A5 /* SPUDownloader.m */; };
34074B911FEABD08001CB3A5 /* SPUDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B8D1FEABD08001CB3A5 /* SPUDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074B921FEABD08001CB3A5 /* SPUDownloaderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B8E1FEABD08001CB3A5 /* SPUDownloaderDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074B931FEABD08001CB3A5 /* SPUDownloaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B8F1FEABD08001CB3A5 /* SPUDownloaderProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074B961FEABD24001CB3A5 /* SPULocalCacheDirectory.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B941FEABD23001CB3A5 /* SPULocalCacheDirectory.h */; };
34074B971FEABD24001CB3A5 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074B951FEABD23001CB3A5 /* SPULocalCacheDirectory.m */; };
34074B9A1FEABD49001CB3A5 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074B981FEABD48001CB3A5 /* SPUURLRequest.m */; };
34074B9B1FEABD49001CB3A5 /* SPUURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B991FEABD49001CB3A5 /* SPUURLRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074B9E1FEABD5A001CB3A5 /* SPUDownloadData.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074B9C1FEABD5A001CB3A5 /* SPUDownloadData.m */; };
34074B9F1FEABD5A001CB3A5 /* SPUDownloadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074B9D1FEABD5A001CB3A5 /* SPUDownloadData.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074BA21FEABFD2001CB3A5 /* SPUDownloaderSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074BA01FEABFD2001CB3A5 /* SPUDownloaderSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074BA31FEABFD2001CB3A5 /* SPUDownloaderSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074BA11FEABFD2001CB3A5 /* SPUDownloaderSession.m */; };
34074BA71FEAC417001CB3A5 /* SPUDownloaderDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074BA51FEAC417001CB3A5 /* SPUDownloaderDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; };
34074BA81FEAC417001CB3A5 /* SPUDownloaderDeprecated.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074BA61FEAC417001CB3A5 /* SPUDownloaderDeprecated.m */; };
342731481FF58E5B00285FBD /* SPUDownloaderTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 342731461FF58E4F00285FBD /* SPUDownloaderTest.swift */; };
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
55C14BD4136EEFCE00649790 /* Autoupdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14BD3136EEFCE00649790 /* Autoupdate.m */; };
55C14BD9136EF00C00649790 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
@@ -160,7 +175,7 @@
61A354550DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A354530DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.h */; settings = {ATTRIBUTES = (); }; };
61A354560DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A354540DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.m */; };
61AAE8280A321A7F00D8810D /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B078CC15A5FB6100600039 /* SUCodeSigningVerifier.h */; };
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B078CC15A5FB6100600039 /* SUCodeSigningVerifier.h */; settings = {ATTRIBUTES = (Public, ); }; };
61B078CF15A5FB6100600039 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
61B5F8ED09C4CE3C00B25A18 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };
61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */; };
@@ -190,6 +205,7 @@
61FA52880E2D9EA400EF58AD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (Required, ); }; };
7205C4311E1215AD00E370AE /* SUUpdatePermissionResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */; };
7205C4321E1215AD00E370AE /* SUUpdatePermissionResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */; };
720767CF1E2DC37400F9A850 /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 720767CE1E2DC37400F9A850 /* TerminationListener.m */; };
720B16451C66433D006985FB /* SUTestApplicationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720B16431C66433D006985FB /* SUTestApplicationTest.swift */; };
7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; };
721BC2111D1DFF05002BC71E /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 722954C31D04E66F00ECF9CA /* SUFileOperationConstants.m */; };
@@ -229,6 +245,7 @@
723B252E1CEAB3A600909873 /* bscommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 723B252B1CEAB3A600909873 /* bscommon.c */; };
723B252F1CEAB3A600909873 /* bscommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 723B252B1CEAB3A600909873 /* bscommon.c */; };
723B25301CEAB3A600909873 /* bscommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 723B252C1CEAB3A600909873 /* bscommon.h */; };
72464F7D1E213ED400FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
72544FFC1D0991A4000CFB2C /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 722954C31D04E66F00ECF9CA /* SUFileOperationConstants.m */; };
7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; };
726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
@@ -262,6 +279,9 @@
767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; };
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; };
E1545EC51E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */; };
E1545EC61E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; };
E1EC2A301E21667000245715 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; };
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; };
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; };
F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
@@ -455,6 +475,11 @@
0263187714FEBB42005EBF43 /* uk */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = uk; path = uk.lproj/SUUpdatePermissionPrompt.xib; sourceTree = "<group>"; };
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
0A8DAD73207FA6F300FFD934 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Sparkle.strings; sourceTree = "<group>"; };
0A8DAD74207FA6F300FFD934 /* hu */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = hu; path = hu.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
0A8DAD75207FA6F300FFD934 /* hu */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = hu; path = hu.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
0A8DAD76207FA6F400FFD934 /* hu */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = hu; path = hu.lproj/SUUpdatePermissionPrompt.xib; sourceTree = "<group>"; };
0A8DAD77207FA6F400FFD934 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1420DF4D196247B500203BB0 /* build-docs.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "build-docs.sh"; sourceTree = "<group>"; };
1420DF4E196247B500203BB0 /* Doxyfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
1420DF4F196247F900203BB0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
@@ -493,7 +518,6 @@
1A985A3B1C5C32A60001163A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A3C1C5C32A70001163A /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A3D1C5C32A80001163A /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A3E1C5C32A90001163A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A3F1C5C32AA0001163A /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A401C5C32AA0001163A /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A411C5C32AB0001163A /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@@ -515,6 +539,22 @@
1A985A511C5C32BB0001163A /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A521C5C32BC0001163A /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A985A531C5C32BD0001163A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/InfoPlist.strings; sourceTree = "<group>"; };
34074B8C1FEABD08001CB3A5 /* SPUDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUDownloader.m; sourceTree = "<group>"; };
34074B8D1FEABD08001CB3A5 /* SPUDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUDownloader.h; sourceTree = "<group>"; };
34074B8E1FEABD08001CB3A5 /* SPUDownloaderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUDownloaderDelegate.h; sourceTree = "<group>"; };
34074B8F1FEABD08001CB3A5 /* SPUDownloaderProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUDownloaderProtocol.h; sourceTree = "<group>"; };
34074B941FEABD23001CB3A5 /* SPULocalCacheDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPULocalCacheDirectory.h; sourceTree = "<group>"; };
34074B951FEABD23001CB3A5 /* SPULocalCacheDirectory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPULocalCacheDirectory.m; sourceTree = "<group>"; };
34074B981FEABD48001CB3A5 /* SPUURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUURLRequest.m; sourceTree = "<group>"; };
34074B991FEABD49001CB3A5 /* SPUURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUURLRequest.h; sourceTree = "<group>"; };
34074B9C1FEABD5A001CB3A5 /* SPUDownloadData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUDownloadData.m; sourceTree = "<group>"; };
34074B9D1FEABD5A001CB3A5 /* SPUDownloadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUDownloadData.h; sourceTree = "<group>"; };
34074BA01FEABFD2001CB3A5 /* SPUDownloaderSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUDownloaderSession.h; sourceTree = "<group>"; };
34074BA11FEABFD2001CB3A5 /* SPUDownloaderSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUDownloaderSession.m; sourceTree = "<group>"; };
34074BA41FEAC0BC001CB3A5 /* SPUDownloader_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUDownloader_Private.h; sourceTree = "<group>"; };
34074BA51FEAC417001CB3A5 /* SPUDownloaderDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUDownloaderDeprecated.h; sourceTree = "<group>"; };
34074BA61FEAC417001CB3A5 /* SPUDownloaderDeprecated.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUDownloaderDeprecated.m; sourceTree = "<group>"; };
342731461FF58E4F00285FBD /* SPUDownloaderTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPUDownloaderTest.swift; sourceTree = "<group>"; };
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUVersionDisplayProtocol.h; sourceTree = "<group>"; };
4607BEA21948443800EF8DA4 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Sparkle.strings; sourceTree = "<group>"; };
4607BEA31948443800EF8DA4 /* nb */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nb; path = nb.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
@@ -525,6 +565,9 @@
555CF29B196C523E0000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = el; path = el.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
555CF29C196C52460000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = el; path = el.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
555CF29D196C524C0000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = el; path = el.lproj/SUUpdatePermissionPrompt.xib; sourceTree = "<group>"; };
55BACC1820AF2C5B00ECEBB6 /* fi */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fi; path = fi.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
55BACC1920AF2C6D00ECEBB6 /* fi */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fi; path = fi.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
55BACC1A20AF2C7D00ECEBB6 /* fi */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fi; path = fi.lproj/SUUpdatePermissionPrompt.xib; sourceTree = "<group>"; };
55C14BB7136EEF1500649790 /* Autoupdate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Autoupdate.app; sourceTree = BUILT_PRODUCTS_DIR; };
55C14BB9136EEF1500649790 /* Autoupdate-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Autoupdate-Info.plist"; sourceTree = "<group>"; };
55C14BD3136EEFCE00649790 /* Autoupdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Autoupdate.m; sourceTree = "<group>"; };
@@ -732,6 +775,8 @@
7205C4331E12C23C00E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = "<group>"; };
7205C4341E12C66D00E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = "<group>"; };
7205C4351E12CA7000E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = "<group>"; };
720767CD1E2DC37400F9A850 /* TerminationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TerminationListener.h; sourceTree = "<group>"; };
720767CE1E2DC37400F9A850 /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TerminationListener.m; sourceTree = "<group>"; };
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = "<group>"; };
720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; };
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; };
@@ -795,6 +840,9 @@
A5BF4F1B1BC7668B007A052A /* SUTestWebServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTestWebServer.h; sourceTree = "<group>"; };
A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTestWebServer.m; sourceTree = "<group>"; };
C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.enc.dmg; sourceTree = "<group>"; };
E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarButtonGroup.h; sourceTree = "<group>"; };
E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTouchBarButtonGroup.m; sourceTree = "<group>"; };
E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUTouchBarForwardDeclarations.h; sourceTree = "<group>"; };
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifierTest.m; sourceTree = "<group>"; };
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp.zip; sourceTree = "<group>"; };
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = "<group>"; };
@@ -1037,15 +1085,16 @@
1495006D195FBBBD00BC5B5B /* Sparkle */ = {
isa = PBXGroup;
children = (
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */,
61299B3909CB055000B7442F /* Appcast Support */,
55C14BD5136EEFD000649790 /* Autoupdate */,
34074B8B1FEABCE7001CB3A5 /* Downloader */,
089C1665FE841158C02AAC07 /* Framework Resources */,
618FA6DB0DB485440026945C /* Installation */,
61B5F8F309C4CE5900B25A18 /* Other Sources */,
6101354A0DD25B7F0049ACDF /* Unarchiving */,
61F83F6E0DBFE07A006FDD30 /* Update Control */,
61299B3A09CB056100B7442F /* User Interface */,
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */,
);
path = Sparkle;
sourceTree = "<group>";
@@ -1069,12 +1118,36 @@
path = Resources;
sourceTree = "<group>";
};
34074B8B1FEABCE7001CB3A5 /* Downloader */ = {
isa = PBXGroup;
children = (
34074B9D1FEABD5A001CB3A5 /* SPUDownloadData.h */,
34074B9C1FEABD5A001CB3A5 /* SPUDownloadData.m */,
34074B8D1FEABD08001CB3A5 /* SPUDownloader.h */,
34074B8C1FEABD08001CB3A5 /* SPUDownloader.m */,
34074BA41FEAC0BC001CB3A5 /* SPUDownloader_Private.h */,
34074BA51FEAC417001CB3A5 /* SPUDownloaderDeprecated.h */,
34074BA61FEAC417001CB3A5 /* SPUDownloaderDeprecated.m */,
34074BA01FEABFD2001CB3A5 /* SPUDownloaderSession.h */,
34074BA11FEABFD2001CB3A5 /* SPUDownloaderSession.m */,
34074B8E1FEABD08001CB3A5 /* SPUDownloaderDelegate.h */,
34074B8F1FEABD08001CB3A5 /* SPUDownloaderProtocol.h */,
34074B941FEABD23001CB3A5 /* SPULocalCacheDirectory.h */,
34074B951FEABD23001CB3A5 /* SPULocalCacheDirectory.m */,
34074B991FEABD49001CB3A5 /* SPUURLRequest.h */,
34074B981FEABD48001CB3A5 /* SPUURLRequest.m */,
);
name = Downloader;
sourceTree = "<group>";
};
55C14BD5136EEFD000649790 /* Autoupdate */ = {
isa = PBXGroup;
children = (
722954B51D04ADAF00ECF9CA /* fileop */,
55C14BB9136EEF1500649790 /* Autoupdate-Info.plist */,
55C14BD3136EEFCE00649790 /* Autoupdate.m */,
720767CD1E2DC37400F9A850 /* TerminationListener.h */,
720767CE1E2DC37400F9A850 /* TerminationListener.m */,
);
path = Autoupdate;
sourceTree = "<group>";
@@ -1132,6 +1205,7 @@
14958C7019AEBE350061B14F /* Resources */,
72AFC6121B9A944200F6B565 /* Sparkle Unit Tests-Bridging-Header.h */,
612279DA0DB5470200AB99EA /* SparkleTests-Info.plist */,
342731461FF58E4F00285FBD /* SPUDownloaderTest.swift */,
5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */,
142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */,
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */,
@@ -1170,6 +1244,9 @@
6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */,
6196CFE309C71ADE000DC222 /* SUStatusController.h */,
6196CFE409C71ADE000DC222 /* SUStatusController.m */,
E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */,
E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */,
E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */,
61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */,
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */,
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
@@ -1368,19 +1445,24 @@
61299B3609CB04E000B7442F /* Sparkle.h in Headers */,
61B5FC0D09C4FC8200B25A18 /* SUAppcast.h in Headers */,
61B5FC7009C51F4A00B25A18 /* SUAppcastItem.h in Headers */,
34074BA71FEAC417001CB3A5 /* SPUDownloaderDeprecated.h in Headers */,
72316BDE1E0E17910039EFD9 /* SUApplicationInfo.h in Headers */,
6120721209CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h in Headers */,
34074B921FEABD08001CB3A5 /* SPUDownloaderDelegate.h in Headers */,
34074B961FEABD24001CB3A5 /* SPULocalCacheDirectory.h in Headers */,
61B93B270DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.h in Headers */,
61F83F740DBFE141006FDD30 /* SUBasicUpdateDriver.h in Headers */,
5D06E9390FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.h in Headers */,
72316BD91E0E17180039EFD9 /* SUBundleIcon.h in Headers */,
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */,
61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */,
6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */,
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */,
61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */,
34074B9F1FEABD5A001CB3A5 /* SPUDownloadData.h in Headers */,
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
14652F8419A978C200959E44 /* SUExport.h in Headers */,
7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */,
34074B911FEABD08001CB3A5 /* SPUDownloader.h in Headers */,
722954C41D04E66F00ECF9CA /* SUFileOperationConstants.h in Headers */,
767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */,
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */,
@@ -1397,11 +1479,14 @@
6196CFF909C72148000DC222 /* SUStatusController.h in Headers */,
61A2279C0D1CEE7600430CCD /* SUSystemProfiler.h in Headers */,
72316BE31E0E1C7F0039EFD9 /* SUSystemUpdateInfo.h in Headers */,
E1545EC51E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h in Headers */,
61B93A3C0DD02D7000DCD2F8 /* SUUIBasedUpdateDriver.h in Headers */,
34074B931FEABD08001CB3A5 /* SPUDownloaderProtocol.h in Headers */,
61299A8D09CA790200B7442F /* SUUnarchiver.h in Headers */,
722589DA1E0B19F4005EA0B9 /* SUUnarchiverNotifier.h in Headers */,
722589D71E0AD86B005EA0B9 /* SUUnarchiverProtocol.h in Headers */,
61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */,
34074B9B1FEABD49001CB3A5 /* SPUURLRequest.h in Headers */,
610134730DD250470049ACDF /* SUUpdateDriver.h in Headers */,
612DCBAF0D488BC60015DBEA /* SUUpdatePermissionPrompt.h in Headers */,
7205C4311E1215AD00E370AE /* SUUpdatePermissionResponse.h in Headers */,
@@ -1412,6 +1497,7 @@
61A354550DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.h in Headers */,
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */,
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */,
34074BA21FEABFD2001CB3A5 /* SPUDownloaderSession.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1612,16 +1698,16 @@
attributes = {
CLASSPREFIX = SU;
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = "Sparkle Project";
TargetAttributes = {
5AA96C541E0AE0DB00CA4346 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
612279D80DB5470200AB99EA = {
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
TestTargetID = 8DC2EF4F0486A6940098B216;
};
722954B31D04ADAF00ECF9CA = {
@@ -1632,10 +1718,13 @@
LastSwiftMigration = 0800;
TestTargetID = 61B5F90109C4CEE200B25A18;
};
8DC2EF4F0486A6940098B216 = {
LastSwiftMigration = 0920;
};
};
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@@ -1781,6 +1870,7 @@
files = (
);
inputPaths = (
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH,
);
name = "Run Script: Set Git Version Info";
outputPaths = (
@@ -1796,6 +1886,7 @@
files = (
);
inputPaths = (
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH,
);
name = "Run Script: Set Git Version Info";
outputPaths = (
@@ -1863,6 +1954,8 @@
55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */,
55C14F20136EF84300649790 /* SUStatusController.m in Sources */,
55C14F23136EF86700649790 /* SUSystemProfiler.m in Sources */,
E1EC2A301E21667000245715 /* SUTouchBarButtonGroup.m in Sources */,
720767CF1E2DC37400F9A850 /* TerminationListener.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1888,6 +1981,7 @@
5AE13FA21E0D716F000D2C2C /* SUFileManager.m in Sources */,
5AE13FA41E0D71D1000D2C2C /* SUFileOperationConstants.m in Sources */,
5AE13FB81E0D9F8E000D2C2C /* SULog.m in Sources */,
72464F7D1E213ED400FB341C /* SUOperatingSystem.m in Sources */,
5AE13FB61E0D9F39000D2C2C /* SUPipedUnarchiver.m in Sources */,
5AE13FA61E0D7275000D2C2C /* SUStandardVersionComparator.m in Sources */,
5AE13FA11E0D7168000D2C2C /* SUUnarchiver.m in Sources */,
@@ -1924,6 +2018,7 @@
721CF1A81AD7644100D9AC09 /* bspatch.c in Sources */,
721CF1A91AD7644C00D9AC09 /* sais.c in Sources */,
5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */,
342731481FF58E5B00285FBD /* SPUDownloaderTest.swift in Sources */,
72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */,
142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */,
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
@@ -1978,6 +2073,7 @@
buildActionMask = 2147483647;
files = (
723B252D1CEAB3A600909873 /* bscommon.c in Sources */,
34074B9E1FEABD5A001CB3A5 /* SPUDownloadData.m in Sources */,
5D06E8EB0FD68CE4005AE3F6 /* bspatch.c in Sources */,
61B5FBB709C4FAFF00B25A18 /* SUAppcast.m in Sources */,
61B5FC6F09C51F4900B25A18 /* SUAppcastItem.m in Sources */,
@@ -1986,7 +2082,9 @@
61B93B280DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.m in Sources */,
61F83F720DBFE140006FDD30 /* SUBasicUpdateDriver.m in Sources */,
5D06E8EC0FD68CE4005AE3F6 /* SUBinaryDeltaApply.m in Sources */,
34074B971FEABD24001CB3A5 /* SPULocalCacheDirectory.m in Sources */,
5D06E8ED0FD68CE4005AE3F6 /* SUBinaryDeltaCommon.m in Sources */,
34074BA31FEABFD2001CB3A5 /* SPUDownloaderSession.m in Sources */,
5D06E93A0FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m in Sources */,
72316BDA1E0E17180039EFD9 /* SUBundleIcon.m in Sources */,
61B078CF15A5FB6100600039 /* SUCodeSigningVerifier.m in Sources */,
@@ -1998,6 +2096,7 @@
767B61AD1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */,
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */,
618FA5020DAE88B40026945C /* SUInstaller.m in Sources */,
34074B901FEABD08001CB3A5 /* SPUDownloader.m in Sources */,
55C14F07136EF6DB00649790 /* SULog.m in Sources */,
726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */,
618FA5230DAE8E8A0026945C /* SUPackageInstaller.m in Sources */,
@@ -2005,10 +2104,13 @@
618FA5060DAE8AB80026945C /* SUPlainInstaller.m in Sources */,
6101347C0DD2541A0049ACDF /* SUProbingUpdateDriver.m in Sources */,
61B93C0A0DD112FF00DCD2F8 /* SUScheduledUpdateDriver.m in Sources */,
34074BA81FEAC417001CB3A5 /* SPUDownloaderDeprecated.m in Sources */,
61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */,
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */,
61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */,
72316BE41E0E1C7F0039EFD9 /* SUSystemUpdateInfo.m in Sources */,
34074B9A1FEABD49001CB3A5 /* SPUURLRequest.m in Sources */,
E1545EC61E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m in Sources */,
61B93A3D0DD02D7000DCD2F8 /* SUUIBasedUpdateDriver.m in Sources */,
61299A8E09CA790200B7442F /* SUUnarchiver.m in Sources */,
722589DB1E0B19F4005EA0B9 /* SUUnarchiverNotifier.m in Sources */,
@@ -2143,6 +2245,8 @@
0263187514FEBB42005EBF43 /* uk */,
55C14BEC136EF20D00649790 /* zh_CN */,
55C14BED136EF20D00649790 /* zh_TW */,
0A8DAD74207FA6F300FFD934 /* hu */,
55BACC1920AF2C6D00ECEBB6 /* fi */,
);
name = SUAutomaticUpdateAlert.xib;
sourceTree = "<group>";
@@ -2177,6 +2281,8 @@
0263187614FEBB42005EBF43 /* uk */,
55C14C02136EF26100649790 /* zh_CN */,
55C14C03136EF26100649790 /* zh_TW */,
0A8DAD75207FA6F300FFD934 /* hu */,
55BACC1820AF2C5B00ECEBB6 /* fi */,
);
name = SUUpdateAlert.xib;
sourceTree = "<group>";
@@ -2211,6 +2317,8 @@
0263187714FEBB42005EBF43 /* uk */,
55C14C17136EF2C700649790 /* zh_CN */,
55C14C18136EF2C700649790 /* zh_TW */,
0A8DAD76207FA6F400FFD934 /* hu */,
55BACC1A20AF2C7D00ECEBB6 /* fi */,
);
name = SUUpdatePermissionPrompt.xib;
sourceTree = "<group>";
@@ -2248,6 +2356,7 @@
0263187214FEBB31005EBF43 /* uk */,
61131A090F846D0A00E97AF6 /* zh_CN */,
61131A0A0F846D1100E97AF6 /* zh_TW */,
0A8DAD73207FA6F300FFD934 /* hu */,
);
name = Sparkle.strings;
sourceTree = "<group>";
@@ -2268,7 +2377,6 @@
1A985A331C5C329D0001163A /* fr */,
1A985A4B1C5C32B60001163A /* fr-CA */,
1A985A3D1C5C32A80001163A /* he */,
1A985A3E1C5C32A90001163A /* hu */,
1A985A3F1C5C32AA0001163A /* id */,
1A985A401C5C32AA0001163A /* is */,
1A985A361C5C32A20001163A /* it */,
@@ -2290,6 +2398,7 @@
1A985A511C5C32BB0001163A /* uk */,
1A985A4A1C5C32B50001163A /* zh-Hans */,
1A985A351C5C329E0001163A /* zh-Hant */,
0A8DAD77207FA6F400FFD934 /* hu */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
@@ -2352,6 +2461,11 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Coverage;
};
@@ -2405,6 +2519,11 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -2412,6 +2531,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D50D94A70100DD942E /* ConfigFrameworkRelease.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -2426,6 +2549,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CC0D94A70100DD942E /* ConfigCommonRelease.xcconfig */;
buildSettings = {
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0920"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -10,6 +10,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -30,6 +31,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5AA96C541E0AE0DB00CA4346"
BuildableName = "generate_appcast"
BlueprintName = "generate_appcast"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5AA96C541E0AE0DB00CA4346"
BuildableName = "generate_appcast"
BlueprintName = "generate_appcast"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5AA96C541E0AE0DB00CA4346"
BuildableName = "generate_appcast"
BlueprintName = "generate_appcast"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5AA96C541E0AE0DB00CA4346"
BuildableName = "generate_appcast"
BlueprintName = "generate_appcast"
ReferencedContainer = "container:Sparkle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+24 -69
View File
@@ -7,67 +7,10 @@
#import "SUStatusController.h"
#import "SULog.h"
#import "SUInstallerProtocol.h"
#import "TerminationListener.h"
#include <unistd.h>
/*!
* Time this app uses to recheck if the parent has already died.
*/
static const NSTimeInterval SUParentQuitCheckInterval = .25;
@interface TerminationListener : NSObject
- (instancetype)initWithProcessId:(pid_t)pid;
@end
@interface TerminationListener ()
@property (nonatomic, assign) pid_t processIdentifier;
@property (nonatomic, strong) NSTimer *watchdogTimer;
@end
@implementation TerminationListener
@synthesize processIdentifier = _processIdentifier;
@synthesize watchdogTimer = _watchdogTimer;
- (instancetype)initWithProcessId:(pid_t)pid
{
if (!(self = [super init])) {
return nil;
}
self.processIdentifier = pid;
return self;
}
- (void)cleanupWithCompletion:(void (^)(void))completionBlock
{
[self.watchdogTimer invalidate];
completionBlock();
}
- (void)startListeningWithCompletion:(void (^)(void))completionBlock
{
BOOL alreadyTerminated = (getppid() == 1); // ppid is launchd (1) => parent terminated already
if (alreadyTerminated)
[self cleanupWithCompletion:completionBlock];
else
self.watchdogTimer = [NSTimer scheduledTimerWithTimeInterval:SUParentQuitCheckInterval target:self selector:@selector(watchdog:) userInfo:completionBlock repeats:YES];
}
- (void)watchdog:(NSTimer *)timer
{
if (![NSRunningApplication runningApplicationWithProcessIdentifier:self.processIdentifier]) {
[self cleanupWithCompletion:timer.userInfo];
}
}
@end
/*!
* If the Installation takes longer than this time the Application Icon is shown in the Dock so that the user has some feedback.
*/
@@ -128,7 +71,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
self.hostPath = hostPath;
self.relaunchPath = relaunchPath;
self.terminationListener = [[TerminationListener alloc] initWithProcessId:parentProcessId];
SULog(SULogLevelDefault, @"PID to listen: %d", parentProcessId);
self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:@(parentProcessId)];
self.updateFolderPath = updateFolderPath;
self.shouldRelaunch = shouldRelaunch;
self.shouldShowUI = shouldShowUI;
@@ -138,8 +82,13 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
- (void)applicationDidFinishLaunching:(NSNotification __unused *)notification
{
[self.terminationListener startListeningWithCompletion:^{
[self.terminationListener startListeningWithCompletion:^(BOOL terminationSuccess) {
self.terminationListener = nil;
if (!terminationSuccess) {
SULog(SULogLevelError, @"Failed to listen for application termination");
// Continue on with the installation anyway?
}
if (self.shouldShowUI) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUInstallationTimeLimit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -173,13 +122,13 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
NSString *fileOperationToolPath = [[[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@""SPARKLE_FILEOP_TOOL_NAME];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileOperationToolPath]) {
SULog(@"Potential Installation Error: File operation tool path %@ is not found", fileOperationToolPath);
SULog(SULogLevelError, @"Potential Installation Error: File operation tool path %@ is not found", fileOperationToolPath);
}
NSError *retrieveInstallerError = nil;
id<SUInstallerProtocol> installer = [SUInstaller installerForHost:host fileOperationToolPath:fileOperationToolPath updateDirectory:self.updateFolderPath error:&retrieveInstallerError];
if (installer == nil) {
SULog(@"Retrieved Installer Error: %@", retrieveInstallerError);
SULog(SULogLevelError, @"Retrieved Installer Error: %@", retrieveInstallerError);
exit(EXIT_FAILURE);
}
@@ -187,14 +136,14 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
self.statusController = [[SUStatusController alloc] initWithHost:host];
[self.statusController setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:Nil isDefault:NO];
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"")
maxProgressValue: 0 statusText: @""];
maxProgressValue:100 statusText: @""];
[self.statusController showWindow:self];
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSError *initialInstallationError = nil;
if (![installer performInitialInstallation:&initialInstallationError]) {
SULog(@"Failed to perform initial installation with error: %@", initialInstallationError);
SULog(SULogLevelError, @"Failed to perform initial installation with error: %@", initialInstallationError);
dispatch_async(dispatch_get_main_queue(), ^{
[self showError:initialInstallationError];
exit(EXIT_FAILURE);
@@ -202,12 +151,18 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
return;
}
void(^progressBlock)(double) = ^(double progress){
dispatch_async(dispatch_get_main_queue(), ^(){
self.statusController.progressValue = progress * 100.0;
});
};
NSError *finalInstallationError = nil;
if (![installer performFinalInstallation:&finalInstallationError]) {
if (![installer performFinalInstallationProgressBlock:progressBlock error:&finalInstallationError]) {
NSError *underlyingError = [finalInstallationError.userInfo objectForKey:NSUnderlyingErrorKey];
dispatch_async(dispatch_get_main_queue(), ^{
if (underlyingError == nil || underlyingError.code != SUInstallationCancelledError) {
SULog(@"Failed to perform final installation Error: %@", finalInstallationError);
SULog(SULogLevelError, @"Failed to perform final installation Error: %@", finalInstallationError);
[self showError:finalInstallationError];
}
exit(EXIT_FAILURE);
@@ -238,7 +193,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
dispatch_block_t cleanupAndExit = ^{
NSError *theError = nil;
if (![[NSFileManager defaultManager] removeItemAtPath:self.updateFolderPath error:&theError]) {
SULog(@"Couldn't remove update folder: %@.", theError);
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
}
[[NSFileManager defaultManager] removeItemAtPath:[[NSBundle mainBundle] bundlePath] error:NULL];
@@ -254,7 +209,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
// Don't use -launchApplication: because we may not be launching an application. Eg: it could be a system prefpane
if (![[NSWorkspace sharedWorkspace] openFile:relaunchPath]) {
SULog(@"Failed to launch %@", relaunchPath);
SULog(SULogLevelError, @"Failed to launch %@", relaunchPath);
}
[self.statusController close];
@@ -277,7 +232,7 @@ int main(int __unused argc, const char __unused *argv[])
{
@autoreleasepool
{
NSArray *args = [[NSProcessInfo processInfo] arguments];
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
if (args.count < 5 || args.count > 7) {
return EXIT_FAILURE;
}
+24
View File
@@ -0,0 +1,24 @@
//
// TerminationListener.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TerminationListener : NSObject
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
@property (nonatomic, readonly) BOOL terminated;
// If the process identifier provided was nil, then the completion block will invoke immediately with a YES success
- (void)startListeningWithCompletion:(void (^)(BOOL success))completionBlock;
@end
NS_ASSUME_NONNULL_END
+136
View File
@@ -0,0 +1,136 @@
//
// TerminationListener.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "TerminationListener.h"
#import "SULog.h"
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include "AppKitPrevention.h"
@interface TerminationListener ()
@property (nonatomic, readonly, nullable) NSNumber *processIdentifier;
@property (nonatomic) BOOL watchedTermination;
@property (nonatomic, copy) void (^completionBlock)(BOOL);
@end
@implementation TerminationListener
@synthesize completionBlock = _completionBlock;
@synthesize processIdentifier = _processIdentifier;
@synthesize watchedTermination = _watchedTermination;
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
{
self = [super init];
if (self != nil) {
_processIdentifier = processIdentifier;
}
return self;
}
- (BOOL)terminated
{
return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
}
- (void)invokeCompletionWithSuccess:(BOOL)success
{
if (self.completionBlock != nil) {
self.completionBlock(success);
self.completionBlock = nil;
}
}
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
{
self.completionBlock = completionBlock;
if (self.processIdentifier == nil) {
[self invokeCompletionWithSuccess:YES];
return;
}
// Use kqueues to determine when the process will terminate
// As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10
// By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it
pid_t processIdentifier = self.processIdentifier.intValue;
int queue = kqueue();
if (queue == -1) {
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
struct kevent changes;
EV_SET(&changes, processIdentifier, EVFILT_PROC, EV_ADD | EV_RECEIPT, NOTE_EXIT, 0, NULL);
if (kevent(queue, &changes, 1, &changes, 1, NULL) == -1) {
SULog(SULogLevelError, @"Failed to invoke kevent() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
// We will assume this terminationListener will never be deallocated
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
CFFileDescriptorContext context = { 0, (void *)CFBridgingRetain(self), NULL, NULL, NULL };
#pragma clang diagnostic pop
CFFileDescriptorRef noteExitKQueueRef = CFFileDescriptorCreate(NULL, queue, true, noteExitKQueueCallback, &context);
if (noteExitKQueueRef == NULL) {
SULog(SULogLevelError, @"Failed to create file descriptor via CFFileDescriptorCreate()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopSourceRef runLoopSource = CFFileDescriptorCreateRunLoopSource(NULL, noteExitKQueueRef, 0);
if (runLoopSource == NULL) {
SULog(SULogLevelError, @"Failed to create runLoopSource via CFFileDescriptorCreateRunLoopSource()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
CFRelease(runLoopSource);
CFFileDescriptorEnableCallBacks(noteExitKQueueRef, kCFFileDescriptorReadCallBack);
// Make sure we didn't set the listener callback to a dead PID
// If we did, we could hang forever. To avoid this, we check if the process has terminated *after* we set up the callback
// If we tried to do this check before setting the callback, we could run into an issue where the process can terminate after our check
// but before setting the callback
if ([self terminated]) {
[self invokeCompletionWithSuccess:YES];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if ([self terminated]) {
[self invokeCompletionWithSuccess:YES];
}
});
}
static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unused callBackTypes, void *info)
{
struct kevent event;
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
TerminationListener *self = CFBridgingRelease(info);
self.watchedTermination = YES;
[self invokeCompletionWithSuccess:YES];
}
@end
Vendored Executable → Regular
+29 -29
View File
@@ -2,21 +2,21 @@
import Foundation
func die(msg: String) {
func die(_ msg: String) {
print("ERROR: \(msg)")
exit(1)
}
extension NSXMLElement {
extension XMLElement {
convenience init(name: String, attributes: [String: String], stringValue string: String? = nil) {
self.init(name: name, stringValue: string)
setAttributesWithDictionary(attributes)
setAttributesWith(attributes)
}
}
let ud = NSUserDefaults.standardUserDefaults()
let sparkleRoot = ud.objectForKey("root") as? String
let htmlPath = ud.objectForKey("htmlPath") as? String
let ud = UserDefaults.standard
let sparkleRoot = ud.object(forKey: "root") as? String
let htmlPath = ud.object(forKey: "htmlPath") as? String
if sparkleRoot == nil || htmlPath == nil {
die("Missing arguments")
}
@@ -29,36 +29,36 @@ if enStringsDict == nil {
let enStringsDictKeys = enStringsDict!.allKeys
let dirPath = NSString(string: sparkleRoot! + "/Sparkle")
let dirContents = try! NSFileManager.defaultManager().contentsOfDirectoryAtPath(dirPath as String)
let dirContents = try! FileManager.default.contentsOfDirectory(atPath: dirPath as String)
let css =
"body { font-family: sans-serif; font-size: 10pt; }" +
"h1 { font-size: 12pt; }" +
".missing { background-color: #FFBABA; color: #D6010E; white-space: pre; }" +
".unused { background-color: #BDE5F8; color: #00529B; white-space: pre; }" +
".unlocalized { background-color: #FEEFB3; color: #9F6000; white-space: pre; }"
var html = NSXMLDocument(rootElement: NSXMLElement(name: "html"))
html.DTD = NSXMLDTD()
html.DTD!.name = html.rootElement()!.name
var html = XMLDocument(rootElement: XMLElement(name: "html"))
html.dtd = XMLDTD()
html.dtd!.name = html.rootElement()!.name
html.characterEncoding = "UTF-8"
html.documentContentKind = NSXMLDocumentContentKind.XHTMLKind
var body = NSXMLElement(name: "body")
var head = NSXMLElement(name: "head")
html.documentContentKind = XMLDocument.ContentKind.xhtml
var body = XMLElement(name: "body")
var head = XMLElement(name: "head")
html.rootElement()!.addChild(head)
html.rootElement()!.addChild(body)
head.addChild(NSXMLElement(name: "meta", attributes: ["charset": html.characterEncoding!]))
head.addChild(NSXMLElement(name: "title", stringValue: "Sparkle Localizations Report"))
head.addChild(NSXMLElement(name: "style", stringValue: css))
head.addChild(XMLElement(name: "meta", attributes: ["charset": html.characterEncoding!]))
head.addChild(XMLElement(name: "title", stringValue: "Sparkle Localizations Report"))
head.addChild(XMLElement(name: "style", stringValue: css))
let locale = NSLocale.currentLocale()
let locale = Locale.current
for dirEntry in dirContents {
if NSString(string: dirEntry).pathExtension != "lproj" || dirEntry == "en.lproj" {
continue
}
let lang = locale.displayNameForKey(NSLocaleLanguageCode, value: NSString(string: dirEntry).stringByDeletingPathExtension)
body.addChild(NSXMLElement(name: "h1", stringValue: "\(dirEntry) (\(lang!))"))
let lang = (locale as NSLocale).displayName(forKey: NSLocale.Key.languageCode, value: NSString(string: dirEntry).deletingPathExtension)
body.addChild(XMLElement(name: "h1", stringValue: "\(dirEntry) (\(lang!))"))
let stringsPath = NSString(string: dirPath.stringByAppendingPathComponent(dirEntry)).stringByAppendingPathComponent("Sparkle.strings")
let stringsPath = NSString(string: dirPath.appendingPathComponent(dirEntry)).appendingPathComponent("Sparkle.strings")
let stringsDict = NSDictionary(contentsOfFile: stringsPath)
if stringsDict == nil {
die("Invalid strings file \(dirEntry)")
@@ -70,10 +70,10 @@ for dirEntry in dirContents {
var unused: [String] = []
for key in enStringsDictKeys {
let str = stringsDict?.objectForKey(key) as? String
let str = stringsDict?.object(forKey: key) as? String
if str == nil {
missing.append(key as! String)
} else if let enStr = enStringsDict?.objectForKey(key) as? String {
} else if let enStr = enStringsDict?.object(forKey: key) as? String {
if enStr == str {
unlocalized.append(key as! String)
}
@@ -82,7 +82,7 @@ for dirEntry in dirContents {
let stringsDictKeys = stringsDict!.allKeys
for key in stringsDictKeys {
if enStringsDict?.objectForKey(key) == nil {
if enStringsDict?.object(forKey: key) == nil {
unused.append(key as! String)
}
}
@@ -90,12 +90,12 @@ for dirEntry in dirContents {
let sorter = { (s1: String, s2: String) -> Bool in
return s1 < s2
}
missing.sortInPlace(sorter)
unlocalized.sortInPlace(sorter)
unused.sortInPlace(sorter)
missing.sort(by: sorter)
unlocalized.sort(by: sorter)
unused.sort(by: sorter)
let addRow = { (prefix: String, cssClass: String, key: String) -> Void in
body.addChild(NSXMLElement(name: "span", attributes: ["class": cssClass], stringValue: [prefix, key].joinWithSeparator(" ") + "\n"))
body.addChild(XMLElement(name: "span", attributes: ["class": cssClass], stringValue: [prefix, key].joined(separator: " ") + "\n"))
}
for key in missing {
@@ -110,6 +110,6 @@ for dirEntry in dirContents {
}
var err: NSError?
if !html.XMLData.writeToFile(htmlPath!, atomically: true) {
die("Can't write report: \(err)")
if !((try? html.xmlData.write(to: URL(fileURLWithPath: htmlPath!), options: [.atomic])) != nil) {
die("Can't write report: \(err!)")
}
+43
View File
@@ -0,0 +1,43 @@
//
// SPUDownloadData.h
// Sparkle
//
// Created by Mayur Pawashe on 8/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#import "SUExport.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* A class for containing downloaded data along with some information about it.
*/
SU_EXPORT @interface SPUDownloadData : NSObject <NSSecureCoding>
- (instancetype)initWithData:(NSData *)data textEncodingName:(NSString * _Nullable)textEncodingName MIMEType:(NSString * _Nullable)MIMEType;
/*!
* The raw data that was downloaded.
*/
@property (nonatomic, readonly) NSData *data;
/*!
* The IANA charset encoding name if available. Eg: "utf-8"
*/
@property (nonatomic, readonly, nullable, copy) NSString *textEncodingName;
/*!
* The MIME type if available. Eg: "text/plain"
*/
@property (nonatomic, readonly, nullable, copy) NSString *MIMEType;
@end
NS_ASSUME_NONNULL_END
+71
View File
@@ -0,0 +1,71 @@
//
// SPUDownloadData.m
// Sparkle
//
// Created by Mayur Pawashe on 8/10/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUDownloadData.h"
#include "AppKitPrevention.h"
static NSString *SPUDownloadDataKey = @"SPUDownloadData";
static NSString *SPUDownloadTextEncodingKey = @"SPUDownloadTextEncoding";
static NSString *SPUDownloadMIMETypeKey = @"SPUDownloadMIMEType";
@implementation SPUDownloadData
@synthesize data = _data;
@synthesize textEncodingName = _textEncodingName;
@synthesize MIMEType = _MIMEType;
+ (BOOL)supportsSecureCoding
{
return YES;
}
- (instancetype)initWithData:(NSData *)data textEncodingName:(NSString * _Nullable)textEncodingName MIMEType:(NSString *)MIMEType
{
self = [super init];
if (self != nil) {
_data = data;
_textEncodingName = textEncodingName;
_MIMEType = MIMEType;
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.data forKey:SPUDownloadDataKey];
if (self.textEncodingName != nil) {
[coder encodeObject:self.textEncodingName forKey:SPUDownloadTextEncodingKey];
}
if (self.MIMEType != nil) {
[coder encodeObject:self.MIMEType forKey:SPUDownloadMIMETypeKey];
}
}
- (nullable instancetype)initWithCoder:(NSCoder *)decoder
{
if (@available(macOS 10.8, *)) {
NSData *data = [decoder decodeObjectOfClass:[NSData class] forKey:SPUDownloadDataKey];
if (data == nil) {
return nil;
}
NSString *textEncodingName = [decoder decodeObjectOfClass:[NSString class] forKey:SPUDownloadTextEncodingKey];
NSString *MIMEType = [decoder decodeObjectOfClass:[NSString class] forKey:SPUDownloadMIMETypeKey];
return [self initWithData:data textEncodingName:textEncodingName MIMEType:MIMEType];
} else {
abort(); // Not used on 10.7
}
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// SPUDownloader.h
// Downloader
//
// Created by Mayur Pawashe on 4/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#import "SPUDownloaderProtocol.h"
@protocol SPUDownloaderDelegate;
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
@interface SPUDownloader : NSObject <SPUDownloaderProtocol>
// Due to XPC remote object reasons, this delegate is strongly referenced
// Invoke cleanup when done with this instance
- (instancetype)initWithDelegate:(id <SPUDownloaderDelegate>)delegate;
@end
+118
View File
@@ -0,0 +1,118 @@
//
// SPUDownloader.m
// Downloader
//
// Created by Mayur Pawashe on 4/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUDownloader.h"
#import "SPUDownloaderDelegate.h"
#import "SPULocalCacheDirectory.h"
#import "SPUURLRequest.h"
#import "SPUDownloadData.h"
#import "SUErrors.h"
#import "SPUDownloader_Private.h"
#include "AppKitPrevention.h"
@interface SPUDownloader ()
@end
@implementation SPUDownloader
@synthesize delegate = _delegate;
@synthesize bundleIdentifier = _bundleIdentifier;
@synthesize desiredFilename = _desiredFilename;
@synthesize downloadFilename = _downloadFilename;
@synthesize disabledAutomaticTermination = _disabledAutomaticTermination;
@synthesize mode = _mode;
@synthesize receivedExpectedBytes = _receivedExpectedBytes;
- (instancetype)initWithDelegate:(id <SPUDownloaderDelegate>)delegate
{
self = [super init];
if (self != nil) {
_delegate = delegate;
}
return self;
}
// Don't implement dealloc - make the client call cleanup, which is the only way to remove the reference cycle from the delegate anyway
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)__unused request bundleIdentifier:(NSString *)__unused bundleIdentifier desiredFilename:(NSString *)__unused desiredFilename
{
}
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)__unused request
{
}
- (void)enableAutomaticTermination
{
if (self.disabledAutomaticTermination) {
[[NSProcessInfo processInfo] enableAutomaticTermination:SUDownloadingReason];
self.disabledAutomaticTermination = NO;
}
}
- (void)cleanup
{
[self enableAutomaticTermination];
self.delegate = nil;
if (self.mode == SPUDownloadModeTemporary && self.downloadFilename != nil)
{
[[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:NULL];
self.downloadFilename = nil;
}
}
- (void)cancel
{
}
- (void)downloadDidFinish
{
}
-(void)downloadDidFinishWithData:(SPUDownloadData*)data
{
switch (self.mode) {
case SPUDownloadModeTemporary:
if (data != nil) {
[self.delegate downloaderDidFinishWithTemporaryDownloadData:data];
} else {
[self.delegate downloaderDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read temporary downloaded data from %@", self.downloadFilename]}]];
}
break;
case SPUDownloadModePersistent:
[self.delegate downloaderDidFinishWithTemporaryDownloadData:nil];
break;
}
}
-(NSString*)getAndCleanTempDirectory
{
NSString *rootPersistentDownloadCachePath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:self.bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootPersistentDownloadCachePath];
NSString *tempDir = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootPersistentDownloadCachePath];
if (tempDir == nil) {
// Okay, something's really broken with this user's file structure.
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.", tempDir] }];
[self.delegate downloaderDidFailWithError:error];
[self cancel];
}
return tempDir;
}
@end
+38
View File
@@ -0,0 +1,38 @@
//
// SPUDownloaderDelegate.h
// Sparkle
//
// Created by Mayur Pawashe on 4/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@class SPUDownloadData;
@protocol SPUDownloaderDelegate <NSObject>
// This is only invoked for persistent downloads
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory;
// Under rare cases, this may be called more than once, in which case the current progress should be reset back to 0
// This is only invoked for persistent downloads
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)expectedContentLength;
// This is only invoked for persistent downloads
- (void)downloaderDidReceiveDataOfLength:(uint64_t)length;
// downloadData is nil if this is a persisent download, otherwise it's non-nil if it's a temporary download
- (void)downloaderDidFinishWithTemporaryDownloadData:(SPUDownloadData * _Nullable)downloadData;
- (void)downloaderDidFailWithError:(NSError *)error;
@end
NS_ASSUME_NONNULL_END
+13
View File
@@ -0,0 +1,13 @@
//
// SPUDownloaderDeprecated.h
// Sparkle
//
// Created by Deadpikle on 12/20/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import "SPUDownloader.h"
@interface SPUDownloaderDeprecated : SPUDownloader <SPUDownloaderProtocol>
@end
+167
View File
@@ -0,0 +1,167 @@
//
// SPUDownloaderDeprecated.m
// Sparkle
//
// Created by Deadpikle on 12/20/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import "SPUDownloaderDeprecated.h"
#import "SPUURLRequest.h"
#import "SPUDownloader_Private.h"
#import "SPUDownloadData.h"
#import "SPULocalCacheDirectory.h"
#import "SUErrors.h"
#include "AppKitPrevention.h"
@interface SPUDownloaderDeprecated () <NSURLDownloadDelegate>
@property (nonatomic) NSURLDownload *download;
@property (nonatomic) NSURLResponse *response;
@end
@implementation SPUDownloaderDeprecated
@synthesize download = _download;
@synthesize response = _response;
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self.disabledAutomaticTermination = YES;
self.mode = SPUDownloadModePersistent;
self.desiredFilename = desiredFilename;
self.bundleIdentifier = bundleIdentifier;
self.download = [[NSURLDownload alloc] initWithRequest:request.request delegate:self];
}
});
}
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request
{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self.disabledAutomaticTermination = YES;
self.mode = SPUDownloadModeTemporary;
self.download = [[NSURLDownload alloc] initWithRequest:request.request delegate:self];
}
});
}
- (void)download:(NSURLDownload *)__unused d decideDestinationWithSuggestedFilename:(NSString *)name
{
if (self.mode == SPUDownloadModeTemporary) {
// Files downloaded in temporary mode should not last for very long,
// so it's ideal to place them in a system temporary directory
NSString *destinationFilename = NSTemporaryDirectory();
if (destinationFilename) {
destinationFilename = [destinationFilename stringByAppendingPathComponent:name];
[self.download setDestination:destinationFilename allowOverwrite:NO];
}
} else {
NSString *tempDir = [super getAndCleanTempDirectory];
if (tempDir != nil) {
NSString *downloadFileName = self.desiredFilename;
NSString *downloadFileNameDirectory = [tempDir stringByAppendingPathComponent:downloadFileName];
NSError *createError = nil;
if (![[NSFileManager defaultManager] createDirectoryAtPath:downloadFileNameDirectory withIntermediateDirectories:NO attributes:nil error:&createError]) {
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a download file name %@ directory inside temporary directory for the update download at %@.", downloadFileName, downloadFileNameDirectory] }];
[self.delegate downloaderDidFailWithError:error];
} else {
[self.download setDestination:[downloadFileNameDirectory stringByAppendingPathComponent:name] allowOverwrite:YES];
[self.delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory];
}
}
}
}
- (void)download:(NSURLDownload *)__unused aDownload didCreateDestination:(NSString *)path
{
self.downloadFilename = path;
}
- (void)download:(NSURLDownload *)__unused download didReceiveResponse:(NSURLResponse *)response
{
self.response = response;
if (self.mode == SPUDownloadModePersistent) {
// It might be tempting to send over the response object instead of the expected content length but this isn't a good idea
// For one, we are only ever concerned about the expected content length
// Another reason is that NSURLResponse doesn't support NSSecureCoding in older OS releases (eg: 10.8), which cause issues with XPC
[self.delegate downloaderDidReceiveExpectedContentLength:response.expectedContentLength];
}
}
- (void)download:(NSURLDownload *)__unused download didReceiveDataOfLength:(NSUInteger)length
{
if (self.mode == SPUDownloadModePersistent) {
[self.delegate downloaderDidReceiveDataOfLength:length];
}
}
- (void)downloadDidFinish:(NSURLDownload *)__unused d
{
[self downloadDidFinish];
}
- (void)download:(NSURLDownload *)__unused download didFailWithError:(NSError *)error
{
self.download = nil;
[self.delegate downloaderDidFailWithError:error];
[self cleanup];
}
- (BOOL)download:(NSURLDownload *)__unused download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
{
// We don't want the download system to extract our gzips for persistent downloads
// Note that we use a substring matching here instead of direct comparison because the docs say "application/gzip" but the system *uses* "application/x-gzip". This is a documentation bug.
return (self.mode == SPUDownloadModeTemporary || [encodingType rangeOfString:@"gzip"].location == NSNotFound);
}
- (void)downloadDidFinish
{
assert(self.response != nil);
assert(self.downloadFilename != nil);
SPUDownloadData *downloadData = nil;
if (self.mode == SPUDownloadModeTemporary) {
NSData *data = [NSData dataWithContentsOfFile:self.downloadFilename];
if (data != nil) {
downloadData = [[SPUDownloadData alloc] initWithData:data textEncodingName:self.response.textEncodingName MIMEType:self.response.MIMEType];
}
}
self.download = nil;
[super downloadDidFinishWithData:downloadData];
}
-(void)cleanup
{
[self.download cancel];
self.download = nil;
self.response = nil;
[super cleanup];
}
- (void)cancel
{
[self cleanup];
}
@end
+34
View File
@@ -0,0 +1,34 @@
//
// SPUDownloaderProtocol.h
// PersistentDownloader
//
// Created by Mayur Pawashe on 4/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@class SPUURLRequest;
// The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service.
@protocol SPUDownloaderProtocol
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename;
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request;
- (void)downloadDidFinish;
- (void)cleanup;
- (void)cancel;
@end
NS_ASSUME_NONNULL_END
+20
View File
@@ -0,0 +1,20 @@
//
// SPUDownloaderSession.h
// Sparkle
//
// Created by Deadpikle on 12/20/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#import "SPUDownloader.h"
#import "SPUDownloaderProtocol.h"
NS_CLASS_AVAILABLE(NSURLSESSION_AVAILABLE, 7_0)
@interface SPUDownloaderSession : SPUDownloader <SPUDownloaderProtocol>
@end
+166
View File
@@ -0,0 +1,166 @@
//
// SPUDownloaderSession.m
// Sparkle
//
// Created by Deadpikle on 12/20/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import "SPUDownloaderSession.h"
#import "SPUURLRequest.h"
#import "SPUDownloader_Private.h"
#import "SPULocalCacheDirectory.h"
#import "SUErrors.h"
#import "SPUDownloadData.h"
#include "AppKitPrevention.h"
@interface SPUDownloaderSession () <NSURLSessionDelegate>
@property (nonatomic) NSURLSession *downloadSession;
@property (nonatomic) NSURLSessionDownloadTask *download;
@end
@implementation SPUDownloaderSession
@synthesize downloadSession = _downloadSession;
@synthesize download = _download;
- (void)startDownloadWithRequest:(SPUURLRequest *)request
{
NSOperationQueue *queue = [NSOperationQueue mainQueue];
self.downloadSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:queue];
self.download = [self.downloadSession downloadTaskWithRequest:request.request];
[self.download resume];
}
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self.disabledAutomaticTermination = YES;
self.mode = SPUDownloadModePersistent;
self.desiredFilename = desiredFilename;
self.bundleIdentifier = bundleIdentifier;
[self startDownloadWithRequest:request];
}
});
}
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request
{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self.disabledAutomaticTermination = YES;
self.mode = SPUDownloadModeTemporary;
[self startDownloadWithRequest:request];
}
});
}
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didFinishDownloadingToURL:(NSURL *)location
{
if (self.mode == SPUDownloadModeTemporary) {
self.downloadFilename = location.path;
[self downloadDidFinish]; // file is already in a system temp dir
} else {
NSString *tempDir = [super getAndCleanTempDirectory];
if (tempDir != nil) {
NSString *downloadFileName = self.desiredFilename;
NSString *downloadFileNameDirectory = [tempDir stringByAppendingPathComponent:downloadFileName];
NSError *createError = nil;
if (![[NSFileManager defaultManager] createDirectoryAtPath:downloadFileNameDirectory withIntermediateDirectories:NO attributes:nil error:&createError]) {
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a download file name %@ directory inside temporary directory for the update download at %@.", downloadFileName, downloadFileNameDirectory] }];
[self.delegate downloaderDidFailWithError:error];
} else {
NSString *name = self.download.response.suggestedFilename;
if (!name) {
name = location.lastPathComponent; // This likely contains nothing useful to identify the file (e.g. CFNetworkDownload_87LVIz.tmp)
}
NSString *toPath = [downloadFileNameDirectory stringByAppendingPathComponent:name];
NSString *fromPath = location.path; // suppress moveItemAtPath: non-null warning
NSError *error = nil;
if ([[NSFileManager defaultManager] moveItemAtPath:fromPath toPath:toPath error:&error]) {
self.downloadFilename = toPath;
[self.delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory];
[self downloadDidFinish];
} else {
[self.delegate downloaderDidFailWithError:error];
}
}
}
}
}
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)__unused totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
{
if (self.mode == SPUDownloadModePersistent && totalBytesExpectedToWrite > 0 && !self.receivedExpectedBytes) {
self.receivedExpectedBytes = YES;
[self.delegate downloaderDidReceiveExpectedContentLength:totalBytesExpectedToWrite];
}
if (self.mode == SPUDownloadModePersistent && bytesWritten >= 0) {
[self.delegate downloaderDidReceiveDataOfLength:(uint64_t)bytesWritten];
}
}
- (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error
{
self.download = nil;
if (error) {
[self.delegate downloaderDidFailWithError:error];
}
[self cleanup];
}
- (void)downloadDidFinish
{
assert(self.downloadFilename != nil);
SPUDownloadData *downloadData = nil;
if (self.mode == SPUDownloadModeTemporary) {
NSData *data = [NSData dataWithContentsOfFile:self.downloadFilename];
if (data != nil) {
NSURLResponse *response = self.download.response;
assert(response != nil);
downloadData = [[SPUDownloadData alloc] initWithData:data textEncodingName:response.textEncodingName MIMEType:response.MIMEType];
}
}
self.download = nil;
[super downloadDidFinishWithData:downloadData];
}
-(void)cleanup
{
[self.download cancel];
self.download = nil;
self.downloadSession = nil;
[super cleanup];
}
- (void)cancel
{
[self cleanup];
}
// NSURLDownload has a [downlaod:shouldDecodeSourceDataOfMIMEType:] to determine if the data should be decoded.
// This does not exist for NSURLSessionDownloadTask and appears unnecessary. Data tasks will decode data, but not download tasks.
@end
+41
View File
@@ -0,0 +1,41 @@
//
// SPUDownloader_Private.h
// Sparkle
//
// Created by Deadpikle on 12/20/17.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#ifndef SPUDownloader_Private_h
#define SPUDownloader_Private_h
#import "SPUDownloaderDelegate.h"
typedef NS_ENUM(NSUInteger, SPUDownloadMode)
{
SPUDownloadModePersistent,
SPUDownloadModeTemporary
};
static NSString *SUDownloadingReason = @"Downloading update related file";
@interface SPUDownloader ()
// Delegate is intentionally strongly referenced; see header
@property (nonatomic) id <SPUDownloaderDelegate> delegate;
@property (nonatomic, copy) NSString *bundleIdentifier;
@property (nonatomic, copy) NSString *desiredFilename;
@property (nonatomic, copy) NSString *downloadFilename;
@property (nonatomic) BOOL disabledAutomaticTermination;
@property (nonatomic) SPUDownloadMode mode;
@property (nonatomic) BOOL receivedExpectedBytes;
// returns temp directory location if successful; if not successful,
// returns nil after sending error message to client and canceling download
-(NSString*)getAndCleanTempDirectory;
-(void)downloadDidFinishWithData:(SPUDownloadData*)data;
@end
#endif /* SPUDownloader_Private_h */
+35
View File
@@ -0,0 +1,35 @@
//
// SULocalCacheDirectory.h
// Sparkle
//
// Created by Mayur Pawashe on 6/23/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SPULocalCacheDirectory : NSObject
// Returns a path to a suitable cache directory to create specifically for Sparkle
// Intermediate directories to this path may not exist yet
// This path may depend on the type of running process,
// such that sandboxed vs non-sandboxed processes could yield different paths
// The caller should create a subdirectory from the path that is returned here so they don't have files that
// conflict with other callers. Once that subdirectory name is decided, the caller can remove old items inside it (using +removeOldItemsInDirectory:)
// and then create a unique temporary directory inside it (using +createUniqueDirectoryInDirectory:)
+ (NSString *)cachePathForBundleIdentifier:(NSString *)bundleIdentifier;
// Remove old files inside a directory
// A caller may want to invoke this on a directory they own rather than remove and re-create an entire directory
// This does nothing if the supplied directory does not exist yet
+ (void)removeOldItemsInDirectory:(NSString *)directory;
// Create a unique directory inside a parent directory
// The parent directory doesn't have to exist yet. If it doesn't exist, intermediate directories will be created.
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory;
@end
NS_ASSUME_NONNULL_END
+80
View File
@@ -0,0 +1,80 @@
//
// SULocalCacheDirectory.m
// Sparkle
//
// Created by Mayur Pawashe on 6/23/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPULocalCacheDirectory.h"
#import "SULog.h"
#include "AppKitPrevention.h"
static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days
@implementation SPULocalCacheDirectory
// It is important to note this may return a different path whether invoked from a sanboxed vs non-sandboxed process, or from a different user
// For this reason, this method should not be a part of SUHost because its behavior depends on what kind of process it's being invoked from
+ (NSString *)cachePathForBundleIdentifier:(NSString *)bundleIdentifier
{
NSURL *cacheURL = [[NSFileManager defaultManager] URLForDirectory:NSCachesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:NULL];
assert(cacheURL != nil);
NSString *resultPath = [[[cacheURL URLByAppendingPathComponent:bundleIdentifier] URLByAppendingPathComponent:@SPARKLE_BUNDLE_IDENTIFIER] path];
assert(resultPath != nil);
return resultPath;
}
+ (void)removeOldItemsInDirectory:(NSString *)directory
{
NSMutableArray<NSString *> *filePathsToRemove = [NSMutableArray array];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:directory]) {
NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:directory];
NSDate *currentDate = [NSDate date];
for (NSString *filename in directoryEnumerator)
{
NSDictionary<NSString *, id> *fileAttributes = [fileManager attributesOfItemAtPath:[directory stringByAppendingPathComponent:filename] error:NULL];
if (fileAttributes != nil)
{
NSDate *lastModificationDate = [fileAttributes objectForKey:NSFileModificationDate];
if ([currentDate timeIntervalSinceDate:lastModificationDate] >= OLD_ITEM_DELETION_INTERVAL)
{
[filePathsToRemove addObject:[directory stringByAppendingPathComponent:filename]];
}
}
[directoryEnumerator skipDescendants];
}
for (NSString *filename in filePathsToRemove)
{
[fileManager removeItemAtPath:filename error:NULL];
}
}
}
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *createError = nil;
if (![fileManager createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:&createError]) {
SULog(SULogLevelError, @"Failed to create directory with intermediate components at %@ with error %@", directory, createError);
return nil;
}
NSString *templateString = [directory stringByAppendingPathComponent:@"XXXXXXXXX"];
char buffer[PATH_MAX] = {0};
if ([templateString getFileSystemRepresentation:buffer maxLength:sizeof(buffer)]) {
if (mkdtemp(buffer) != NULL) {
return [[NSString alloc] initWithUTF8String:buffer];
}
}
return nil;
}
@end
+35
View File
@@ -0,0 +1,35 @@
//
// SPUURLRequest.h
// Sparkle
//
// Created by Mayur Pawashe on 5/19/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
NS_ASSUME_NONNULL_BEGIN
// A class that wraps NSURLRequest and implements NSSecureCoding
// This class exists because NSURLRequest did not support NSSecureCoding in macOS 10.8
// I have not verified if NSURLRequest in 10.9 implements NSSecureCoding or not
@interface SPUURLRequest : NSObject <NSSecureCoding>
// Creates a new URL request
// Only these properties are currently tracked:
// * URL
// * Cache policy
// * Timeout interval
// * HTTP header fields
// * networkServiceType
+ (instancetype)URLRequestWithRequest:(NSURLRequest *)request;
@property (nonatomic, readonly) NSURLRequest *request;
@end
NS_ASSUME_NONNULL_END
+98
View File
@@ -0,0 +1,98 @@
//
// SPUURLRequest.m
// Sparkle
//
// Created by Mayur Pawashe on 5/19/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SPUURLRequest.h"
#include "AppKitPrevention.h"
static NSString *SPUURLRequestURLKey = @"SPUURLRequestURL";
static NSString *SPUURLRequestCachePolicyKey = @"SPUURLRequestCachePolicy";
static NSString *SPUURLRequestTimeoutIntervalKey = @"SPUURLRequestTimeoutInterval";
static NSString *SPUURLRequestHttpHeaderFieldsKey = @"SPUURLRequestHttpHeaderFields";
static NSString *SPUURLRequestNetworkServiceTypeKey = @"SPUURLRequestNetworkServiceType";
@interface SPUURLRequest ()
@property (nonatomic, readonly) NSURL *url;
@property (nonatomic, readonly) NSURLRequestCachePolicy cachePolicy;
@property (nonatomic, readonly) NSTimeInterval timeoutInterval;
@property (nonatomic, readonly, nullable) NSDictionary<NSString *, NSString *> *httpHeaderFields;
@property (nonatomic, readonly) NSURLRequestNetworkServiceType networkServiceType;
@end
@implementation SPUURLRequest
@synthesize url = _url;
@synthesize cachePolicy = _cachePolicy;
@synthesize timeoutInterval = _timeoutInterval;
@synthesize httpHeaderFields = _httpHeaderFields;
@synthesize networkServiceType = _networkServiceType;
- (instancetype)initWithURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval httpHeaderFields:(NSDictionary<NSString *, NSString *> *)httpHeaderFields networkServiceType:(NSURLRequestNetworkServiceType)networkServiceType
{
self = [super init];
if (self != nil) {
_url = url;
_cachePolicy = cachePolicy;
_timeoutInterval = timeoutInterval;
_httpHeaderFields = httpHeaderFields;
_networkServiceType = networkServiceType;
}
return self;
}
+ (instancetype)URLRequestWithRequest:(NSURLRequest *)request
{
return [(SPUURLRequest *)[[self class] alloc] initWithURL:request.URL cachePolicy:request.cachePolicy timeoutInterval:request.timeoutInterval httpHeaderFields:request.allHTTPHeaderFields networkServiceType:request.networkServiceType];
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:self.url forKey:SPUURLRequestURLKey];
[coder encodeInteger:self.cachePolicy forKey:SPUURLRequestCachePolicyKey];
[coder encodeDouble:self.timeoutInterval forKey:SPUURLRequestTimeoutIntervalKey];
[coder encodeInteger:self.networkServiceType forKey:SPUURLRequestNetworkServiceTypeKey];
if (self.httpHeaderFields != nil) {
[coder encodeObject:self.httpHeaderFields forKey:SPUURLRequestHttpHeaderFieldsKey];
}
}
- (instancetype)initWithCoder:(NSCoder *)decoder
{
if (@available(macOS 10.8, *)) {
NSURL *url = [decoder decodeObjectOfClass:[NSURL class] forKey:SPUURLRequestURLKey];
NSURLRequestCachePolicy cachePolicy = (NSURLRequestCachePolicy)[decoder decodeIntegerForKey:SPUURLRequestCachePolicyKey];
NSTimeInterval timeoutInterval = [decoder decodeDoubleForKey:SPUURLRequestTimeoutIntervalKey];
NSDictionary<NSString *, NSString *> *httpHeaderFields = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [NSString class]]] forKey:SPUURLRequestHttpHeaderFieldsKey];
NSURLRequestNetworkServiceType networkServiceType = (NSURLRequestNetworkServiceType)[decoder decodeIntegerForKey:SPUURLRequestNetworkServiceTypeKey];
return [self initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval httpHeaderFields:httpHeaderFields networkServiceType:networkServiceType];
} else {
abort(); // Not used on 10.7
}
}
- (NSURLRequest *)request
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.url cachePolicy:self.cachePolicy timeoutInterval:self.timeoutInterval];
if (self.httpHeaderFields != nil) {
request.allHTTPHeaderFields = self.httpHeaderFields;
}
request.networkServiceType = self.networkServiceType;
return [request copy];
}
@end
+2 -7
View File
@@ -19,17 +19,12 @@
NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem;
SU_EXPORT @interface SUAppcast : NSObject<NSURLDownloadDelegate>
SU_EXPORT @interface SUAppcast : NSObject
@property (copy, nullable) NSString *userAgentString;
#if __has_feature(objc_generics)
@property (copy, nullable) NSDictionary<NSString *, NSString *> *httpHeaders;
#else
@property (copy, nullable) NSDictionary *httpHeaders;
#endif
- (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *_Nullable))err;
- (void)fetchAppcastFromURL:(NSURL *)url inBackground:(BOOL)bg completionBlock:(void (^)(NSError *_Nullable))err;
- (SUAppcast *)copyWithoutDeltaUpdates;
@property (readonly, copy, nullable) NSArray *items;
+77 -52
View File
@@ -12,6 +12,12 @@
#import "SULocalizations.h"
#import "SUErrors.h"
#import "SPUURLRequest.h"
#import "SUOperatingSystem.h"
#import "SPUDownloadData.h"
#import "SPUDownloaderDelegate.h"
#import "SPUDownloaderDeprecated.h"
#import "SPUDownloaderSession.h"
#include "AppKitPrevention.h"
@@ -39,29 +45,33 @@
}
@end
@interface SUAppcast () <NSURLDownloadDelegate>
@interface SUAppcast () <SPUDownloaderDelegate>
@property (strong) void (^completionBlock)(NSError *);
@property (copy) NSString *downloadFilename;
@property (strong) NSURLDownload *download;
@property (strong) SPUDownloader *download;
@property (copy) NSArray *items;
- (void)reportError:(NSError *)error;
- (NSXMLNode *)bestNodeInNodes:(NSArray *)nodes;
@end
@implementation SUAppcast
@synthesize downloadFilename;
@synthesize completionBlock;
@synthesize userAgentString;
@synthesize httpHeaders;
@synthesize download;
@synthesize items;
- (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *))block
- (void)fetchAppcastFromURL:(NSURL *)url inBackground:(BOOL)background completionBlock:(void (^)(NSError *))block
{
self.completionBlock = block;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
if (background) {
request.networkServiceType = NSURLNetworkServiceTypeBackground;
}
if (self.userAgentString) {
[request setValue:self.userAgentString forHTTPHeaderField:@"User-Agent"];
}
@@ -75,49 +85,74 @@
[request setValue:@"application/rss+xml,*/*;q=0.1" forHTTPHeaderField:@"Accept"];
self.download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
}
- (void)download:(NSURLDownload *)__unused aDownload decideDestinationWithSuggestedFilename:(NSString *)filename
{
NSString *destinationFilename = NSTemporaryDirectory();
if (destinationFilename)
{
destinationFilename = [destinationFilename stringByAppendingPathComponent:filename];
[self.download setDestination:destinationFilename allowOverwrite:NO];
if ([SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 9, 0}]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
self.download = [[SPUDownloaderSession alloc] initWithDelegate:self];
#pragma clang diagnostic pop
}
else {
self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self];
}
SPUURLRequest *urlRequest = [SPUURLRequest URLRequestWithRequest:request];
[self.download startTemporaryDownloadWithRequest:urlRequest];
}
- (void)download:(NSURLDownload *)__unused aDownload didCreateDestination:(NSString *)path
- (void)downloaderDidSetDestinationName:(NSString *)__unused destinationName temporaryDirectory:(NSString *)__unused temporaryDirectory
{
self.downloadFilename = path;
}
- (void)downloadDidFinish:(NSURLDownload *)__unused aDownload
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)__unused expectedContentLength
{
NSError *error = nil;
NSArray *appcastItems = [self parseAppcastItemsFromXMLFile:[NSURL fileURLWithPath:self.downloadFilename] error:&error];
}
[[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:nil];
self.downloadFilename = nil;
- (void)downloaderDidReceiveDataOfLength:(uint64_t)__unused length
{
}
if (appcastItems) {
self.items = appcastItems;
self.completionBlock(nil);
self.completionBlock = nil;
} else {
NSMutableDictionary *userInfo = [NSMutableDictionary
dictionaryWithObject: SULocalizedString(@"An error occurred while parsing the update feed.", nil)
forKey: NSLocalizedDescriptionKey];
if (error) {
[userInfo setObject:error forKey:NSUnderlyingErrorKey];
- (void)downloaderDidFinishWithTemporaryDownloadData:(SPUDownloadData * _Nullable)downloadData
{
if (downloadData != nil) {
NSError *parseError = nil;
NSArray *appcastItems = [self parseAppcastItemsFromXMLData:downloadData.data error:&parseError];
if (appcastItems != nil) {
self.items = appcastItems;
self.completionBlock(nil);
self.completionBlock = nil;
} else {
NSMutableDictionary *userInfo = [NSMutableDictionary
dictionaryWithObject: SULocalizedString(@"An error occurred while parsing the update feed.", nil)
forKey: NSLocalizedDescriptionKey];
if (parseError != nil) {
[userInfo setObject:parseError forKey:NSUnderlyingErrorKey];
}
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain
code:SUAppcastParseError
userInfo:userInfo]];
}
} else {
SULog(SULogLevelError, @"Temp data download is null in SUAppcast");
NSDictionary *userInfo = [NSDictionary
dictionaryWithObject: SULocalizedString(@"An error occurred while downloading the update feed.", nil)
forKey: NSLocalizedDescriptionKey];
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain
code:SUAppcastParseError
code:SUDownloadError
userInfo:userInfo]];
}
}
- (void)downloaderDidFailWithError:(NSError *)error
{
SULog(SULogLevelError, @"Encountered download feed error: %@", error);
[self reportError:error];
}
- (NSDictionary *)attributesOfNode:(NSXMLElement *)node
{
NSEnumerator *attributeEnum = [[node attributes] objectEnumerator];
@@ -148,17 +183,22 @@
}
}
-(NSArray *)parseAppcastItemsFromXMLFile:(NSURL *)appcastFile error:(NSError *__autoreleasing*)errorp {
-(NSArray *)parseAppcastItemsFromXMLFile:(NSURL *)appcastURL error:(NSError *__autoreleasing*)errorp {
NSData *data = [NSData dataWithContentsOfURL:appcastURL];
return [self parseAppcastItemsFromXMLData:data error:errorp];
}
-(NSArray *)parseAppcastItemsFromXMLData:(NSData *)appcastData error:(NSError *__autoreleasing*)errorp {
if (errorp) {
*errorp = nil;
}
if (!appcastFile) {
if (!appcastData) {
return nil;
}
NSUInteger options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file://
NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:appcastFile options:options error:errorp];
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:appcastData options:options error:errorp];
if (nil == document) {
return nil;
}
@@ -245,7 +285,7 @@
[appcastItems addObject:anItem];
}
else {
SULog(@"Sparkle Updater: Failed to parse appcast item: %@.\nAppcast dictionary was: %@", errString, dict);
SULog(SULogLevelError, @"Sparkle Updater: Failed to parse appcast item: %@.\nAppcast dictionary was: %@", errString, dict);
if (errorp) *errorp = [NSError errorWithDomain:SUSparkleErrorDomain
code:SUAppcastParseError
userInfo:@{NSLocalizedDescriptionKey: errString}];
@@ -258,21 +298,6 @@
return appcastItems;
}
- (void)download:(NSURLDownload *)__unused aDownload didFailWithError:(NSError *)error
{
if (self.downloadFilename) {
[[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:nil];
}
self.downloadFilename = nil;
[self reportError:error];
}
- (NSURLRequest *)download:(NSURLDownload *)__unused aDownload willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)__unused redirectResponse
{
return request;
}
- (void)reportError:(NSError *)error
{
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{
+2
View File
@@ -27,6 +27,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject
@property (strong, readonly) NSURL *fileURL;
@property (nonatomic, readonly) uint64_t contentLength;
@property (copy, readonly) NSString *versionString;
@property (copy, readonly) NSString *osString;
@property (copy, readonly) NSString *displayVersionString;
@property (copy, readonly) NSDictionary *deltaUpdates;
@property (strong, readonly) NSURL *infoURL;
@@ -37,6 +38,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject
@property (getter=isDeltaUpdate, readonly) BOOL deltaUpdate;
@property (getter=isCriticalUpdate, readonly) BOOL criticalUpdate;
@property (getter=isMacOsUpdate, readonly) BOOL macOsUpdate;
@property (getter=isInformationOnlyUpdate, readonly) BOOL informationOnlyUpdate;
// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
+14 -6
View File
@@ -23,6 +23,7 @@
@property (copy, readwrite) NSString *maximumSystemVersion;
@property (strong, readwrite) NSURL *fileURL;
@property (copy, readwrite) NSString *versionString;
@property (copy, readwrite) NSString *osString;
@property (copy, readwrite) NSString *displayVersionString;
@property (copy, readwrite) NSDictionary *deltaUpdates;
@property (strong, readwrite) NSURL *infoURL;
@@ -43,6 +44,7 @@
@synthesize releaseNotesURL;
@synthesize title;
@synthesize versionString;
@synthesize osString;
@synthesize propertiesDictionary;
- (BOOL)isDeltaUpdate
@@ -53,7 +55,12 @@
- (BOOL)isCriticalUpdate
{
return [[self.propertiesDictionary objectForKey:SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate];
return [(NSArray *)[self.propertiesDictionary objectForKey:SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate];
}
- (BOOL)isMacOsUpdate
{
return self.osString == nil || [self.osString isEqualToString:SUAppcastAttributeValueMacOS];
}
- (BOOL)isInformationOnlyUpdate
@@ -86,11 +93,11 @@
}
if (newVersion == nil) // no sparkle:version attribute anywhere?
{
SULog(@"warning: <%@> for URL '%@' is missing %@ attribute. Version comparison may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SUAppcastAttributeVersion, SUAppcastAttributeVersion);
SULog(SULogLevelError, @"warning: <%@> for URL '%@' is missing %@ attribute. Version comparison may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SUAppcastAttributeVersion, SUAppcastAttributeVersion);
// Separate the url by underscores and take the last component, as that'll be closest to the end,
// then we remove the extension. Hopefully, this will be the version.
NSArray *fileComponents = [[enclosure objectForKey:SURSSAttributeURL] componentsSeparatedByString:@"_"];
NSArray<NSString *> *fileComponents = [(NSString *)[enclosure objectForKey:SURSSAttributeURL] componentsSeparatedByString:@"_"];
if ([fileComponents count] > 1) {
newVersion = [[fileComponents lastObject] stringByDeletingPathExtension];
}
@@ -111,7 +118,7 @@
NSString *theInfoURL = [dict objectForKey:SURSSElementLink];
if (theInfoURL) {
if (![theInfoURL isKindOfClass:[NSString class]]) {
SULog(@"%@ -%@ Info URL is not of valid type.", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
SULog(SULogLevelError, @"%@ -%@ Info URL is not of valid type.", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
} else {
self.infoURL = [NSURL URLWithString:theInfoURL];
}
@@ -150,8 +157,9 @@
}
if (enclosure) {
self.DSASignature = [enclosure objectForKey:SUAppcastAttributeDSASignature];
self.osString = [enclosure objectForKey:SUAppcastAttributeOsType];
}
self.versionString = newVersion;
self.minimumSystemVersion = [dict objectForKey:SUAppcastElementMinimumSystemVersion];
self.maximumSystemVersion = [dict objectForKey:SUAppcastElementMaximumSystemVersion];
@@ -172,7 +180,7 @@
if (releaseNotesString) {
NSURL *url = [NSURL URLWithString:releaseNotesString];
if ([url isFileURL]) {
SULog(@"Release notes with file:// URLs are not supported");
SULog(SULogLevelError, @"Release notes with file:// URLs are not supported");
} else {
self.releaseNotesURL = url;
}
+3 -1
View File
@@ -10,11 +10,13 @@
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@interface SUApplicationInfo : NSObject
+ (BOOL)isBackgroundApplication:(NSApplication *)application;
+ (NSImage *)bestIconForBundle:(NSBundle *)bundle;
+ (NSImage *)bestIconForHost:(SUHost *)host;
@end
+4 -3
View File
@@ -8,6 +8,7 @@
#import "SUApplicationInfo.h"
#import "SUBundleIcon.h"
#import "SUHost.h"
@implementation SUApplicationInfo
@@ -16,16 +17,16 @@
return (application.activationPolicy == NSApplicationActivationPolicyAccessory);
}
+ (NSImage *)bestIconForBundle:(NSBundle *)bundle
+ (NSImage *)bestIconForHost:(SUHost *)host
{
NSURL *iconURL = [SUBundleIcon iconURLForBundle:bundle];
NSURL *iconURL = [SUBundleIcon iconURLForHost:host];
NSImage *icon = (iconURL == nil) ? nil : [[NSImage alloc] initWithContentsOfURL:iconURL];
// Use a default icon if none is defined.
if (!icon) {
// this asumption may not be correct (eg. even though we're not the main bundle, it could be still be a regular app)
// but still better than nothing if no icon was included
BOOL isMainBundle = (bundle == [NSBundle mainBundle]);
BOOL isMainBundle = [host.bundle isEqualTo:[NSBundle mainBundle]];
NSString *fileType = isMainBundle ? (__bridge NSString *)kUTTypeApplication : (__bridge NSString *)kUTTypeBundle;
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
+41 -2
View File
@@ -11,17 +11,28 @@
#import "SUAppcastItem.h"
#import "SUApplicationInfo.h"
#import "SUHost.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
@interface SUAutomaticUpdateAlert ()
static NSString *const SUAutomaticUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUAutomaticUpdateAlert";
@interface SUAutomaticUpdateAlert () <NSTouchBarDelegate>
@property (strong) void(^completionBlock)(SUAutomaticInstallationChoice);
@property (strong) SUAppcastItem *updateItem;
@property (strong) SUHost *host;
@property (weak) IBOutlet NSButton *skipButton;
@property (weak) IBOutlet NSButton *laterButton;
@property (weak) IBOutlet NSButton *installButton;
@end
@implementation SUAutomaticUpdateAlert
@synthesize host;
@synthesize updateItem;
@synthesize completionBlock;
@synthesize skipButton;
@synthesize laterButton;
@synthesize installButton;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUAutomaticInstallationChoice))block
{
@@ -31,6 +42,7 @@
self.completionBlock = block;
self.host = aHost;
[self setShouldCascadeWindows:NO];
[[self window] center];
}
return self;
@@ -59,9 +71,17 @@
self.completionBlock = nil;
}
- (void)windowDidLoad
{
if ([self.updateItem isCriticalUpdate]) {
self.skipButton.enabled = NO;
}
}
- (NSImage *__nonnull)applicationIcon
{
return [SUApplicationInfo bestIconForBundle:self.host.bundle];
return [SUApplicationInfo bestIconForHost:self.host];
}
- (NSString *__nonnull)titleText
@@ -88,4 +108,23 @@
}
}
- (NSTouchBar *)makeTouchBar
{
NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init];
touchBar.defaultItemIdentifiers = @[SUAutomaticUpdateAlertTouchBarIndentifier,];
touchBar.principalItemIdentifier = SUAutomaticUpdateAlertTouchBarIndentifier;
touchBar.delegate = self;
return touchBar;
}
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macos(10.12.2))
{
if ([identifier isEqualToString:SUAutomaticUpdateAlertTouchBarIndentifier]) {
NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier];
item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.installButton, self.laterButton, self.skipButton]];
return item;
}
return nil;
}
@end
+4 -20
View File
@@ -29,7 +29,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
@interface SUAutomaticUpdateDriver ()
@property (assign) BOOL postponingInstallation;
@property (assign) BOOL showErrors;
@property (assign) BOOL willUpdateOnTermination;
@property (assign) BOOL isTerminating;
@property (strong) SUAutomaticUpdateAlert *alert;
@@ -40,7 +39,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
@implementation SUAutomaticUpdateDriver
@synthesize postponingInstallation;
@synthesize showErrors;
@synthesize willUpdateOnTermination;
@synthesize isTerminating;
@synthesize alert;
@@ -121,6 +119,10 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
return NO;
}
-(BOOL)downloadsUpdatesInBackground {
return YES;
}
- (void)stopUpdatingOnTermination
{
if (self.willUpdateOnTermination)
@@ -198,7 +200,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
[self stopUpdatingOnTermination];
}
self.showErrors = YES;
[super installWithToolAndRelaunch:relaunch displayingUserInterface:showUI];
}
@@ -227,21 +228,4 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
}
}
- (void)abortUpdateWithError:(NSError *)error
{
if (self.showErrors) {
[super abortUpdateWithError:error];
} else {
// Call delegate separately here because otherwise it won't know we stopped.
// Normally this gets called by the superclass
id<SUUpdaterPrivate> updater = self.updater;
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didAbortWithError:)]) {
[updaterDelegate updater:self.updater didAbortWithError:error];
}
[self abortUpdate];
}
}
@end
+11 -6
View File
@@ -10,12 +10,14 @@
#define SUBASICUPDATEDRIVER_H
#import "SUUpdateDriver.h"
#import "SPUDownloader.h"
#import "SPUDownloaderDelegate.h"
@class SUAppcast, SUAppcastItem, SUHost;
@interface SUBasicUpdateDriver : SUUpdateDriver <NSURLDownloadDelegate>
@class SUAppcast, SUAppcastItem, SUHost, SPUDownloadData;
@interface SUBasicUpdateDriver : SUUpdateDriver <SPUDownloaderDelegate>
@property (strong, readonly) SUAppcastItem *updateItem;
@property (strong, readonly) NSURLDownload *download;
@property (strong, readonly) SPUDownloader *download;
@property (copy, readonly) NSString *downloadPath;
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
@@ -29,9 +31,12 @@
- (void)didNotFindUpdate;
- (void)downloadUpdate;
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name;
- (void)downloadDidFinish:(NSURLDownload *)d;
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error;
// SPUDownloaderDelegate
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory;
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)expectedContentLength;
- (void)downloaderDidReceiveDataOfLength:(uint64_t)length;
- (void)downloaderDidFinishWithTemporaryDownloadData:(SPUDownloadData *)downloadData;
- (void)downloaderDidFailWithError:(NSError *)error;
- (void)extractUpdate;
- (void)failedToApplyDeltaUpdate;
+104 -60
View File
@@ -25,10 +25,14 @@
#import "SUAppcast.h"
#import "SUAppcastItem.h"
#import "SPUURLRequest.h"
#import "SPUDownloaderDeprecated.h"
#import "SPUDownloaderSession.h"
@interface SUBasicUpdateDriver ()
@property (strong) SUAppcastItem *updateItem;
@property (strong) NSURLDownload *download;
@property (strong) SPUDownloader *download;
@property (copy) NSString *downloadPath;
@property (strong) SUAppcastItem *nonDeltaUpdateItem;
@@ -56,7 +60,7 @@
[super checkForUpdatesAtURL:URL host:aHost];
if ([aHost isRunningOnReadOnlyVolume])
{
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again.", nil), [aHost name]] }]];
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", nil), [aHost name]] }]];
return;
}
@@ -65,7 +69,7 @@
id<SUUpdaterPrivate> updater = self.updater;
[appcast setUserAgentString:[updater userAgentString]];
[appcast setHttpHeaders:[updater httpHeaders]];
[appcast fetchAppcastFromURL:URL completionBlock:^(NSError *error) {
[appcast fetchAppcastFromURL:URL inBackground:self.downloadsAppcastInBackground completionBlock:^(NSError *error) {
if (error) {
[self abortUpdateWithError:error];
} else {
@@ -115,12 +119,15 @@
+ (BOOL)hostSupportsItem:(SUAppcastItem *)ui
{
BOOL osOK = [ui isMacOsUpdate];
if (([ui minimumSystemVersion] == nil || [[ui minimumSystemVersion] isEqualToString:@""]) &&
([ui maximumSystemVersion] == nil || [[ui maximumSystemVersion] isEqualToString:@""])) { return YES; }
([ui maximumSystemVersion] == nil || [[ui maximumSystemVersion] isEqualToString:@""])) {
return osOK;
}
BOOL minimumVersionOK = TRUE;
BOOL maximumVersionOK = TRUE;
id<SUVersionComparison> versionComparator = [[SUStandardVersionComparator alloc] init];
// Check minimum and maximum System Version
@@ -131,7 +138,7 @@
maximumVersionOK = [versionComparator compareVersion:[ui maximumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending;
}
return minimumVersionOK && maximumVersionOK;
return minimumVersionOK && maximumVersionOK && osOK;
}
- (BOOL)isItemNewer:(SUAppcastItem *)ui
@@ -189,10 +196,10 @@
if ([self itemContainsValidUpdate:item]) {
self.updateItem = item;
[self didFindValidUpdate];
[self performSelectorOnMainThread:@selector(didFindValidUpdate) withObject:nil waitUntilDone:NO];
} else {
self.updateItem = nil;
[self didNotFindUpdate];
[self performSelectorOnMainThread:@selector(didNotFindUpdate) withObject:nil waitUntilDone:NO];
}
}
@@ -237,7 +244,7 @@
cachePath = [cachePaths objectAtIndex:0];
}
if (!cachePath) {
SULog(@"Failed to find user's cache directory! Using system default");
SULog(SULogLevelError, @"Failed to find user's cache directory! Using system default");
cachePath = NSTemporaryDirectory();
}
@@ -253,58 +260,73 @@
- (void)downloadUpdate
{
NSString *bundleIdentifier = self.host.bundle.bundleIdentifier;
assert(bundleIdentifier != nil);
// Clear cache directory so that downloads can't possibly accumulate inside
NSString *appCachePath = [self appCachePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:appCachePath]) {
[[NSFileManager defaultManager] removeItemAtPath:appCachePath error:NULL];
}
id<SUUpdaterPrivate> updater = self.updater;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self.updateItem fileURL]];
if (self.downloadsUpdatesInBackground) {
request.networkServiceType = NSURLNetworkServiceTypeBackground;
}
[request setValue:[updater userAgentString] forHTTPHeaderField:@"User-Agent"];
if ([[updater delegate] respondsToSelector:@selector(updater:willDownloadUpdate:withRequest:)]) {
[[updater delegate] updater:self.updater
willDownloadUpdate:self.updateItem
withRequest:request];
}
self.download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
if ([SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 9, 0}]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
self.download = [[SPUDownloaderSession alloc] initWithDelegate:self];
#pragma clang diagnostic pop
}
else {
self.download = [[SPUDownloaderDeprecated alloc] initWithDelegate:self];
}
SPUURLRequest *urlRequest = [SPUURLRequest URLRequestWithRequest:request];
NSString *desiredFilename = [NSString stringWithFormat:@"%@ %@", [self.host name], [self.updateItem versionString]];
[self.download startPersistentDownloadWithRequest:urlRequest bundleIdentifier:bundleIdentifier desiredFilename:desiredFilename];
}
- (void)download:(NSURLDownload *)__unused d decideDestinationWithSuggestedFilename:(NSString *)name
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory
{
NSString *downloadFileName = [NSString stringWithFormat:@"%@ %@", [self.host name], [self.updateItem versionString]];
NSString *appCachePath = [self appCachePath];
self.tempDir = [appCachePath stringByAppendingPathComponent:downloadFileName];
int cnt = 1;
while ([[NSFileManager defaultManager] fileExistsAtPath:self.tempDir] && cnt <= 999)
{
self.tempDir = [appCachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", downloadFileName, cnt++]];
}
// Create the temporary directory if necessary.
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:self.tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
if (!success)
{
// Okay, something's really broken with this user's file structure.
[self.download cancel];
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.", self.tempDir] }]];
}
self.downloadPath = [self.tempDir stringByAppendingPathComponent:name];
[self.download setDestination:self.downloadPath allowOverwrite:YES];
self.tempDir = temporaryDirectory;
self.downloadPath = [temporaryDirectory stringByAppendingPathComponent:destinationName];
}
- (void)downloadDidFinish:(NSURLDownload *)__unused d
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)__unused expectedContentLength
{
// don't need to do anything here as there's no GUI with this driver (there can be with child classes)
}
- (void)downloaderDidReceiveDataOfLength:(uint64_t)__unused length
{
// don't need do anything here as there's no GUI with this driver (there can be with child classes)
}
- (void)downloaderDidFinishWithTemporaryDownloadData:(SPUDownloadData * _Nullable)__unused downloadData
{
// finished. downloadData should be nil as this was a permanent download
assert(self.updateItem);
id<SUUpdaterPrivate> updater = self.updater;
if ([[updater delegate] respondsToSelector:@selector(updater:didDownloadUpdate:)]) {
[[updater delegate] updater:self.updater didDownloadUpdate:self.updateItem];
}
[self extractUpdate];
}
- (void)download:(NSURLDownload *)__unused download didFailWithError:(NSError *)error
- (void)downloaderDidFailWithError:(NSError *)error
{
NSURL *failingUrl = [error.userInfo objectForKey:NSURLErrorFailingURLErrorKey];
if (!failingUrl) {
@@ -312,31 +334,24 @@
}
id<SUUpdaterPrivate> updater = self.updater;
if ([[updater delegate] respondsToSelector:@selector(updater:failedToDownloadUpdate:error:)]) {
[[updater delegate] updater:self.updater
failedToDownloadUpdate:self.updateItem
error:error];
failedToDownloadUpdate:self.updateItem
error:error];
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil),
NSUnderlyingErrorKey: error,
}];
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil),
NSUnderlyingErrorKey: error,
}];
if (failingUrl) {
[userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey];
}
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:userInfo]];
}
- (BOOL)download:(NSURLDownload *)__unused download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
{
// We don't want the download system to extract our gzips.
// Note that we use a substring matching here instead of direct comparison because the docs say "application/gzip" but the system *uses* "application/x-gzip". This is a documentation bug.
return ([encodingType rangeOfString:@"gzip"].location == NSNotFound);
}
- (void)extractUpdate
{
id<SUUpdaterPrivate> updater = self.updater;
@@ -344,7 +359,7 @@
BOOL success;
if (!unarchiver) {
SULog(@"Error: No valid unarchiver for %@!", self.downloadPath);
SULog(SULogLevelError, @"Error: No valid unarchiver for %@!", self.downloadPath);
success = NO;
} else {
@@ -360,13 +375,20 @@
NSError *reason = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{NSLocalizedDescriptionKey: @"Failed to extract update."}];
[self unarchiverDidFailWithError:reason];
} else {
if ([[updater delegate] respondsToSelector:@selector(updater:willExtractUpdate:)]) {
[[updater delegate] updater:self.updater willExtractUpdate:self.updateItem];
}
[unarchiver unarchiveWithCompletionBlock:^(NSError *err){
if (err) {
[self unarchiverDidFailWithError:err];
return;
}
if ([[updater delegate] respondsToSelector:@selector(updater:didExtractUpdate:)]) {
[[updater delegate] updater:self.updater didExtractUpdate:self.updateItem];
}
[self unarchiverDidFinish:nil];
[self performSelectorOnMainThread:@selector(unarchiverDidFinish:) withObject:nil waitUntilDone:NO];
} progressBlock:^(double progress) {
[self unarchiver:nil extractedProgress:progress];
}];
@@ -488,17 +510,36 @@
}
NSBundle *sparkleBundle = updater.sparkleBundle;
if (!sparkleBundle) {
SULog(SULogLevelError, @"Sparkle bundle is gone?");
return;
}
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
NSString *const relaunchToolName = @"" SPARKLE_RELAUNCH_TOOL_NAME;
NSString *const relaunchToolSourcePath = [sparkleBundle pathForResource:relaunchToolName ofType:@"app"];
NSString *const relaunchToolSourceName = @"" SPARKLE_RELAUNCH_TOOL_NAME;
NSString *const relaunchToolSourcePath = [sparkleBundle pathForResource:relaunchToolSourceName ofType:@"app"];
NSString *relaunchCopyTargetPath = nil;
NSError *error = nil;
BOOL copiedRelaunchPath = NO;
if (!relaunchToolSourceName || ![relaunchToolSourceName length]) {
SULog(SULogLevelError, @"SPARKLE_RELAUNCH_TOOL_NAME not configued");
}
if (!relaunchToolSourcePath) {
SULog(SULogLevelError, @"Sparkle.framework is damaged. %@ is missing", relaunchToolSourceName);
}
if (relaunchToolSourcePath) {
relaunchCopyTargetPath = [[self appCachePath] stringByAppendingPathComponent:[relaunchToolSourcePath lastPathComponent]];
NSString *hostBundleBaseName = [[self.host.bundlePath lastPathComponent] stringByDeletingPathExtension];
if (!hostBundleBaseName) {
SULog(SULogLevelError, @"Unable to get bundlePath");
hostBundleBaseName = @"Sparkle";
}
NSString *relaunchCopyBaseName = [NSString stringWithFormat:@"%@ (Autoupdate).app", hostBundleBaseName];
relaunchCopyTargetPath = [[self appCachePath] stringByAppendingPathComponent:relaunchCopyBaseName];
SUFileManager *fileManager = [SUFileManager defaultManager];
@@ -514,7 +555,7 @@
// Perhaps in a sandboxed environment this matters more. Note that this may not be a fatal error.
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:relaunchCopyTargetURL error:&quarantineError]) {
SULog(@"Failed to release quarantine on %@ with error %@", relaunchCopyTargetPath, quarantineError);
SULog(SULogLevelError, @"Failed to release quarantine on %@ with error %@", relaunchCopyTargetPath, quarantineError);
}
}
}
@@ -551,6 +592,9 @@
}
}
//Set relaunching flag.
[self.host setBool:YES forUserDefaultsKey:SUUpdateRelaunchingMarkerKey];
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
pathToRelaunch,
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
@@ -606,7 +650,7 @@
NSError *errorToDisplay = error;
int finiteRecursion=5;
do {
SULog(@"Error: %@ %@ (URL %@)", errorToDisplay.localizedDescription, errorToDisplay.localizedFailureReason, [errorToDisplay.userInfo objectForKey:NSURLErrorFailingURLErrorKey]);
SULog(SULogLevelError, @"Error: %@ %@ (URL %@)", errorToDisplay.localizedDescription, errorToDisplay.localizedFailureReason, [errorToDisplay.userInfo objectForKey:NSURLErrorFailingURLErrorKey]);
errorToDisplay = [errorToDisplay.userInfo objectForKey:NSUnderlyingErrorKey];
} while(--finiteRecursion && errorToDisplay);
}
+29 -32
View File
@@ -15,20 +15,19 @@
#include <stdlib.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
{
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
const char *argv[] = { "/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation] };
BOOL success = (bspatch(4, argv) == 0);
unlink([patchFile fileSystemRepresentation]);
return success;
}
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError * __autoreleasing *error)
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError *__autoreleasing *error)
{
xar_t x = xar_open([patchFile fileSystemRepresentation], READ);
if (!x) {
@@ -37,71 +36,71 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION;
int minorDiffVersion = 0;
NSString *expectedBeforeHashv1 = nil;
NSString *expectedAfterHashv1 = nil;
NSString *expectedNewBeforeHash = nil;
NSString *expectedNewAfterHash = nil;
progressCallback(0/6.0);
xar_subdoc_t subdoc;
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
const char *value = 0;
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
if (value)
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
if (value)
minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue];
minorDiffVersion = [@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_KEY, &value);
if (value)
expectedNewBeforeHash = @(value);
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_KEY, &value);
if (value)
expectedNewAfterHash = @(value);
// only available in version 1.0
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_OLD_KEY, &value);
if (value)
expectedBeforeHashv1 = @(value);
// only available in version 1.0
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_OLD_KEY, &value);
if (value)
expectedAfterHashv1 = @(value);
}
}
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
}
return NO;
}
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
}
return NO;
}
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
@@ -116,7 +115,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
fprintf(stderr, "Applying version %u.%u patch...\n", majorDiffVersion, minorDiffVersion);
fprintf(stderr, "Verifying source...");
}
progressCallback(1/6.0);
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
@@ -143,7 +142,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
if (verbose) {
fprintf(stderr, "\nCopying files...");
}
progressCallback(2/6.0);
if (!removeTree(destination)) {
@@ -167,7 +166,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
progressCallback(4/6.0);
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
@@ -186,10 +185,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
BOOL removedFile = NO;
const char *value;
if (!xar_prop_get(file, DELETE_KEY, &value) ||
(!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
if (!removeTree(destinationFilePath)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -205,7 +203,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
continue;
}
removedFile = YES;
}
@@ -219,13 +217,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n🔨 %s %s", VERBOSE_PATCHED, [path fileSystemRepresentation]);
}
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) ||
(!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
if (verbose) {
fprintf(stderr, "\n");
@@ -235,7 +232,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
if (fileExisted) {
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [path fileSystemRepresentation]);
@@ -246,7 +243,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
} else if (verbose && removedFile) {
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]);
}
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
if (!modifyPermissions(destinationFilePath, mode)) {
@@ -258,7 +255,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [path fileSystemRepresentation], mode);
}
+1 -10
View File
@@ -57,16 +57,7 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
SUBeigeMajorVersion = 2
};
// Only keep track of the latest minor version for each major version
typedef NS_ENUM(uint16_t, SUBinaryDeltaMinorVersion)
{
SUAzureMinorVersion = 1,
SUBeigeMinorVersion = 1,
};
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
#define FIRST_DELTA_DIFF_MINOR_VERSION ((SUBinaryDeltaMinorVersion)0)
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
extern int compareFiles(const FTSENT **a, const FTSENT **b);
@@ -80,5 +71,5 @@ extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
NSString *temporaryFilename(NSString *base);
NSString *temporaryDirectory(NSString *base);
NSString *stringWithFileSystemRepresentation(const char*);
SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
#endif
+23 -20
View File
@@ -18,7 +18,6 @@
#include <sys/stat.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
int compareFiles(const FTSENT **a, const FTSENT **b)
@@ -35,19 +34,20 @@ NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
return path;
}
NSString *stringWithFileSystemRepresentation(const char *input) {
NSString *stringWithFileSystemRepresentation(const char *input)
{
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)];
}
SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
{
switch (majorVersion) {
case SUAzureMajorVersion:
return SUAzureMinorVersion;
return 1;
case SUBeigeMajorVersion:
return SUBeigeMinorVersion;
return 2;
}
return (SUBinaryDeltaMinorVersion)0;
return 0;
}
NSString *temporaryFilename(NSString *base)
@@ -76,18 +76,18 @@ NSString *temporaryDirectory(NSString *base)
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
NSMutableData *data = [NSMutableData data];
[data appendBytes:template.fileSystemRepresentation length:strlen(template.fileSystemRepresentation) + 1];
char *buffer = data.mutableBytes;
char *templateResult = mkdtemp(buffer);
if (templateResult == NULL) {
perror("mkdtemp");
return nil;
}
return stringWithFileSystemRepresentation(templateResult);
}
static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t bufferLength)
static void _hashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bufferLength)
{
assert(bufferLength >= 0 && bufferLength <= UINT32_MAX);
CC_SHA1_CTX hashContext;
@@ -96,7 +96,7 @@ static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t buffe
CC_SHA1_Final(hash, &hashContext);
}
static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent)
static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
{
if (ent->fts_info == FTS_SL) {
char linkDestination[MAXPATHLEN + 1];
@@ -119,12 +119,12 @@ static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent)
_hashOfBuffer(hash, NULL, 0);
} else {
void *buffer = mmap(0, (size_t)fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
if (buffer == (void*)-1) {
if (buffer == (void *)-1) {
close(fileDescriptor);
perror("mmap");
return NO;
}
_hashOfBuffer(hash, buffer, fileSize);
munmap(buffer, (size_t)fileSize);
}
@@ -148,12 +148,12 @@ NSData *hashOfFileContents(FTSENT *ent)
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
{
char pathBuffer[PATH_MAX] = {0};
char pathBuffer[PATH_MAX] = { 0 };
if (![path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
return nil;
}
char * const sourcePaths[] = {pathBuffer, 0};
char *const sourcePaths[] = { pathBuffer, 0 };
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
perror("fts_open");
@@ -163,16 +163,19 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
CC_SHA1_CTX hashContext;
CC_SHA1_Init(&hashContext);
// Ensure the path uses filesystem-specific Unicode normalization #1017
NSString *normalizedPath = stringWithFileSystemRepresentation(pathBuffer);
FTSENT *ent = 0;
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
continue;
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
continue;
}
NSString *relativePath = pathRelativeToDirectory(path, stringWithFileSystemRepresentation(ent->fts_path));
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
if (relativePath.length == 0)
continue;
@@ -184,12 +187,12 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
const char *relativePathBytes = [relativePath fileSystemRepresentation];
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
uint16_t mode = ent->fts_statp->st_mode;
uint16_t type = ent->fts_info;
uint16_t permissions = mode & PERMISSION_FLAGS;
CC_SHA1_Update(&hashContext, &type, sizeof(type));
CC_SHA1_Update(&hashContext, &permissions, sizeof(permissions));
}
@@ -239,7 +242,7 @@ BOOL modifyPermissions(NSString *path, mode_t desiredPermissions)
return NO;
}
mode_t newMode = ([permissions unsignedShortValue] & ~PERMISSION_FLAGS) | desiredPermissions;
int (*changeModeFunc)(const char *, mode_t) = [[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
int (*changeModeFunc)(const char *, mode_t) = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeSymbolicLink] ? lchmod : chmod;
if (changeModeFunc([path fileSystemRepresentation], newMode) != 0) {
return NO;
}
+92 -78
View File
@@ -21,7 +21,6 @@
#include <sys/xattr.h>
#include <xar/xar.h>
#include "AppKitPrevention.h"
extern int bsdiff(int argc, const char **argv);
@@ -59,7 +58,7 @@ extern int bsdiff(int argc, const char **argv);
- (void)main
{
NSString *temporaryFile = temporaryFilename(@"BinaryDelta");
const char *argv[] = {"/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation]};
const char *argv[] = { "/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation] };
int result = bsdiff(4, argv);
if (!result)
self.resultPath = temporaryFile;
@@ -78,14 +77,26 @@ static NSDictionary *infoForFile(FTSENT *ent)
if (!hash) {
return nil;
}
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
assert(ent->fts_statp != NULL);
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
return @{INFO_HASH_KEY: hash, INFO_TYPE_KEY: @(ent->fts_info), INFO_PERMISSIONS_KEY : @(permissions), INFO_SIZE_KEY: @(size)};
return @{ INFO_HASH_KEY: hash,
INFO_TYPE_KEY: @(ent->fts_info),
INFO_PERMISSIONS_KEY: @(permissions),
INFO_SIZE_KEY: @(size) };
}
static bool isSymLink(const FTSENT *ent)
{
if (ent->fts_info == FTS_SL)
{
return (true);
}
return false;
}
static bool aclExists(const FTSENT *ent)
@@ -94,7 +105,7 @@ static bool aclExists(const FTSENT *ent)
if (ent->fts_info == FTS_SL) {
return NO;
}
acl_t acl = acl_get_link_np(ent->fts_path, ACL_TYPE_EXTENDED);
if (acl != NULL) {
acl_entry_t entry;
@@ -112,28 +123,26 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent)
if (listSize == -1) {
return false;
}
char *buffer = malloc((size_t)listSize);
assert(buffer != NULL);
ssize_t sizeBack = listxattr(ent->fts_path, buffer, (size_t)listSize, options);
assert(sizeBack == listSize);
size_t startCharacterIndex = 0;
for (size_t characterIndex = 0; characterIndex < (size_t)listSize; characterIndex++) {
if (buffer[characterIndex] == '\0') {
char *attribute = &buffer[startCharacterIndex];
size_t length = characterIndex - startCharacterIndex;
if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 ||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 ||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) {
if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) {
free(buffer);
return true;
}
startCharacterIndex = characterIndex + 1;
}
}
free(buffer);
return false;
}
@@ -141,7 +150,7 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent)
static NSString *absolutePath(NSString *path)
{
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
return [[url absoluteURL] path];
return [[url absoluteURL] path];
}
static NSString *temporaryPatchFile(NSString *patchFile)
@@ -154,7 +163,7 @@ static NSString *temporaryPatchFile(NSString *patchFile)
#define MIN_FILE_SIZE_FOR_CREATING_DELTA 4096
static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary *newInfo)
static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo)
{
unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) {
@@ -168,7 +177,7 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return YES;
}
if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
// this is possible if just the permissions have changed
return YES;
@@ -177,7 +186,7 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary
return NO;
}
static BOOL shouldDeleteThenExtract(NSDictionary* originalInfo, NSDictionary *newInfo)
static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *newInfo)
{
if (!originalInfo) {
return NO;
@@ -195,15 +204,15 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
if (!originalInfo) {
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
return NO;
}
return YES;
}
@@ -212,30 +221,30 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
if (!originalInfo) {
return NO;
}
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
return NO;
}
if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
return NO;
}
return YES;
}
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError * __autoreleasing *error)
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error)
{
assert(source);
assert(destination);
assert(patchFile);
assert(majorVersion >= FIRST_DELTA_DIFF_MAJOR_VERSION && majorVersion <= LATEST_DELTA_DIFF_MAJOR_VERSION);
SUBinaryDeltaMinorVersion minorVersion = latestMinorVersionForMajorVersion(majorVersion);
int minorVersion = latestMinorVersionForMajorVersion(majorVersion);
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
char pathBuffer[PATH_MAX] = {0};
char pathBuffer[PATH_MAX] = { 0 };
if (![source getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to retrieve file system path representation from source %@", source] }];
@@ -243,7 +252,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
char *sourcePaths[] = {pathBuffer, 0};
char *sourcePaths[] = { pathBuffer, 0 };
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
if (error != NULL) {
@@ -254,9 +263,9 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (verbose) {
fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion);
fprintf(stderr, "Processing %s...", [source fileSystemRepresentation]);
fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]);
}
FTSENT *ent = 0;
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
@@ -279,7 +288,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
originalTreeState[key] = info;
if (aclExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -289,7 +298,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (codeSignatureExtendedAttributeExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -301,7 +310,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
}
fts_close(fts);
NSString *beforeHash = hashOfTreeWithVersion(source, majorVersion);
if (!beforeHash) {
@@ -315,13 +324,12 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary];
for (NSString *key in originalTreeState)
{
for (NSString *key in originalTreeState) {
newTreeState[key] = [NSNull null];
}
if (verbose) {
fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]);
fprintf(stderr, "\nProcessing destination, %s...", [destination fileSystemRepresentation]);
}
pathBuffer[0] = 0;
@@ -334,7 +342,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
sourcePaths[0] = pathBuffer;
fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
if (!fts) {
@@ -344,7 +352,6 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
return NO;
}
while ((ent = fts_read(fts))) {
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
continue;
@@ -365,15 +372,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
// We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs,
// or in the case of permissions if the patch version is 1
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
// inside an application, and since we don't preserve extended attribitutes anyway
mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!IS_VALID_PERMISSIONS(permissions)) {
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
if (verbose) {
fprintf(stderr, "\n");
}
@@ -382,7 +389,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (aclExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -392,7 +399,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (codeSignatureExtendedAttributeExists(ent)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -402,14 +409,14 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
NSDictionary *oldInfo = originalTreeState[key];
if ([info isEqual:oldInfo]) {
[newTreeState removeObjectForKey:key];
} else {
newTreeState[key] = info;
if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
NSArray *parentPathComponents = key.pathComponents;
@@ -435,12 +442,15 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (verbose) {
fprintf(stderr, "\nGenerating delta...");
}
NSString *temporaryFile = temporaryPatchFile(patchFile);
if (verbose) {
fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]);
}
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
if (!x) {
if (verbose) {
@@ -451,20 +461,18 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
xar_subdoc_t attributes = xar_subdoc_new(x, BINARY_DELTA_ATTRIBUTES_KEY);
xar_subdoc_prop_set(attributes, MAJOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", majorVersion] UTF8String]);
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
const char *beforeHashKey =
MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey =
MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
@@ -474,21 +482,21 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
// Sort the keys by preferring the ones from the original tree to appear first
// We want to enforce deleting before extracting in the case paths differ only by case
NSArray *keys = [[newTreeState allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSString *key1, NSString *key2) {
NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2];
if (insensitiveCompareResult != NSOrderedSame) {
return insensitiveCompareResult;
}
NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2];
if (insensitiveCompareResult != NSOrderedSame) {
return insensitiveCompareResult;
}
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
}];
for (NSString* key in keys) {
for (NSString *key in keys) {
id value = [newTreeState valueForKey:key];
if ([value isEqual:[NSNull null]]) {
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, DELETE_KEY, "true");
if (verbose) {
fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]);
}
@@ -503,7 +511,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
assert(newFile);
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
}
@@ -512,7 +520,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
NSString *path = [destination stringByAppendingPathComponent:key];
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
assert(newFile);
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
xar_prop_set(newFile, DELETE_KEY, "true");
@@ -520,11 +528,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
}
}
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
xar_prop_set(newFile, EXTRACT_KEY, "true");
}
if (verbose) {
if (originalInfo) {
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
@@ -557,19 +565,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
}
return NO;
}
if (verbose) {
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
}
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
assert(newFile);
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
unlink([resultPath fileSystemRepresentation]);
if (operation.permissions) {
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [operation.permissions unsignedShortValue]] UTF8String]);
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [[operation relativePath] fileSystemRepresentation], operation.oldPermissions.unsignedShortValue, operation.permissions.unsignedShortValue);
}
@@ -578,13 +586,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
xar_close(x);
unlink([patchFile fileSystemRepresentation]);
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
unlink([temporaryFile fileSystemRepresentation]);
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr removeItemAtPath: patchFile error: NULL];
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
{
if (verbose) {
fprintf(stderr, "Failed to move temporary file, %s, to %s!\n", [temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
}
return NO;
}
if (verbose) {
fprintf(stderr, "\nDone!\n");
}
return YES;
}
+33 -33
View File
@@ -36,7 +36,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
NSUInteger numberOflagsFound = 0;
NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG];
NSUInteger versionIndex = NSNotFound;
@@ -46,22 +46,22 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
break;
}
}
if (verboseIndex != NSNotFound) {
++numberOflagsFound;
}
if (versionIndex != NSNotFound) {
++numberOflagsFound;
}
if (args.count - numberOflagsFound < 3) {
printUsage(programName);
return NO;
}
BOOL verbose = (verboseIndex != NSNotFound);
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
NSArray *versionComponents = nil;
if (versionField) {
versionComponents = [versionField componentsSeparatedByString:@"="];
@@ -70,17 +70,17 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
return NO;
}
}
SUBinaryDeltaMajorVersion patchVersion =
!versionComponents ?
LATEST_DELTA_DIFF_MAJOR_VERSION :
(SUBinaryDeltaMajorVersion)[[versionComponents[1] componentsSeparatedByString:@"."][0] intValue]; // ignore minor version if provided
if (patchVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
fprintf(stderr, "Version provided (%u) is not valid\n", patchVersion);
return NO;
}
if (patchVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
fprintf(stderr, "This program is too old to create a version %u patch, or the version number provided is invalid\n", patchVersion);
return NO;
@@ -92,12 +92,12 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
[fileArgs addObject:argument];
}
}
if (fileArgs.count != 3) {
printUsage(programName);
return NO;
}
NSString *sourcePath = fileArgs[0];
NSString *destPath = fileArgs[1];
NSString *patchPath = fileArgs[2];
@@ -108,19 +108,19 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args)
fprintf(stderr, "Error: before-tree must be a directory\n");
return NO;
}
if (![[NSFileManager defaultManager] fileExistsAtPath:destPath isDirectory:&isDirectory] || !isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: after-tree must be a directory\n");
return NO;
}
NSError *createDiffError = nil;
if (!createBinaryDelta(sourcePath, destPath, patchPath, patchVersion, verbose, &createDiffError)) {
fprintf(stderr, "%s\n", [createDiffError.localizedDescription UTF8String]);
return NO;
}
return YES;
}
@@ -130,45 +130,45 @@ static BOOL runApplyCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
BOOL verbose = [args containsObject:VERBOSE_FLAG];
if (args.count == 4 && !verbose) {
printUsage(programName);
return NO;
}
NSMutableArray *fileArgs = [NSMutableArray array];
for (NSString *argument in args) {
if (![argument isEqualToString:VERBOSE_FLAG]) {
[fileArgs addObject:argument];
}
}
if (fileArgs.count != 3) {
printUsage(programName);
return NO;
}
BOOL isDirectory;
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[0] isDirectory:&isDirectory] || !isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: before-tree must be a directory\n");
return NO;
}
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[2] isDirectory:&isDirectory] || isDirectory) {
printUsage(programName);
fprintf(stderr, "Error: patch-file must be a file %d\n", isDirectory);
return NO;
}
NSError *applyDiffError = nil;
if (!applyBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], verbose, ^(__unused double x){}, &applyDiffError)) {
fprintf(stderr, "%s\n", [applyDiffError.localizedDescription UTF8String]);
return NO;
}
return YES;
}
@@ -178,7 +178,7 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args)
printUsage(programName);
return NO;
}
if (args.count == 0) {
fprintf(stdout, "%u.%u\n", LATEST_DELTA_DIFF_MAJOR_VERSION, latestMinorVersionForMajorVersion(LATEST_DELTA_DIFF_MAJOR_VERSION));
} else {
@@ -188,30 +188,30 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args)
fprintf(stderr, "Unable to open patch %s\n", [patchFile fileSystemRepresentation]);
return NO;
}
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION;
int minorDiffVersion = 0;
xar_subdoc_t subdoc;
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
const char *value = 0;
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
if (value)
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
// available in version 2.0 or later
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
if (value)
minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue];
minorDiffVersion = [@(value) intValue];
}
}
fprintf(stdout, "%u.%u\n", majorDiffVersion, minorDiffVersion);
}
return YES;
}
@@ -220,7 +220,7 @@ int main(int __unused argc, char __unused *argv[])
@autoreleasepool {
NSArray *args = [[NSProcessInfo processInfo] arguments];
NSString *programName = [args[0] lastPathComponent];
if (args.count < 2) {
printUsage(programName);
return 1;
@@ -228,7 +228,7 @@ int main(int __unused argc, char __unused *argv[])
NSString *command = args[1];
NSArray *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)];
BOOL result;
if ([command isEqualToString:CREATE_COMMAND]) {
result = runCreateCommand(programName, commandArguments);
@@ -240,7 +240,7 @@ int main(int __unused argc, char __unused *argv[])
result = NO;
printUsage(programName);
}
return result ? 0 : 1;
}
}
+1 -1
View File
@@ -67,7 +67,7 @@
for (NSURL *file in filesToUpdate) {
NSError *error = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:file error:&error]) {
SULog(@"Error: During delta unarchiving, failed to touch %@", error);
SULog(SULogLevelError, @"Error: During delta unarchiving, failed to touch %@", error);
}
}
}
+3 -1
View File
@@ -10,9 +10,11 @@
NS_ASSUME_NONNULL_BEGIN
@class SUHost;
@interface SUBundleIcon : NSObject
+ (NSURL * _Nullable)iconURLForBundle:(NSBundle *)bundle;
+ (NSURL * _Nullable)iconURLForHost:(SUHost *)host;
@end
+6 -4
View File
@@ -7,24 +7,26 @@
//
#import "SUBundleIcon.h"
#import "SUHost.h"
#include "AppKitPrevention.h"
@implementation SUBundleIcon
+ (NSURL *)iconURLForBundle:(NSBundle *)bundle
// Note: To obtain the most current bundle icon file from the Info dictionary, this should take a SUHost, not a NSBundle
+ (NSURL *)iconURLForHost:(SUHost *)host
{
NSString *resource = [bundle objectForInfoDictionaryKey:@"CFBundleIconFile"];
NSString *resource = [host objectForInfoDictionaryKey:@"CFBundleIconFile"];
if (resource == nil || ![resource isKindOfClass:[NSString class]]) {
return nil;
}
NSURL *iconURL = [bundle URLForResource:resource withExtension:@"icns"];
NSURL *iconURL = [host.bundle URLForResource:resource withExtension:@"icns"];
// The resource could already be containing the path extension, so try again without the extra extension
if (iconURL == nil) {
iconURL = [bundle URLForResource:resource withExtension:nil];
iconURL = [host.bundle URLForResource:resource withExtension:nil];
}
return iconURL;
}
+3 -1
View File
@@ -10,11 +10,13 @@
#define SUCODESIGNINGVERIFIER_H
#import <Foundation/Foundation.h>
#import "SUExport.h"
@interface SUCodeSigningVerifier : NSObject
SU_EXPORT @interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundlePath matchesSignatureAtBundleURL:(NSURL *)newBundlePath error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundlePath error:(NSError **)error;
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundlePath;
+ (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath;
@end
#endif
+29 -8
View File
@@ -34,13 +34,13 @@
result = SecCodeCopyDesignatedRequirement(oldCode, kSecCSDefaultFlags, &requirement);
if (result != noErr) {
SULog(@"Failed to copy designated requirement. Code Signing OSStatus code: %d", result);
SULog(SULogLevelError, @"Failed to copy designated requirement. Code Signing OSStatus code: %d", result);
goto finally;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)newBundleURL, kSecCSDefaultFlags, &staticCode);
if (result != noErr) {
SULog(@"Failed to get static code %d", result);
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
@@ -58,12 +58,12 @@
if (result != noErr) {
if (result == errSecCSUnsigned) {
SULog(@"The host app is signed, but the new version of the app is not signed using Apple Code Signing. Please ensure that the new app is signed and that archiving did not corrupt the signature.");
SULog(SULogLevelError, @"The host app is signed, but the new version of the app is not signed using Apple Code Signing. Please ensure that the new app is signed and that archiving did not corrupt the signature.");
}
if (result == errSecCSReqFailed) {
CFStringRef requirementString = nil;
if (SecRequirementCopyString(requirement, kSecCSDefaultFlags, &requirementString) == noErr) {
SULog(@"Code signature of the new version doesn't match the old version: %@. Please ensure that old and new app is signed using exactly the same certificate.", requirementString);
SULog(SULogLevelError, @"Code signature of the new version doesn't match the old version: %@. Please ensure that old and new app is signed using exactly the same certificate.", requirementString);
CFRelease(requirementString);
}
@@ -90,7 +90,7 @@ finally:
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundleURL, kSecCSDefaultFlags, &staticCode);
if (result != noErr) {
SULog(@"Failed to get static code %d", result);
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
@@ -105,7 +105,7 @@ finally:
if (result != noErr) {
if (result == errSecCSUnsigned) {
SULog(@"Error: The app is not signed using Apple Code Signing. %@", bundleURL);
SULog(SULogLevelError, @"Error: The app is not signed using Apple Code Signing. %@", bundleURL);
}
if (result == errSecCSReqFailed) {
[self logSigningInfoForCode:staticCode label:@"new info"];
@@ -121,7 +121,22 @@ static id valueOrNSNull(id value) {
return value ? value : [NSNull null];
}
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
+ (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath {
NSDictionary *info = nil;
SecStaticCodeRef code = NULL;
OSStatus result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundlePath, kSecCSDefaultFlags, &code);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
info = [self codeSignatureInfoForCode:code];
finally:
if (code) CFRelease(code);
return info;
}
+ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code {
CFDictionaryRef signingInfo = nil;
const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation);
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
@@ -133,8 +148,14 @@ static id valueOrNSNull(id value) {
NSDictionary *infoPlist = [signingDict objectForKey:@"info-plist"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:@"CFBundleShortVersionString"]) forKey:@"version"];
[relevantInfo setObject:valueOrNSNull([infoPlist objectForKey:(__bridge NSString *)kCFBundleVersionKey]) forKey:@"build"];
SULog(@"%@: %@", label, relevantInfo);
return [relevantInfo copy];
}
return nil;
}
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
}
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL
+6 -1
View File
@@ -21,6 +21,8 @@ extern const NSTimeInterval SUDefaultUpdateCheckInterval;
extern NSString *const SUBundleIdentifier;
extern NSString *const SUAppcastAttributeValueMacOS;
// -----------------------------------------------------------------------------
// Notifications:
// -----------------------------------------------------------------------------
@@ -33,6 +35,7 @@ extern NSString *const SUTechnicalErrorInformationKey;
extern NSString *const SUFeedURLKey;
extern NSString *const SUHasLaunchedBeforeKey;
extern NSString *const SUUpdateRelaunchingMarkerKey;
extern NSString *const SUShowReleaseNotesKey;
extern NSString *const SUSkippedVersionKey;
extern NSString *const SUScheduledCheckIntervalKey;
@@ -47,7 +50,6 @@ extern NSString *const SUEnableSystemProfilingKey;
extern NSString *const SUSendProfileInfoKey;
extern NSString *const SULastProfileSubmitDateKey;
extern NSString *const SUPromptUserOnFirstLaunchKey;
extern NSString *const SUKeepDownloadOnFailedInstallKey;
extern NSString *const SUDefaultsDomainKey;
extern NSString *const SUEnableJavaScriptKey;
extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect.")));
@@ -64,6 +66,9 @@ extern NSString *const SUAppcastAttributeDeltaFrom;
extern NSString *const SUAppcastAttributeDSASignature;
extern NSString *const SUAppcastAttributeShortVersionString;
extern NSString *const SUAppcastAttributeVersion;
extern NSString *const SUAppcastAttributeOsType;
extern NSString *const SUAppcastElementCriticalUpdate;
extern NSString *const SUAppcastElementDeltas;
+4 -1
View File
@@ -21,9 +21,12 @@ const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
NSString *const SUBundleIdentifier = @SPARKLE_BUNDLE_IDENTIFIER;
NSString *const SUAppcastAttributeValueMacOS = @"macos";
NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
NSString *const SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
NSString *const SUUpdateRelaunchingMarkerKey = @"SUUpdateRelaunchingMarker";
NSString *const SUFeedURLKey = @"SUFeedURL";
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
NSString *const SUSkippedVersionKey = @"SUSkippedVersion";
@@ -41,7 +44,6 @@ NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch";
NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript";
NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall";
NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain";
NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain";
@@ -54,6 +56,7 @@ NSString *const SUAppcastAttributeDeltaFrom = @"sparkle:deltaFrom";
NSString *const SUAppcastAttributeDSASignature = @"sparkle:dsaSignature";
NSString *const SUAppcastAttributeShortVersionString = @"sparkle:shortVersionString";
NSString *const SUAppcastAttributeVersion = @"sparkle:version";
NSString *const SUAppcastAttributeOsType = @"sparkle:os";
NSString *const SUAppcastElementCriticalUpdate = @"sparkle:criticalUpdate";
NSString *const SUAppcastElementDeltas = @"sparkle:deltas";
+10 -10
View File
@@ -26,7 +26,7 @@
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString
{
if (!encodedSignature) {
SULog(@"There is no DSA signature to check");
SULog(SULogLevelError, @"There is no DSA signature to check");
return NO;
}
@@ -34,7 +34,7 @@
return NO;
}
SUDSAVerifier *verifier = [[self alloc] initWithPublicKeyData:[pkeyString dataUsingEncoding:NSUTF8StringEncoding]];
SUDSAVerifier *verifier = [(SUDSAVerifier *)[self alloc] initWithPublicKeyData:[pkeyString dataUsingEncoding:NSUTF8StringEncoding]];
if (!verifier) {
return NO;
@@ -50,7 +50,7 @@
self = [super init];
if (!self || !data.length) {
SULog(@"Could not read public DSA key");
SULog(SULogLevelError, @"Could not read public DSA key");
return nil;
}
@@ -63,7 +63,7 @@
if (items) {
CFRelease(items);
}
SULog(@"Public DSA key could not be imported: %d", status);
SULog(SULogLevelError, @"Public DSA key could not be imported: %d", status);
return nil;
}
@@ -121,7 +121,7 @@
dataReadTransform = SecTransformCreateReadTransformWithReadStream((__bridge CFReadStreamRef)stream);
if (!dataReadTransform) {
SULog(@"File containing update archive could not be read (failed to create SecTransform for input stream)");
SULog(SULogLevelError, @"File containing update archive could not be read (failed to create SecTransform for input stream)");
return cleanup();
}
@@ -135,30 +135,30 @@
dataVerifyTransform = SecVerifyTransformCreate(_secKey, (__bridge CFDataRef)signature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform || error) {
SULog(@"Could not understand format of the signature: %@; Signature data: %@", error, signature);
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, signature);
return cleanup();
}
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(@"%@", error);
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
if (error) {
SULog(@"%@", error);
SULog(SULogLevelError, @"%@", error);
return cleanup();
}
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
if (error) {
SULog(@"DSA signature verification failed: %@", error);
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
return cleanup();
}
if (!result.boolValue) {
SULog(@"DSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
SULog(SULogLevelError, @"DSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
}
cleanup();
+6 -6
View File
@@ -138,7 +138,7 @@
if (taskResult != 0)
{
NSString *resultStr = output ? [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding] : nil;
SULog(@"hdiutil failed with code: %ld data: <<%@>>", (long)taskResult, resultStr);
SULog(SULogLevelError, @"hdiutil failed with code: %ld data: <<%@>>", (long)taskResult, resultStr);
goto reportError;
}
mountedSuccessfully = YES;
@@ -148,7 +148,7 @@
contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
if (error)
{
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
SULog(SULogLevelError, @"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
goto reportError;
}
@@ -167,7 +167,7 @@
itemsCopied += 1.0;
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
{
@@ -192,11 +192,11 @@
@try {
[task launch];
} @catch (NSException *exception) {
SULog(@"Failed to unmount %@", mountPoint);
SULog(@"Exception: %@", exception);
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
SULog(SULogLevelError, @"Exception: %@", exception);
}
} else {
SULog(@"Can't mount DMG %@", self.archivePath);
SULog(SULogLevelError, @"Can't mount DMG %@", self.archivePath);
}
}
}
+3
View File
@@ -21,6 +21,8 @@
*/
SU_EXPORT extern NSString *const SUSparkleErrorDomain;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++98-compat"
typedef NS_ENUM(OSStatus, SUError) {
// Appcast phase errors.
SUAppcastParseError = 1000,
@@ -49,5 +51,6 @@ typedef NS_ENUM(OSStatus, SUError) {
// System phase errors
SUSystemPowerOffError = 5000
};
#pragma clang diagnostic pop
#endif
+2 -1
View File
@@ -146,6 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Runs an installer package (pkg) in a headless mode using /usr/sbin/installer
* @param packageURL A URL pointing to the package to execute. The item at this URL must exist.
* @param progressBlock Callback that takes double value (0..1 range) notifying how far the installation has progressed
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
* @return YES if the installer ran the package successfully, otherwise NO with a populated error object
*
@@ -153,7 +154,7 @@ NS_ASSUME_NONNULL_BEGIN
* an initial authorization prompt if the calling process does not have root privileges. In other words, root privileges are required to use this method, and the file manager instance must have been created by allowing authorization.
* An error can occur if the package is unable to be ran by the installer, or if the installer reports a non-zero exit status code.
*/
- (BOOL)executePackageAtURL:(NSURL *)packageURL error:(NSError *_Nullable*_Nullable)error;
- (BOOL)executePackageAtURL:(NSURL *)packageURL progressBlock:(nullable void(^)(double))progressBlock error:(NSError *_Nullable*_Nullable)error;
NS_ASSUME_NONNULL_END
+97 -42
View File
@@ -71,12 +71,12 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
+ (instancetype)defaultManager
{
return [[self alloc] initWithAuthorizationToolPath:nil];
return [(SUFileManager *)[self alloc] initWithAuthorizationToolPath:nil];
}
+ (instancetype)fileManagerWithAuthorizationToolPath:(NSString *)authorizationToolPath
{
return [[self alloc] initWithAuthorizationToolPath:authorizationToolPath];
return [(SUFileManager *)[self alloc] initWithAuthorizationToolPath:authorizationToolPath];
}
- (instancetype)fileManagerByPreservingAuthorizationRights
@@ -109,20 +109,20 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
_auth = NULL;
return NO;
}
AuthorizationItem rightItems[] = {
// The right that allows us to run tools as root user
{.name = kAuthorizationRightExecute, .valueLength = 0, .value = NULL, .flags = 0}
};
AuthorizationRights rights = {
.count = sizeof(rightItems) / sizeof(*rightItems),
.items = rightItems
};
AuthorizationFlags flags =
(AuthorizationFlags)(kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize);
// This will test if we can gain authorization for running utlities as root
OSStatus copyStatus = AuthorizationCopyRights(_auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL);
if (copyStatus != errAuthorizationSuccess) {
@@ -133,17 +133,21 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed granting authorization rights with status code %d.", copyStatus] }];
}
}
AuthorizationFree(_auth, kAuthorizationFlagDefaults);
_auth = NULL;
return NO;
}
return YES;
}
- (BOOL)_authorizeAndExecuteCommand:(char *)command sourcePath:(char *)sourcePath destinationPath:(char *)destinationPath error:(NSError * __autoreleasing *)error
- (BOOL)_authorizeAndExecuteCommand:(char *)command sourcePath:(char *)sourcePath destinationPath:(char *)destinationPath error:(NSError * __autoreleasing *)error {
return [self _authorizeAndExecuteCommand:command sourcePath:sourcePath destinationPath:destinationPath lineCallback:nil error:error];
}
- (BOOL)_authorizeAndExecuteCommand:(char *)command sourcePath:(char *)sourcePath destinationPath:(char *)destinationPath lineCallback:(void(^)(NSString*))lineCallback error:(NSError * __autoreleasing *)error
{
NSError *acquireError = nil;
if (![self _acquireAuthorizationWithError:&acquireError]) {
@@ -152,9 +156,9 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
char *arguments[] = { command, sourcePath, destinationPath, NULL };
char toolPath[PATH_MAX] = {0};
if (![_authorizationToolPath getFileSystemRepresentation:toolPath maxLength:sizeof(toolPath)]) {
if (error != NULL) {
@@ -162,18 +166,22 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
FILE *pipe = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (AuthorizationExecuteWithPrivileges(_auth, toolPath, kAuthorizationFlagDefaults, arguments, &pipe) != errAuthorizationSuccess) {
OSStatus runStatus = AuthorizationExecuteWithPrivileges(_auth, toolPath, kAuthorizationFlagDefaults, arguments, &pipe);
if (runStatus != errAuthorizationSuccess) {
#pragma clang diagnostic pop
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:@"Failed to run authorization tool." }];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcstring-format-directive"
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Failed to run authorization tool %s (error code %d).", toolPath, (int)runStatus] }];
#pragma clang diagnostic pop
}
return NO;
}
uint32_t pidData = 0;
if (fread(&pidData, sizeof(pidData), 1, pipe) < 1) {
if (error != NULL) {
@@ -182,27 +190,54 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
fclose(pipe);
return NO;
}
if (lineCallback) {
NSFileHandle *pipeHandle = [[NSFileHandle alloc] initWithFileDescriptor:fileno(pipe) closeOnDealloc:NO];
[self parseLines:pipeHandle lineCallback:lineCallback];
}
pid_t childPid = (int32_t)CFSwapInt32LittleToHost(pidData);
int status = 0;
pid_t waitResult;
do {
waitResult = waitpid(childPid, &status, 0);
} while (waitResult == -1 && errno == EINTR);
fclose(pipe);
if (waitResult == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Failed to execute authorized executable with result %d and status (%d, %d, %d).", waitResult, status, WIFEXITED(status), WEXITSTATUS(status)] }];
}
return NO;
}
return YES;
}
- (void)parseLines:(NSFileHandle *)pipeHandle lineCallback:(void(^)(NSString *))lineCallback {
__block NSMutableData *line = [NSMutableData new];
pipeHandle.readabilityHandler = ^(NSFileHandle *handle){
NSData *data = handle.availableData;
NSUInteger length = data.length;
if (!length) {
return;
}
const char *bytes = data.bytes;
for(NSUInteger i = 0; i < length; i++) {
if (bytes[i] == '\n') {
NSData *dataToEOL = [data subdataWithRange:NSMakeRange(0, i)];
[line appendData:dataToEOL];
NSString *fullLine = [[NSString alloc] initWithData:line encoding:NSUTF8StringEncoding];
lineCallback(fullLine);
line = [[data subdataWithRange:NSMakeRange(i+1, length-i-1)] mutableCopy];
break;
}
}
};
}
- (void)dealloc
{
if (_auth != NULL) {
@@ -234,7 +269,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
if (isDirectory != NULL) {
*isDirectory = [[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory];
*isDirectory = [(NSString *)[attributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory];
}
return YES;
@@ -269,7 +304,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
- (BOOL)_removeQuarantineWithAuthenticationAtRootURL:(NSURL *)rootURL error:(NSError *__autoreleasing *)error
{
// Because this is a system utility, it's fine to follow the symbolic link if one exists
if (![_fileManager fileExistsAtPath:@(XATTR_UTILITY_PATH)]) {
if (![_fileManager fileExistsAtPath:(NSString *)@(XATTR_UTILITY_PATH)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: @"xattr utility does not exist on this system." }];
}
@@ -283,7 +318,9 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSLog(@"Sparkle: Authorization required to remove quarantine %@", rootURL);
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpRemoveQuarantineCommand sourcePath:path destinationPath:NULL error:&executeError];
if (!success && error != NULL) {
@@ -481,7 +518,9 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSLog(@"Sparkle: Authorization required to copy %@ to %@", sourceURL, destinationURL);
NSError *executeError = nil;
if (![self _authorizeAndExecuteCommand:SUFileOpCopyCommand sourcePath:sourcePath destinationPath:destinationPath error:&executeError]) {
if (error != NULL) {
@@ -574,6 +613,8 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
return NO;
}
NSLog(@"Sparkle: Authorization required to move %@ to %@", sourceURL, destinationURL);
char sourcePath[PATH_MAX] = {0};
if (![sourceURL.path getFileSystemRepresentation:sourcePath maxLength:sizeof(sourcePath)]) {
if (error != NULL) {
@@ -589,7 +630,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSError *executeError = nil;
if (![self _authorizeAndExecuteCommand:SUFileOpMoveCommand sourcePath:sourcePath destinationPath:destinationPath error:&executeError]) {
if (error != NULL) {
@@ -619,11 +660,11 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
// We use fchown instead of chown because the latter can follow symbolic links
BOOL success = fchown(fileDescriptor, ownerID.unsignedIntValue, groupID.unsignedIntValue) == 0;
close(fileDescriptor);
if (!success) {
if (errno == EPERM) {
if (needsAuth != NULL) {
@@ -734,7 +775,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
char matchPath[PATH_MAX] = {0};
if (![matchURLPath getFileSystemRepresentation:matchPath maxLength:sizeof(matchPath)]) {
if (error != NULL) {
@@ -743,6 +784,8 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
return NO;
}
NSLog(@"Sparkle: Authorization required to change permissions of %@ to match %@", targetURL, matchURL);
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpChangeOwnerAndGroupCommand sourcePath:targetPath destinationPath:matchPath error:&executeError];
if (!success && error != NULL) {
@@ -783,12 +826,12 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
// Using futimes() because utimes() follows symbolic links
BOOL updatedTime = (futimes(fileDescriptor, NULL) == 0);
close(fileDescriptor);
if (updatedTime) {
return YES;
}
@@ -799,7 +842,9 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSLog(@"Sparkle: Authorization required to update timestamp of %@", targetURL);
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpUpdateModificationAndAccessTimeCommand sourcePath:path destinationPath:NULL error:&executeError];
if (!success && error != NULL) {
@@ -842,6 +887,8 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
return NO;
}
NSLog(@"Sparkle: Authorization required to make directory %@", url);
char path[PATH_MAX] = {0};
if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
if (error != NULL) {
@@ -849,7 +896,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpMakeDirectoryCommand sourcePath:path destinationPath:NULL error:&executeError];
if (!success) {
@@ -858,7 +905,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError }];
}
}
return success;
}
@@ -904,6 +951,8 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
return NO;
}
NSLog(@"Sparkle: Authorization required to delete %@", url);
char path[PATH_MAX] = {0};
if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
if (error != NULL) {
@@ -911,19 +960,19 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpRemoveCommand sourcePath:path destinationPath:NULL error:&executeError];
if (!success && error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to remove %@ with authentication.", url.path.lastPathComponent], NSUnderlyingErrorKey: executeError }];
}
return success;
}
// Unlike other methods, authorization is required to execute this method successfully
- (BOOL)executePackageAtURL:(NSURL *)packageURL error:(NSError * __autoreleasing *)error
- (BOOL)executePackageAtURL:(NSURL *)packageURL progressBlock:(void(^)(double))progressBlock error:(NSError * __autoreleasing *)error
{
if (![self _itemExistsAtURL:packageURL]) {
if (error != NULL) {
@@ -931,7 +980,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
char path[PATH_MAX] = {0};
if (![packageURL.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
if (error != NULL) {
@@ -939,10 +988,16 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
}
return NO;
}
NSLog(@"Sparkle: Authorization required to run pkg installer %@", packageURL);
NSError *executeError = nil;
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpInstallCommand sourcePath:path destinationPath:NULL error:&executeError];
BOOL success = [self _authorizeAndExecuteCommand:SUFileOpInstallCommand sourcePath:path destinationPath:NULL lineCallback:^(NSString *line){
if ([line hasPrefix:@"installer:%"]) {
progressBlock([[line substringFromIndex:11] doubleValue]/100.0);
}
} error:&executeError];
if (!success && error != NULL) {
NSString* errorMessage = @"Failed to execute package installer.";
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{NSLocalizedDescriptionKey: errorMessage, NSUnderlyingErrorKey: executeError}];
+2 -2
View File
@@ -42,11 +42,11 @@
return YES;
}
- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))progressBlock error:(NSError * __autoreleasing *)error
{
SUFileManager *fileManager = [SUFileManager fileManagerWithAuthorizationToolPath:self.fileOperationToolPath];
return [fileManager executePackageAtURL:[NSURL fileURLWithPath:self.packagePath] error:error];
return [fileManager executePackageAtURL:[NSURL fileURLWithPath:self.packagePath] progressBlock:progressBlock error:error];
}
- (BOOL)canInstallSilently
+33 -10
View File
@@ -23,6 +23,7 @@
@interface SUHost ()
@property (strong, readwrite) NSBundle *bundle;
@property (nonatomic, readonly) BOOL isMainBundle;
@property (copy) NSString *defaultsDomain;
@property (assign) BOOL usesStandardUserDefaults;
@@ -31,6 +32,7 @@
@implementation SUHost
@synthesize bundle;
@synthesize isMainBundle = _isMainBundle;
@synthesize defaultsDomain;
@synthesize usesStandardUserDefaults;
@@ -41,10 +43,12 @@
NSParameterAssert(aBundle);
self.bundle = aBundle;
if (![self.bundle bundleIdentifier]) {
SULog(@"Error: the bundle being updated at %@ has no %@! This will cause preference read/write to not work properly.", self.bundle, kCFBundleIdentifierKey);
SULog(SULogLevelError, @"Error: the bundle being updated at %@ has no %@! This will cause preference read/write to not work properly.", self.bundle, kCFBundleIdentifierKey);
}
_isMainBundle = [aBundle isEqualTo:[NSBundle mainBundle]];
self.defaultsDomain = [self.bundle objectForInfoDictionaryKey:SUDefaultsDomainKey];
self.defaultsDomain = [self objectForInfoDictionaryKey:SUDefaultsDomainKey];
if (!self.defaultsDomain) {
self.defaultsDomain = [self.bundle bundleIdentifier];
}
@@ -72,18 +76,18 @@
name = [self objectForInfoDictionaryKey:@"SUBundleName"];
if (name && name.length > 0) return name;
name = [self.bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"];
name = [self objectForInfoDictionaryKey:@"CFBundleDisplayName"];
if (name && name.length > 0) return name;
name = [self objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey];
if (name && name.length > 0) return name;
return [[[NSFileManager defaultManager] displayNameAtPath:[self.bundle bundlePath]] stringByDeletingPathExtension];
return [[[NSFileManager defaultManager] displayNameAtPath:[self bundlePath]] stringByDeletingPathExtension];
}
- (NSString *__nonnull)version
{
NSString *version = [self.bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *version = [self objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
if (!version || [version isEqualToString:@""])
[NSException raise:@"SUNoVersionException" format:@"This host (%@) has no %@! This attribute is required.", [self bundlePath], (__bridge NSString *)kCFBundleVersionKey];
return version;
@@ -91,7 +95,7 @@
- (NSString *__nonnull)displayVersion
{
NSString *shortVersionString = [self.bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *shortVersionString = [self objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
if (shortVersionString)
return shortVersionString;
else
@@ -108,7 +112,7 @@
- (NSString *__nullable)publicDSAKey
{
// Maybe the key is just a string in the Info.plist.
NSString *key = [self.bundle objectForInfoDictionaryKey:SUPublicDSAKeyKey];
NSString *key = [self objectForInfoDictionaryKey:SUPublicDSAKeyKey];
if (key) {
return key;
}
@@ -123,7 +127,12 @@
if (!keyPath) {
return nil;
}
return [NSString stringWithContentsOfFile:keyPath encoding:NSASCIIStringEncoding error:nil];
NSError *error = nil;
key = [NSString stringWithContentsOfFile:keyPath encoding:NSASCIIStringEncoding error:&error];
if (error) {
SULog(SULogLevelError, @"Error loading %@: %@", keyPath, error);
}
return key;
}
- (NSString * __nullable)publicDSAKeyFileKey
@@ -133,12 +142,26 @@
- (id)objectForInfoDictionaryKey:(NSString *)key
{
return [self.bundle objectForInfoDictionaryKey:key];
if (self.isMainBundle) {
// Common fast path - if we're updating the main bundle, that means our updater and host bundle's lifetime is the same
// If the bundle happens to be updated or change, that means our updater process needs to be terminated first to do it safely
// Thus we can rely on the cached Info dictionary
return [self.bundle objectForInfoDictionaryKey:key];
} else {
// Slow path - if we're updating another bundle, we should read in the most up to date Info dictionary because
// the bundle can be replaced externally or even by us.
// This is the easiest way to read the Info dictionary values *correctly* despite some performance loss.
// A mutable method to reload the Info dictionary at certain points and have it cached at other points is challenging to do correctly.
CFDictionaryRef cfInfoDictionary = CFBundleCopyInfoDictionaryInDirectory((CFURLRef)self.bundle.bundleURL);
NSDictionary *infoDictionary = CFBridgingRelease(cfInfoDictionary);
return [infoDictionary objectForKey:key];
}
}
- (BOOL)boolForInfoDictionaryKey:(NSString *)key
{
return [[self objectForInfoDictionaryKey:key] boolValue];
return [(NSNumber *)[self objectForInfoDictionaryKey:key] boolValue];
}
- (id)objectForUserDefaultsKey:(NSString *)defaultName
+6 -4
View File
@@ -105,7 +105,7 @@
*isGuidedPtr = isGuided;
if (!newAppDownloadPath) {
SULog(@"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
SULog(SULogLevelError, @"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
}
return newAppDownloadPath;
}
@@ -153,9 +153,11 @@
NSBundle *bundle = host.bundle;
assert(bundle != nil);
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
return normalizedAppPath;
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]];
// Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization
// rather than arbitrary Unicode form from Info.plist - #1017
return [NSString stringWithUTF8String:[normalizedAppPath fileSystemRepresentation]];
}
@end
+1 -1
View File
@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
// Any installation work after the user application has been terminated. This is where the final installation work can be done.
// After this stage is done, the user application may be relaunched.
// Should be able to be called from non-main thread
- (BOOL)performFinalInstallation:(NSError **)error;
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error;
// Indicates whether or not this installer can install the update silently in the background, without hindering the user
// Should be thread safe
+20 -23
View File
@@ -1,32 +1,29 @@
/*
* SULog.h
* EyeTV
*
* Created by Uli Kusterer on 12/03/2009.
* Copyright 2008 Elgato Systems GmbH. All rights reserved.
*
*/
/*
Log output for troubleshooting Sparkle failures on end-user machines.
Your tech support will hug you if you tell them about this.
*/
//
// SULog.h
// Sparkle
//
// Created by Mayur Pawashe on 5/18/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#ifndef SULOG_H
#define SULOG_H
// -----------------------------------------------------------------------------
// Headers:
// -----------------------------------------------------------------------------
#include <Foundation/Foundation.h>
typedef NS_ENUM(uint8_t, SULogLevel) {
// This level is for information that *might* result a failure
// For now until other levels are added, this may serve as a level for other information as well
SULogLevelDefault,
// This level is for errors that occurred
SULogLevelError
};
// -----------------------------------------------------------------------------
// Prototypes:
// -----------------------------------------------------------------------------
void SUClearLog(void);
void SULog(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2);
// Logging utlity function that is thread-safe
// On 10.12 or later this uses os_log
// Otherwise on older systems this uses ASL
// For debugging command line tools, you may have to use Console.app or log(1) to view log messages
// Try to keep log messages as compact/short as possible
void SULog(SULogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
#endif
+112 -62
View File
@@ -1,80 +1,130 @@
/*
* SULog.m
* EyeTV
*
* Created by Uli Kusterer on 12/03/2009.
* Copyright 2009 Elgato Systems GmbH. All rights reserved.
*
*/
// -----------------------------------------------------------------------------
// Headers:
// -----------------------------------------------------------------------------
//
// SULog.m
// Sparkle
//
// Created by Mayur Pawashe on 5/18/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#include "SULog.h"
#include <asl.h>
#include <Availability.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
#include <os/log.h>
#else
typedef struct os_log_s *os_log_t;
#define os_log_create(subsystem, category) nil
#define os_log(log, format, ...)
#define os_log_error(log, format, ...)
#endif
#include "AppKitPrevention.h"
#import "SUOperatingSystem.h"
// -----------------------------------------------------------------------------
// Constants:
// -----------------------------------------------------------------------------
static NSString *const SULogFilePath = @"~/Library/Logs/SparkleUpdateLog.log";
// For converting constants to string literals using the preprocessor
#define STRINGIFY(x) #x
#define TO_STRING(x) STRINGIFY(x)
// -----------------------------------------------------------------------------
// SUClearLog:
// Erase the log at the start of an update. We don't want to litter the
// user's hard disk with logging data that's mostly unused, so each app
// should clear the log before it starts updating, so only the most recent
// update is kept around.
//
// TAKES:
// sender - Object that sent this message, typically of type X.
// -----------------------------------------------------------------------------
void SUClearLog(void)
void SULog(SULogLevel level, NSString *format, ...)
{
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "w");
if (logfile) {
fclose(logfile);
SULog(@"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath:[[NSBundle mainBundle] bundlePath]]);
}
}
static aslclient client;
static dispatch_queue_t queue;
static dispatch_once_t onceToken;
static os_log_t logger;
static BOOL hasOSLogging;
// -----------------------------------------------------------------------------
// SULog:
// Like NSLog, but logs to one specific log file. Each line is prefixed
// with the current date and time, to help in regressing issues.
//
// TAKES:
// format - NSLog/printf-style format string.
// ... - More parameters depending on format string's contents.
// -----------------------------------------------------------------------------
dispatch_once(&onceToken, ^{
NSBundle *mainBundle = [NSBundle mainBundle];
void SULog(NSString *format, ...)
{
static BOOL loggedYet = NO;
if (!loggedYet) {
loggedYet = YES;
SUClearLog();
hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}];
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
hasOSLogging = NO;
#endif
if (hasOSLogging) {
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
// This creates a thread-safe object
logger = os_log_create(subsystem, "Sparkle");
#pragma clang diagnostic pop
} else {
uint32_t options = ASL_OPT_NO_DELAY;
// Act the same way os_log() does; don't log to stderr if a terminal device is attached
if (!isatty(STDERR_FILENO)) {
options |= ASL_OPT_STDERR;
}
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
}
});
if (!hasOSLogging && client == NULL) {
return;
}
va_list ap;
va_start(ap, format);
NSString *theStr = [[NSString alloc] initWithFormat:format arguments:ap];
NSLog(@"Sparkle: %@", theStr);
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "a");
if (logfile) {
theStr = [NSString stringWithFormat:@"%@: %@\n", [NSDate date], theStr];
NSData *theData = [theStr dataUsingEncoding:NSUTF8StringEncoding];
fwrite([theData bytes], 1, [theData length], logfile);
fclose(logfile);
}
NSString *logMessage = [[NSString alloc] initWithFormat:format arguments:ap];
va_end(ap);
// Use os_log if available (on 10.12+)
if (hasOSLogging) {
// We'll make all of our messages formatted as public; just don't log sensitive information.
// Note we don't take advantage of info like the source line number because we wrap this macro inside our own function
// And we don't really leverage of os_log's deferred formatting processing because we format the string before passing it in
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
switch (level) {
case SULogLevelDefault:
// See docs for OS_LOG_TYPE_DEFAULT
// By default, OS_LOG_TYPE_DEFAULT seems to be more noticable than OS_LOG_TYPE_INFO
os_log(logger, "%{public}@", logMessage);
break;
case SULogLevelError:
// See docs for OS_LOG_TYPE_ERROR
os_log_error(logger, "%{public}@", logMessage);
break;
}
#pragma clang diagnostic pop
return;
}
// Otherwise use ASL
// Make sure we do not async, because if we async, the log may not be delivered deterministically
dispatch_sync(queue, ^{
aslmsg message = asl_new(ASL_TYPE_MSG);
if (message == NULL) {
return;
}
if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) {
return;
}
int levelSetResult;
switch (level) {
case SULogLevelDefault:
// Just use one level below the error level
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_WARNING));
break;
case SULogLevelError:
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_ERR));
break;
}
if (levelSetResult != 0) {
return;
}
asl_send(client, message);
});
}
+1 -1
View File
@@ -32,7 +32,7 @@
NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"];
assert(url != nil);
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url];
NSArray *components = [ [dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."];
NSArray<NSString *> *components = [ (NSString *)[dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."];
version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0;
version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0;
version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0;
+2 -2
View File
@@ -49,7 +49,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
return YES;
}
- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError *__autoreleasing*)error
{
// Run installer using the "open" command to ensure it is launched in front of current application.
// -W = wait until the app has quit.
@@ -63,7 +63,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
[installer waitUntilExit];
}
@catch (NSException *exception) {
SULog(@"Error: Failed to launch package installer: %@", exception);
SULog(SULogLevelError, @"Error: Failed to launch package installer: %@", exception);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Package installer failed to launch." }];
}
+2 -2
View File
@@ -96,11 +96,11 @@
NSError *error = nil;
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
SULog(@"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
// Get the file size.
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
NSUInteger expectedLength = [[attributes objectForKey:NSFileSize] unsignedIntegerValue];
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
if (expectedLength > 0) {
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
+85 -42
View File
@@ -50,152 +50,195 @@
{
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *trimmedVersion = @"";
if (bundleVersion != nil) {
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
}
return trimmedVersion.length > 0 ? trimmedVersion : nil;
}
- (BOOL)performInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath error:(NSError * __autoreleasing *)error
- (BOOL)performInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host fileOperationToolPath:(NSString *)fileOperationToolPath progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
{
if (installationURL == nil || newURL == nil) {
// this really shouldn't happen but just in case
SULog(@"Failed to perform installation because either installation URL (%@) or new URL (%@) is nil", installationURL, newURL);
SULog(SULogLevelError, @"Failed to perform installation because either installation URL (%@) or new URL (%@) is nil", installationURL, newURL);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because the paths to install at and from are not valid" }];
}
return NO;
}
if (progress) {
progress(1/10.0);
}
SUFileManager *fileManager = [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath];
// Create a temporary directory for our new app that resides on our destination's volume
NSString *preferredName = [installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"];
NSURL *installationDirectory = installationURL.URLByDeletingLastPathComponent;
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:preferredName appropriateForDirectoryURL:installationDirectory error:error];
if (tempNewDirectoryURL == nil) {
SULog(@"Failed to make new temp directory");
SULog(SULogLevelError, @"Failed to make new temp directory");
return NO;
}
if (progress) {
progress(2/10.0);
}
// Move the new app to our temporary directory
NSString *newURLLastPathComponent = newURL.lastPathComponent;
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:error]) {
SULog(@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path);
SULog(SULogLevelError, @"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(3/10.0);
}
// Release our new app from quarantine, fix its owner and group IDs, and update its modification time while it's at our temporary destination
// We must leave moving the app to its destination as the final step in installing it, so that
// it's not possible our new app can be left in an incomplete state at the final destination
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
// Not big enough of a deal to fail the entire installation
SULog(@"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
}
if (progress) {
progress(4/10.0);
}
NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath];
if (oldURL == nil) {
// this really shouldn't happen but just in case
SULog(@"Failed to construct URL from bundle path: %@", host.bundlePath);
SULog(SULogLevelError, @"Failed to construct URL from bundle path: %@", host.bundlePath);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to perform installation because a path could not be constructed for the old installation" }];
}
return NO;
}
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:error]) {
// But this is big enough of a deal to fail
SULog(@"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(5/10.0);
}
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:error]) {
// Not a fatal error, but a pretty unfortunate one
SULog(@"Failed to update modification and access time of new app at %@", newTempURL.path);
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
}
if (progress) {
progress(6/10.0);
}
// Decide on a destination name we should use for the older app when we move it around the file system
NSString *oldDestinationName = nil;
if (SPARKLE_APPEND_VERSION_NUMBER) {
NSString *oldBundleVersion = [self bundleVersionAppropriateForFilenameFromHost:host];
oldDestinationName = [oldURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingFormat:@" (%@)", oldBundleVersion != nil ? oldBundleVersion : @"old"];
} else {
oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension;
}
NSString *oldURLExtension = oldURL.pathExtension;
NSString *oldDestinationNameWithPathExtension = [oldDestinationName stringByAppendingPathExtension:oldURLExtension];
NSURL *oldURLDirectory = oldURL.URLByDeletingLastPathComponent;
// Create a temporary directory for our old app that resides on its volume
NSURL *tempOldDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldURLDirectory error:error];
if (tempOldDirectoryURL == nil) {
SULog(@"Failed to create temporary directory for old app at %@", oldURL.path);
SULog(SULogLevelError, @"Failed to create temporary directory for old app at %@", oldURL.path);
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(7/10.0);
}
// Move the old app to the temporary directory
NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension];
if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) {
SULog(@"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path);
SULog(SULogLevelError, @"Failed to move the old app at %@ to a temporary location at %@", oldURL.path, oldTempURL.path);
// Just forget about our updated app on failure
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(8/10.0);
}
// Move the new app to its final destination
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) {
SULog(@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path);
// Forget about our updated app on failure
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
// Attempt to restore our old app back the way it was on failure
[fileManager moveItemAtURL:oldTempURL toURL:oldURL error:NULL];
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
return NO;
}
if (progress) {
progress(9/10.0);
}
// From here on out, we don't really need to bring up authorization if we haven't done so prior
SUFileManager *constrainedFileManager = [fileManager fileManagerByPreservingAuthorizationRights];
// Cleanup
[constrainedFileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
[constrainedFileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
if (progress) {
progress(10/10.0);
}
return YES;
}
- (BOOL)performInitialInstallation:(NSError * __autoreleasing *)error
{
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
// Prevent malicious downgrades
if (!allowDowngrades) {
NSString *hostVersion = [self.host version];
NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
NSString *updateVersion = [bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
id<SUVersionComparison> comparator = [[SUStandardVersionComparator alloc] init];
if (!updateVersion || [comparator compareVersion:hostVersion toVersion:updateVersion] == NSOrderedDescending) {
if (error != NULL) {
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, [bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]];
NSString *errorMessage = [NSString stringWithFormat:@"For security reasons, updates that downgrade version of the application are not allowed. Refusing to downgrade app from version %@ to %@. Aborting update.", hostVersion, updateVersion];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
}
return NO;
@@ -204,9 +247,9 @@
return YES;
}
- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error
- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error
{
return [self performInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host fileOperationToolPath:self.fileOperationToolPath error:error];
return [self performInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host fileOperationToolPath:self.fileOperationToolPath progressBlock:cb error:error];
}
- (BOOL)canInstallSilently
+9 -18
View File
@@ -12,13 +12,17 @@
@interface SUScheduledUpdateDriver ()
@property (assign) BOOL showErrors;
@end
@implementation SUScheduledUpdateDriver
@synthesize showErrors;
- (instancetype)initWithUpdater:(id<SUUpdaterPrivate>)anUpdater
{
if ((self = [super initWithUpdater:anUpdater])) {
self.showErrors = NO;
}
return self;
}
- (void)didFindValidUpdate
{
@@ -39,21 +43,8 @@
[self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update.
}
- (void)abortUpdateWithError:(NSError *)error
{
if (self.showErrors) {
[super abortUpdateWithError:error];
} else {
// Call delegate separately here because otherwise it won't know we stopped.
// Normally this gets called by the superclass
id<SUUpdaterPrivate> updater = self.updater;
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didAbortWithError:)]) {
[updaterDelegate updater:self.updater didAbortWithError:error];
}
[self abortUpdate];
}
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
return YES;
}
@end
+9 -9
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1070" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUStatusController">
@@ -15,8 +15,8 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Set in Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window identifier="SUStatus" title="Set in Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="200" y="222" width="400" height="107"/>
@@ -55,7 +55,7 @@
</connections>
</progressIndicator>
<button verticalHuggingPriority="750" id="12">
<rect key="frame" x="272.00000009349748" y="12" width="114" height="32"/>
<rect key="frame" x="272" y="12" width="114" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES"/>
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="55">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -74,12 +74,12 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="statusText" id="17"/>
<binding destination="-2" name="hidden" keyPath="statusText" id="33">
<dictionary key="options">
<string key="NSValueTransformerName">NSIsNil</string>
</dictionary>
</binding>
<binding destination="-2" name="value" keyPath="statusText" id="17"/>
</connections>
</textField>
</subviews>
+36 -2
View File
@@ -11,10 +11,15 @@
#import "SUHost.h"
#import "SULocalizations.h"
#import "SUApplicationInfo.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
@interface SUStatusController ()
static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUStatusController";
@interface SUStatusController () <NSTouchBarDelegate>
@property (copy) NSString *title, *buttonTitle;
@property (strong) SUHost *host;
@property NSButton *touchBarButton;
@end
@implementation SUStatusController
@@ -27,6 +32,7 @@
@synthesize actionButton;
@synthesize progressBar;
@synthesize statusTextField;
@synthesize touchBarButton;
- (instancetype)initWithHost:(SUHost *)aHost
{
@@ -66,7 +72,7 @@
- (NSImage *)applicationIcon
{
return [SUApplicationInfo bestIconForBundle:self.host.bundle];
return [SUApplicationInfo bestIconForHost:self.host];
}
- (void)beginActionWithTitle:(NSString *)aTitle maxProgressValue:(double)aMaxProgressValue statusText:(NSString *)aStatusText
@@ -93,6 +99,10 @@
[self.actionButton setTarget:target];
[self.actionButton setAction:action];
[self.actionButton setKeyEquivalent:isDefault ? @"\r" : @""];
self.touchBarButton.target = self.actionButton.target;
self.touchBarButton.action = self.actionButton.action;
self.touchBarButton.keyEquivalent = self.actionButton.keyEquivalent;
// 06/05/2008 Alex: Avoid a crash when cancelling during the extraction
[self setButtonEnabled:(target != nil)];
@@ -123,4 +133,28 @@
[self.progressBar setUsesThreadedAnimation:YES];
}
- (NSTouchBar *)makeTouchBar
{
NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init];
touchBar.defaultItemIdentifiers = @[ SUStatusControllerTouchBarIndentifier,];
touchBar.principalItemIdentifier = SUStatusControllerTouchBarIndentifier;
touchBar.delegate = self;
return touchBar;
}
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macos(10.12.2))
{
if ([identifier isEqualToString:SUStatusControllerTouchBarIndentifier]) {
NSCustomTouchBarItem *item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier];
SUTouchBarButtonGroup *group = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.actionButton,]];
item.viewController = group;
self.touchBarButton = group.buttons.firstObject;
[self.touchBarButton bind:@"title" toObject:self.actionButton withKeyPath:@"title" options:nil];
[self.touchBarButton bind:@"enabled" toObject:self.actionButton withKeyPath:@"enabled" options:nil];
return item;
}
return nil;
}
@end
+21
View File
@@ -0,0 +1,21 @@
//
// SUTouchBarButtonGroup.h
// Sparkle
//
// Created by Yuxin Wang on 05/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface SUTouchBarButtonGroup : NSViewController
@property (nonatomic, readonly, copy) NSArray<NSButton *> *buttons;
- (instancetype)initByReferencingButtons:(NSArray<NSButton *> *)buttons;
@end
NS_ASSUME_NONNULL_END
+75
View File
@@ -0,0 +1,75 @@
//
// SUTouchBarButtonGroup.m
// Sparkle
//
// Created by Yuxin Wang on 05/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
#import "SUTouchBarButtonGroup.h"
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
@interface NSButton (SierraSDK)
+ (instancetype)buttonWithTitle:(NSString*)title target:(id)target action:(SEL)action;
@end
#endif
@implementation SUTouchBarButtonGroup
@synthesize buttons = _buttons;
- (instancetype)initByReferencingButtons:(NSArray<NSButton *> *)buttons
{
if (!(self = [super init]))
return self;
NSView *buttonGroup = [[NSView alloc] initWithFrame:NSZeroRect];
self.view = buttonGroup;
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray array];
NSMutableArray<NSButton *> *buttonCopies = [NSMutableArray arrayWithCapacity:buttons.count];
for (NSUInteger i = 0; i < buttons.count; i++) {
NSButton *button = [buttons objectAtIndex:i];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action];
#pragma clang diagnostic pop
buttonCopy.tag = button.tag;
buttonCopy.enabled = button.enabled;
// Must be set explicitly, because NSWindow clears it
// https://github.com/sparkle-project/Sparkle/pull/987#issuecomment-271539319
if (i == 0) {
buttonCopy.keyEquivalent = @"\r";
}
buttonCopy.translatesAutoresizingMaskIntoConstraints = NO;
[buttonCopies addObject:buttonCopy];
[buttonGroup addSubview:buttonCopy];
// Custom layout is used for equal width buttons, to look more keyboard-like and mimic standard alerts
// https://github.com/sparkle-project/Sparkle/pull/987#issuecomment-272324726
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
if (i == 0) {
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]];
} else {
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:[buttonCopies objectAtIndex:i - 1] attribute:NSLayoutAttributeLeading multiplier:1.0 constant:(i == 1) ? -8 : -32]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[buttonCopies objectAtIndex:i - 1] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]];
constraints.lastObject.priority = 250;
}
if (i == buttons.count - 1) {
[constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]];
}
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
[NSLayoutConstraint activateConstraints:constraints];
#pragma clang diagnostic pop
_buttons = buttonCopies;
return self;
}
@end
+91
View File
@@ -0,0 +1,91 @@
//
// SUTouchBarForwardDeclarations.h
// Sparkle
//
// Created by Yuxin Wang on 18/01/2017.
// Copyright © 2017 Sparkle Project. All rights reserved.
//
// Once Sparkle no longer supports OSX 10.12.0, this file can be deleted.
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101201
NS_ASSUME_NONNULL_BEGIN
@class NSTouchBar;
@class NSTouchBarItem;
@class NSCustomTouchBarItem;
typedef NSString * NSTouchBarItemIdentifier;
typedef NSString * NSTouchBarCustomizationIdentifier;
@protocol NSTouchBarDelegate;
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSTouchBar : NSObject <NSCoding>
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
@property (copy, nullable) NSTouchBarCustomizationIdentifier customizationIdentifier;
@property (copy) NSArray<NSTouchBarItemIdentifier> *customizationAllowedItemIdentifiers;
@property (copy) NSArray<NSTouchBarItemIdentifier> *customizationRequiredItemIdentifiers;
@property (copy) NSArray<NSTouchBarItemIdentifier> *defaultItemIdentifiers;
@property (copy, readonly) NSArray<NSTouchBarItemIdentifier> *itemIdentifiers;
@property (copy, nullable) NSTouchBarItemIdentifier principalItemIdentifier;
@property (copy, nullable) NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier;
@property (copy) NSSet<NSTouchBarItem *> *templateItems;
@property (nullable, weak) id <NSTouchBarDelegate> delegate;
- (nullable __kindof NSTouchBarItem *)itemForIdentifier:(NSTouchBarItemIdentifier)identifier;
@property (readonly, getter=isVisible) BOOL visible;
@end
@protocol NSTouchBarDelegate<NSObject>
@optional
- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
@end
typedef float NSTouchBarItemPriority;
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSTouchBarItem : NSObject <NSCoding>
- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@property (readonly, copy) NSTouchBarItemIdentifier identifier;
@property NSTouchBarItemPriority visibilityPriority;
@property (readonly, nullable) NSView *view;
@property (readonly, nullable) NSViewController *viewController;
@property (readonly, copy) NSString *customizationLabel;
@property (readonly, getter=isVisible) BOOL visible;
@end
NS_CLASS_AVAILABLE_MAC(10_12_2)
@interface NSCustomTouchBarItem : NSTouchBarItem
@property (readwrite, strong) __kindof NSView *view;
@property (readwrite, strong, nullable) __kindof NSViewController *viewController;
@property (readwrite, copy, null_resettable) NSString *customizationLabel;
@end
NS_ASSUME_NONNULL_END
#else
// When compiling against the 10.12.1 SDK or later, just provide forward
// declarations to suppress the partial availability warnings.
@class NSTouchBar;
@protocol NSTouchBarDelegate;
@class NSTouchBarItem;
@class NSCustomTouchBarItem;
#endif
+1
View File
@@ -15,6 +15,7 @@
@class SUStatusController;
@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver
@property (assign) BOOL showErrors;
- (void)showAlert:(NSAlert *)alert;
- (IBAction)cancelDownload:(id)sender;
+68 -34
View File
@@ -45,11 +45,13 @@
@synthesize statusController;
@synthesize updateAlert;
@synthesize showErrors;
- (instancetype)initWithUpdater:(id<SUUpdaterPrivate>)anUpdater
{
if ((self = [super initWithUpdater:anUpdater])) {
self.automaticallyInstallUpdates = NO;
self.showErrors = YES;
}
return self;
}
@@ -85,12 +87,20 @@
}
// Only show the update alert if the app is active; otherwise, we'll wait until it is.
if ([NSApp isActive])
[[self.updateAlert window] makeKeyAndOrderFront:self];
else
if ([NSApp isActive]) {
NSWindow *window = [self.updateAlert window];
if ([self shouldDisableKeyboardShortcutForInstallButton]) {
[self.updateAlert disableKeyboardShortcutForInstallButton];
}
[window makeKeyAndOrderFront:self];
} else
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
}
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
return NO;
}
- (void)didNotFindUpdate
{
id<SUUpdaterPrivate> updater = self.updater;
@@ -159,10 +169,11 @@
[super downloadUpdate];
}
- (void)download:(NSURLDownload *)__unused download didReceiveResponse:(NSURLResponse *)response
- (void)downloaderDidReceiveExpectedContentLength:(int64_t) expectedContentLength
{
long long expectedContentLength = [response expectedContentLength];
[self.statusController setMaxProgressValue:expectedContentLength > 0 ? expectedContentLength : self.updateItem.contentLength];
dispatch_async(dispatch_get_main_queue(), ^{
[self.statusController setMaxProgressValue:expectedContentLength > 0 ? expectedContentLength : self.updateItem.contentLength];
});
}
- (NSString *)localizedStringFromByteCount:(long long)value
@@ -195,20 +206,24 @@
#pragma clang diagnostic pop
}
- (void)download:(NSURLDownload *)__unused download didReceiveDataOfLength:(NSUInteger)length
- (void)downloaderDidReceiveDataOfLength:(uint64_t) length
{
double newProgressValue = [self.statusController progressValue] + (double)length;
// In case our expected content length was incorrect
if (newProgressValue > [self.statusController maxProgressValue]) {
[self.statusController setMaxProgressValue:newProgressValue];
}
[self.statusController setProgressValue:newProgressValue];
if ([self.statusController maxProgressValue] > 0.0)
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue], [self localizedStringFromByteCount:(long long)self.statusController.maxProgressValue]]];
else
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue]]];
dispatch_async(dispatch_get_main_queue(), ^{
double newProgressValue = [self.statusController progressValue] + (double)length;
// In case our expected content length was incorrect
if (newProgressValue > [self.statusController maxProgressValue]) {
[self.statusController setMaxProgressValue:newProgressValue];
}
[self.statusController setProgressValue:newProgressValue];
if ([self.statusController maxProgressValue] > 0.0) {
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue], [self localizedStringFromByteCount:(long long)self.statusController.maxProgressValue]]];
} else {
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue]]];
}
});
}
- (IBAction)cancelDownload:(id)__unused sender
@@ -226,19 +241,29 @@
- (void)extractUpdate
{
// Now we have to extract the downloaded archive.
[self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
[self.statusController setButtonEnabled:NO];
dispatch_block_t updateUI = ^{
// Now we have to extract the downloaded archive.
[self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
[self.statusController setButtonEnabled:NO];
};
if (![NSThread mainThread]) {
dispatch_sync(dispatch_get_main_queue(), updateUI);
} else {
updateUI();
}
[super extractUpdate];
}
- (void)unarchiver:(id)__unused ua extractedProgress:(double)progress
{
// We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
if ([self.statusController maxProgressValue] == 0.0) {
[self.statusController setMaxProgressValue:1];
}
[self.statusController setProgressValue:progress];
dispatch_async(dispatch_get_main_queue(), ^{
// We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
if ([self.statusController maxProgressValue] == 0.0) {
[self.statusController setMaxProgressValue:1];
}
[self.statusController setProgressValue:progress];
});
}
- (void)unarchiverDidFinish:(id)__unused ua
@@ -285,12 +310,21 @@
- (void)abortUpdateWithError:(NSError *)error
{
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"Update Error!", nil);
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
[self showAlert:alert];
[super abortUpdateWithError:error];
void (^callback)(void) = ^{
if (self.showErrors) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"Update Error!", nil);
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
[self showAlert:alert];
}
[super abortUpdateWithError:error];
};
if ([NSThread isMainThread]) {
callback();
} else {
dispatch_sync(dispatch_get_main_queue(), callback);
}
}
- (void)abortUpdate
@@ -314,7 +348,7 @@
// are focused to inform the user since there is no dock icon to notify them.
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) { [NSApp activateIgnoringOtherApps:YES]; }
[alert setIcon:[SUApplicationInfo bestIconForBundle:self.host.bundle]];
[alert setIcon:[SUApplicationInfo bestIconForHost:self.host]];
[alert runModal];
if ([[updater delegate] respondsToSelector:@selector(updaterDidShowModalAlert:)])
+1
View File
@@ -31,6 +31,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
- (IBAction)installUpdate:sender;
- (IBAction)skipThisVersion:sender;
- (IBAction)remindMeLater:sender;
- (void)disableKeyboardShortcutForInstallButton;
@end
+34 -4
View File
@@ -21,6 +21,10 @@
#import "SUAppcastItem.h"
#import "SUApplicationInfo.h"
#import "SUSystemUpdateInfo.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdateAlert";
// WebKit protocols are not explicitly declared until 10.11 SDK, so
// declare dummy protocols to keep the build working on earlier SDKs.
@@ -31,7 +35,7 @@
@end
#endif
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate>
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate, NSTouchBarDelegate>
@property (strong) SUAppcastItem *updateItem;
@property (strong) SUHost *host;
@@ -89,6 +93,9 @@
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; }
- (void)disableKeyboardShortcutForInstallButton {
self.installButton.keyEquivalent = @"";
}
- (void)endWithSelection:(SUUpdateAlertChoice)choice
{
@@ -210,6 +217,10 @@
[self.automaticallyInstallUpdatesButton removeFromSuperview];
}
if ([self.updateItem isCriticalUpdate]) {
self.skipButton.enabled = NO;
}
[self.window center];
}
@@ -221,7 +232,7 @@
- (NSImage *)applicationIcon
{
return [SUApplicationInfo bestIconForBundle:self.host.bundle];
return [SUApplicationInfo bestIconForHost:self.host];
}
- (NSString *)titleText
@@ -252,7 +263,7 @@
return finalString;
}
- (void)webView:(WebView *)sender didFinishLoadForFrame:frame
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
if ([frame parentFrame] == nil) {
self.webViewFinishedLoading = YES;
@@ -269,7 +280,7 @@
// Do not allow redirects to dangerous protocols such as file://
if (!whitelistedSafe) {
SULog(@"Blocked display of %@ URL which may be dangerous", scheme);
SULog(SULogLevelDefault, @"Blocked display of %@ URL which may be dangerous", scheme);
[listener ignore];
return;
}
@@ -316,4 +327,23 @@
return webViewMenuItems;
}
- (NSTouchBar *)makeTouchBar
{
NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init];
touchBar.defaultItemIdentifiers = @[SUUpdateAlertTouchBarIndentifier,];
touchBar.principalItemIdentifier = SUUpdateAlertTouchBarIndentifier;
touchBar.delegate = self;
return touchBar;
}
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macos(10.12.2))
{
if ([identifier isEqualToString:SUUpdateAlertTouchBarIndentifier]) {
NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier];
item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.installButton, self.laterButton, self.skipButton]];
return item;
}
return nil;
}
@end
+3 -1
View File
@@ -15,7 +15,7 @@ extern NSString *const SUUpdateDriverFinishedNotification;
@class SUHost, SUUpdater;
@protocol SUUpdaterPrivate;
@interface SUUpdateDriver : NSObject <NSURLDownloadDelegate>
@interface SUUpdateDriver : NSObject
// We only have SUUpdater* forward declared intentionally (i.e, not #import'ing SUUpdater.h in the update drivers)
// This is so we can minimize what we can access using SUUpdaterPrivate
@@ -32,6 +32,8 @@ extern NSString *const SUUpdateDriverFinishedNotification;
@property (getter=isInterruptible, readonly) BOOL interruptible;
@property (readonly) BOOL finished;
@property (readonly) BOOL downloadsAppcastInBackground;
@property (readonly) BOOL downloadsUpdatesInBackground;
@property BOOL automaticallyInstallUpdates;
@end
+9 -1
View File
@@ -56,9 +56,17 @@ NSString *const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
return NO;
}
-(BOOL)downloadsAppcastInBackground {
return YES;
}
-(BOOL)downloadsUpdatesInBackground {
return NO;
}
- (void)showAlert:(NSAlert *)alert {
// Only UI-based subclass shows the actual alert
SULog(@"ALERT: %@\n%@", alert.messageText, alert.informativeText);
SULog(SULogLevelDefault, @"ALERT: %@\n%@", alert.messageText, alert.informativeText);
}
@end
+1 -1
View File
@@ -24,7 +24,7 @@ typedef NS_ENUM(NSInteger, SUPermissionPromptResult) {
+ (void)promptWithHost:(SUHost *)host systemProfile:(NSArray *)profile reply:(void (^)(SUUpdatePermissionResponse *))reply;
- (IBAction)toggleMoreInfo:(id)sender;
- (IBAction)finishPrompt:(id)sender;
- (IBAction)finishPrompt:(NSButton *)sender;
@end
#endif
+32 -5
View File
@@ -13,8 +13,12 @@
#import "SUConstants.h"
#import "SULocalizations.h"
#import "SUApplicationInfo.h"
#import "SUTouchBarForwardDeclarations.h"
#import "SUTouchBarButtonGroup.h"
@interface SUUpdatePermissionPrompt ()
static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdatePermissionPrompt";
@interface SUUpdatePermissionPrompt () <NSTouchBarDelegate>
@property (assign) BOOL isShowingMoreInfo;
@property (assign) BOOL shouldSendProfile;
@@ -25,6 +29,8 @@
@property (weak) IBOutlet NSView *moreInfoView;
@property (weak) IBOutlet NSButton *moreInfoButton;
@property (weak) IBOutlet NSTableView *profileTableView;
@property (weak) IBOutlet NSButton *cancelButton;
@property (weak) IBOutlet NSButton *checkButton;
@property (nonatomic, readonly) void (^reply)(SUUpdatePermissionResponse *);
@@ -41,10 +47,12 @@
@synthesize moreInfoView;
@synthesize moreInfoButton;
@synthesize profileTableView;
@synthesize cancelButton;
@synthesize checkButton;
- (BOOL)shouldAskAboutProfile
{
return [[self.host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue];
return [(NSNumber *)[self.host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue];
}
- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile reply:(void (^)(SUUpdatePermissionResponse *))reply
@@ -72,7 +80,7 @@
}
if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen
SUUpdatePermissionPrompt *prompt = [[[self class] alloc] initWithHost:host systemProfile:profile reply:reply];
SUUpdatePermissionPrompt *prompt = [(SUUpdatePermissionPrompt *)[[self class] alloc] initWithHost:host systemProfile:profile reply:reply];
NSWindow *window = [prompt window];
if (window) {
[NSApp runModalForWindow:window];
@@ -100,7 +108,7 @@
- (NSImage *)icon
{
return [SUApplicationInfo bestIconForBundle:self.host.bundle];
return [SUApplicationInfo bestIconForHost:self.host];
}
- (NSString *)promptDescription
@@ -151,7 +159,7 @@
[self.moreInfoView setHidden:!self.isShowingMoreInfo];
}
- (IBAction)finishPrompt:(id)sender
- (IBAction)finishPrompt:(NSButton *)sender
{
SUUpdatePermissionResponse *response = [[SUUpdatePermissionResponse alloc] initWithAutomaticUpdateChecks:([sender tag] == 1) sendSystemProfile:self.shouldSendProfile];
self.reply(response);
@@ -160,4 +168,23 @@
[NSApp stopModal];
}
- (NSTouchBar *)makeTouchBar
{
NSTouchBar *touchBar = [(NSTouchBar *)[NSClassFromString(@"NSTouchBar") alloc] init];
touchBar.defaultItemIdentifiers = @[SUUpdatePermissionPromptTouchBarIndentifier,];
touchBar.principalItemIdentifier = SUUpdatePermissionPromptTouchBarIndentifier;
touchBar.delegate = self;
return touchBar;
}
- (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macos(10.12.2))
{
if ([identifier isEqualToString:SUUpdatePermissionPromptTouchBarIndentifier]) {
NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier];
item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.checkButton, self.cancelButton]];
return item;
}
return nil;
}
@end
+13 -13
View File
@@ -44,14 +44,14 @@
if (publicDSAKey == nil) {
prevalidatedDsaSignature = NO;
SULog(@"Failed to validate update before unarchiving because no DSA key was found");
SULog(SULogLevelError, @"Failed to validate update before unarchiving because no DSA key was found");
} else if (dsaSignature == nil) {
prevalidatedDsaSignature = NO;
SULog(@"Failed to validate update before unarchiving because no DSA signature was found");
SULog(SULogLevelError, @"Failed to validate update before unarchiving because no DSA signature was found");
} else {
prevalidatedDsaSignature = [SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:dsaSignature withPublicDSAKey:publicDSAKey];
if (!prevalidatedDsaSignature) {
SULog(@"DSA signature validation before unarchiving failed for update %@", downloadPath);
SULog(SULogLevelError, @"DSA signature validation before unarchiving failed for update %@", downloadPath);
}
}
@@ -86,7 +86,7 @@
// install source could point to a new bundle or a package
NSString *installSource = [SUInstaller installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:NULL];
if (installSource == nil) {
SULog(@"No suitable install is found in the update. The update will be rejected.");
SULog(SULogLevelError, @"No suitable install is found in the update. The update will be rejected.");
return NO;
}
@@ -98,7 +98,7 @@
// For package type updates, all we do is check if the DSA signature is valid
BOOL validationCheckSuccess = [SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
if (!validationCheckSuccess) {
SULog(@"DSA signature validation of the package failed. The update contains an installer package, and valid DSA signatures are mandatory for all installer packages. The update will be rejected. Sign the installer with a valid DSA key or use an .app bundle update instead.");
SULog(SULogLevelError, @"DSA signature validation of the package failed. The update contains an installer package, and valid DSA signatures are mandatory for all installer packages. The update will be rejected. Sign the installer with a valid DSA key or use an .app bundle update instead.");
}
return validationCheckSuccess;
} else {
@@ -107,7 +107,7 @@
}
} else if (isPackage) {
// We shouldn't get here because we don't validate packages before extracting them currently
SULog(@"Error: not expecting to find package after being required to validate update before extraction");
SULog(SULogLevelError, @"Error: not expecting to find package after being required to validate update before extraction");
return NO;
} else {
// Because we already validated the DSA signature, this is just a consistency check to see
@@ -115,7 +115,7 @@
// Currently, this case only gets hit for binary delta updates
NSError *error = nil;
if ([SUCodeSigningVerifier bundleAtURLIsCodeSigned:installSourceURL] && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:installSourceURL error:&error]) {
SULog(@"Failed to validate apple code sign signature on bundle after archive validation with error: %@", error);
SULog(SULogLevelError, @"Failed to validate apple code sign signature on bundle after archive validation with error: %@", error);
return NO;
} else {
return YES;
@@ -135,7 +135,7 @@
{
NSBundle *newBundle = [NSBundle bundleWithURL:newBundleURL];
if (newBundle == nil) {
SULog(@"No suitable bundle is found in the update. The update will be rejected.");
SULog(SULogLevelError, @"No suitable bundle is found in the update. The update will be rejected.");
return NO;
}
@@ -146,7 +146,7 @@
// Downgrade in DSA security should not be possible
if (publicDSAKey != nil && newPublicDSAKey == nil) {
SULog(@"A public DSA key is found in the old bundle but no public DSA key is found in the new update. For security reasons, the update will be rejected.");
SULog(SULogLevelError, @"A public DSA key is found in the old bundle but no public DSA key is found in the new update. For security reasons, the update will be rejected.");
return NO;
}
@@ -157,7 +157,7 @@
// However if the new and old DSA keys are the same, then this is a security measure.
if (newPublicDSAKey != nil) {
if (![SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:newPublicDSAKey]) {
SULog(@"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.",
SULog(SULogLevelError, @"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.",
dsaKeysMatch ? @"public key" : @"new public key shipped with the update");
return NO;
}
@@ -167,7 +167,7 @@
if (dsaKeysMatch) {
NSError *error = nil;
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL error:&error]) {
SULog(@"The update archive has a valid DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
SULog(SULogLevelError, @"The update archive has a valid DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
return NO;
}
} else {
@@ -176,13 +176,13 @@
NSString *dsaStatus = newPublicDSAKey ? @"has a new DSA key that doesn't match the previous one" : (publicDSAKey ? @"removes the DSA key" : @"isn't signed with a DSA key");
if (!hostIsCodeSigned || !updateIsCodeSigned) {
NSString *acsStatus = !hostIsCodeSigned ? @"old app hasn't been signed with app Code Signing" : @"new app isn't signed with app Code Signing";
SULog(@"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
SULog(SULogLevelError, @"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
return NO;
}
NSError *error = nil;
if (![SUCodeSigningVerifier codeSignatureAtBundleURL:host.bundle.bundleURL matchesSignatureAtBundleURL:newHost.bundle.bundleURL error:&error]) {
SULog(@"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
SULog(SULogLevelError, @"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
return NO;
}
}
+19 -8
View File
@@ -160,11 +160,7 @@ SU_EXPORT @interface SUUpdater : NSObject
The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString)
*/
#if __has_feature(objc_generics)
@property (copy) NSDictionary<NSString *, NSString *> *httpHeaders;
#else
@property (copy) NSDictionary *httpHeaders;
#endif
/*!
A property indicating whether or not the user's system profile information is sent when checking for updates.
@@ -179,15 +175,30 @@ SU_EXPORT @interface SUUpdater : NSObject
@property (nonatomic, copy) NSString *decryptionPassword;
/*!
Checks for updates and, if available, immediately downloads and installs them.
This function ignores normal update schedule, ignores user preferences,
and interrupts users with an unwanted immediate app update.
WARNING: this function should not be used in regular apps. This function
is a user-unfriendly hack only for very special cases, like unstable
rapidly-changing beta builds that would not run correctly if they were
even one day out of date.
Instead of this function you should set `SUAutomaticallyUpdate` to `YES`,
which will gracefully install updates when the app quits.
For UI-less/daemon apps that aren't usually quit, instead of this function,
you can use the delegate method
SUUpdaterDelegate::updater:willInstallUpdateOnQuit:immediateInstallationInvocation:
to immediately start installation when an update was found.
A progress dialog is shown but the user will never be prompted to read the
release notes.
This function will cause update to be downloaded twice if automatic updates are
enabled.
You may want to respond to the userDidCancelDownload delegate method in case
the user clicks the "Cancel" button while the update is downloading.
If you are writing a UI-less background application, you probably want to instead use
SUUpdaterDelegate::updater:willInstallUpdateOnQuit:immediateInstallationInvocation:
*/
- (void)installUpdatesIfAvailable;
+49 -10
View File
@@ -49,6 +49,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@property (strong) SUUpdateDriver *driver;
@property (strong) SUHost *host;
@property (copy) NSDate *updateLastCheckedDate;
@end
@implementation SUUpdater
@@ -61,6 +63,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@synthesize host;
@synthesize sparkleBundle;
@synthesize decryptionPassword;
@synthesize updateLastCheckedDate;
static NSMutableDictionary *sharedUpdaters = nil;
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
@@ -85,7 +88,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if (bundle == nil) bundle = [NSBundle mainBundle];
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
if (updater == nil) {
updater = [[[self class] alloc] initForBundle:bundle];
updater = [(SUUpdater *)[[self class] alloc] initForBundle:bundle];
}
return updater;
}
@@ -99,7 +102,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// Use explicit class to use the correct bundle even when subclassed
self.sparkleBundle = [NSBundle bundleForClass:[SUUpdater class]];
if (!self.sparkleBundle) {
SULog(@"Error: SUUpdater can't find Sparkle.framework it belongs to");
SULog(SULogLevelError, @"Error: SUUpdater can't find Sparkle.framework it belongs to");
return nil;
}
@@ -170,7 +173,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
[self showAlertText:SULocalizedString(@"Insecure feed URL is blocked in macOS 10.11", nil)
informativeText:[NSString stringWithFormat:SULocalizedString(@"You must change the feed URL (%@) to use HTTPS or disable App Transport Security.\n\nFor more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", nil), [feedURL absoluteString]]];
} else if (!isMainBundle) {
SULog(@"WARNING: Serving updates over HTTP may be blocked in macOS 10.11. Please change the feed URL (%@) to use HTTPS. For more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", feedURL);
SULog(SULogLevelDefault, @"WARNING: Serving updates over HTTP may be blocked in macOS 10.11. Please change the feed URL (%@) to use HTTPS. For more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", feedURL);
}
}
#endif
@@ -208,6 +211,14 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if (!hasLaunchedBefore) {
[self.host setBool:YES forUserDefaultsKey:SUHasLaunchedBeforeKey];
}
// Relanching from app update?
else if ([self.host boolForUserDefaultsKey:SUUpdateRelaunchingMarkerKey]) {
if ([self.delegate respondsToSelector:@selector(updaterDidRelaunchApplication:)]) {
[self.delegate updaterDidRelaunchApplication:self];
}
//Reset flag back to NO.
[self.host setBool:NO forUserDefaultsKey:SUUpdateRelaunchingMarkerKey];
}
if (shouldPrompt) {
NSArray<NSDictionary<NSString *, NSString *> *> *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host];
@@ -245,13 +256,19 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (NSDate *)lastUpdateCheckDate
{
return [self.host objectForUserDefaultsKey:SULastCheckTimeKey];
if (![self updateLastCheckedDate])
{
[self setUpdateLastCheckedDate:[self.host objectForUserDefaultsKey:SULastCheckTimeKey]];
}
return [self updateLastCheckedDate];
}
- (void)updateLastUpdateCheckDate
{
[self willChangeValueForKey:@"lastUpdateCheckDate"];
[self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
[self setUpdateLastCheckedDate:[NSDate date]];
[self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey];
[self didChangeValueForKey:@"lastUpdateCheckDate"];
}
@@ -282,8 +299,23 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (void)checkForUpdatesInBackground
{
BOOL automatic = [self automaticallyDownloadsUpdates];
if (!automatic) {
if (@available(macOS 10.9, *)) {
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"];
BOOL dnd = [defaults boolForKey:@"doNotDisturb"];
if (dnd) {
SULog(SULogLevelDefault, @"Delayed update, because Do Not Disturb is on");
[self updateLastUpdateCheckDate];
[self scheduleNextUpdateCheck];
return;
}
}
}
// Do not use reachability for a preflight check. This can be deceptive and a bad idea. Apple does not recommend doing it.
SUUpdateDriver *theUpdateDriver = [[([self automaticallyDownloadsUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class])alloc] initWithUpdater:self];
SUUpdateDriver *theUpdateDriver = [(SUBasicUpdateDriver *)[(automatic ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class])alloc] initWithUpdater:self];
[self checkForUpdatesWithDriver:theUpdateDriver];
}
@@ -367,7 +399,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
}
@catch (NSException *)
{
SULog(@"Error: [SUUpdater unregisterAsObserver] called, but the updater wasn't registered as an observer.");
SULog(SULogLevelError, @"Error: [SUUpdater unregisterAsObserver] called, but the updater wasn't registered as an observer.");
}
}
@@ -483,6 +515,13 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
return [self.host boolForKey:SUSendProfileInfoKey];
}
static NSString *escapeURLComponent(NSString *str) {
return [[[[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
stringByReplacingOccurrencesOfString:@"=" withString:@"%3d"]
stringByReplacingOccurrencesOfString:@"&" withString:@"%26"]
stringByReplacingOccurrencesOfString:@"+" withString:@"%2b"];
}
- (NSURL *)parameterizedFeedURL
{
NSURL *baseFeedURL = [self feedURL];
@@ -498,7 +537,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
NSArray *parameters = @[];
NSArray<NSDictionary<NSString *, NSString *> *> *parameters = @[];
if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
parameters = [parameters arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
}
@@ -511,8 +550,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// Build up the parameterized URL.
NSMutableArray *parameterStrings = [NSMutableArray array];
for (NSDictionary *currentProfileInfo in parameters) {
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[[currentProfileInfo objectForKey:@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[[currentProfileInfo objectForKey:@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
for (NSDictionary<NSString *, NSString *> *currentProfileInfo in parameters) {
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", escapeURLComponent([[currentProfileInfo objectForKey:@"key"] description]), escapeURLComponent([[currentProfileInfo objectForKey:@"value"] description])]];
}
NSString *separatorCharacter = @"?";
+31 -4
View File
@@ -64,11 +64,7 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
\return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
*/
#if __has_feature(objc_generics)
- (NSArray<NSDictionary<NSString *, NSString *> *> *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
#else
- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
#endif
/*!
Returns a custom appcast URL.
@@ -137,6 +133,14 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
*/
- (void)updater:(SUUpdater *)updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request;
/*!
Called immediately after succesfull download of the specified update.
\param updater The SUUpdater instance.
\param item The appcast item corresponding to the update that has been downloaded.
*/
- (void)updater:(SUUpdater *)updater didDownloadUpdate:(SUAppcastItem *)item;
/*!
Called after the specified update failed to download.
@@ -153,6 +157,22 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
*/
- (void)userDidCancelDownload:(SUUpdater *)updater;
/*!
Called immediately before extracting the specified downloaded update.
\param updater The SUUpdater instance.
\param item The appcast item corresponding to the update that is proposed to be extracted.
*/
- (void)updater:(SUUpdater *)updater willExtractUpdate:(SUAppcastItem *)item;
/*!
Called immediately after extracting the specified downloaded update.
\param updater The SUUpdater instance.
\param item The appcast item corresponding to the update that has been extracted.
*/
- (void)updater:(SUUpdater *)updater didExtractUpdate:(SUAppcastItem *)item;
/*!
Called immediately before installing the specified update.
@@ -192,6 +212,13 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
*/
- (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
/*!
Called immediately after relaunching. SUUpdater delegate must be set before applicationDidFinishLaunching: to catch this event.
\param updater The SUUpdater instance.
*/
- (void)updaterDidRelaunchApplication:(SUUpdater *)updater;
/*!
Returns an object that compares version numbers to determine their arithmetic relation to each other.
+10
View File
@@ -27,6 +27,12 @@
- (void)closeCheckingWindow
{
if (![NSThread isMainThread]) {
dispatch_sync(dispatch_get_main_queue(), ^{
[self closeCheckingWindow];
});
return;
}
if (self.checkingController)
{
[[self.checkingController window] close];
@@ -80,6 +86,10 @@
[super abortUpdate];
}
-(BOOL)downloadsAppcastInBackground {
return NO;
}
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
{
// We don't check to see if this update's been skipped, because the user explicitly *asked* if he had the latest version.
+9
View File
@@ -21,4 +21,13 @@
#import "SUVersionDisplayProtocol.h"
#import "SUErrors.h"
#import "SPUDownloader.h"
#import "SPUDownloaderDelegate.h"
#import "SPUDownloaderDeprecated.h"
#import "SPUDownloadData.h"
#import "SPUDownloaderProtocol.h"
#import "SPUDownloaderSession.h"
#import "SPUURLRequest.h"
#import "SUCodeSigningVerifier.h"
#endif
Vendored Executable → Regular
+8 -11
View File
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9046" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9046"/>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUAutomaticUpdateAlert">
<connections>
<outlet property="installButton" destination="15" id="VHi-SZ-6td"/>
<outlet property="laterButton" destination="16" id="AZg-1M-E8w"/>
<outlet property="skipButton" destination="30" id="LpO-Ax-F1B"/>
<outlet property="window" destination="5" id="22"/>
</connections>
</customObject>
@@ -24,7 +29,6 @@
<imageView id="7">
<rect key="frame" x="23" y="73" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="38"/>
<connections>
<binding destination="-2" name="value" keyPath="applicationIcon" id="10"/>
@@ -33,7 +37,6 @@
<textField verticalHuggingPriority="750" id="8">
<rect key="frame" x="105" y="120" width="497" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="39">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -46,7 +49,6 @@
<textField verticalHuggingPriority="750" id="9">
<rect key="frame" x="105" y="81" width="497" height="31"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="40">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -59,7 +61,6 @@
<button verticalHuggingPriority="750" id="15">
<rect key="frame" x="435" y="12" width="167" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="تثبيت وإعادة تشغيل التطبيق" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="41">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -74,7 +75,6 @@ DQ
<button verticalHuggingPriority="750" id="16">
<rect key="frame" x="306" y="12" width="129" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="تثبيت عند إنهاء التطبيق" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="42">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -89,7 +89,6 @@ Gw
<button verticalHuggingPriority="750" id="30">
<rect key="frame" x="102" y="12" width="116" height="32"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<buttonCell key="cell" type="push" title="عدم التثبيت" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="44">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -101,7 +100,6 @@ Gw
<button id="17">
<rect key="frame" x="105" y="58" width="493" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<buttonCell key="cell" type="check" title="تنزيل التحديثات وتثبيتها تلقائيًا في المستقبل" bezelStyle="regularSquare" imagePosition="right" alignment="right" controlSize="small" inset="2" id="43">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -111,7 +109,6 @@ Gw
</connections>
</button>
</subviews>
<animations/>
</view>
</window>
<userDefaultsController representsSharedInstance="YES" id="18" userLabel="Shared Defaults"/>
+8 -21
View File
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9046" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9046"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="9046"/>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="11542"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="box content view" minToolsVersion="7.0"/>
@@ -26,7 +28,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="746" y="229" width="620" height="370"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
<value key="minSize" type="size" width="550" height="150"/>
<value key="maxSize" type="size" width="700" height="600"/>
<view key="contentView" id="6">
@@ -40,7 +42,6 @@
<constraint firstAttribute="width" priority="800" constant="64" id="QhW-E9-8Br"/>
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
</constraints>
<animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
<connections>
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
@@ -51,7 +52,6 @@
<constraints>
<constraint firstAttribute="height" priority="777" constant="17" id="n8w-DR-XEM"/>
</constraints>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" usesSingleLineMode="YES" id="169">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -61,13 +61,12 @@
<binding destination="-2" name="value" keyPath="titleText" id="11"/>
</connections>
</textField>
<textField horizontalHuggingPriority="350" verticalHuggingPriority="999" horizontalCompressionResistancePriority="100" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="101" userLabel="Question text field">
<textField horizontalHuggingPriority="350" verticalHuggingPriority="999" horizontalCompressionResistancePriority="100" verticalCompressionResistancePriority="1000" preferredMaxLayoutWidth="490" translatesAutoresizingMaskIntoConstraints="NO" id="101" userLabel="Question text field">
<rect key="frame" x="106" y="316" width="494" height="14"/>
<constraints>
<constraint firstAttribute="height" relation="lessThanOrEqual" priority="300" constant="28" id="H6E-te-Fog"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="KUO-Dw-g6s"/>
</constraints>
<animations/>
<textFieldCell key="cell" allowsUndo="NO" sendsActionOnEndEditing="YES" id="174">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -88,7 +87,6 @@
<subviews>
<webView maintainsBackForwardList="NO" translatesAutoresizingMaskIntoConstraints="NO" id="18">
<rect key="frame" x="0.0" y="-2" width="492" height="214"/>
<animations/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" minimumFontSize="7" plugInsEnabled="NO" javaEnabled="NO" javaScriptCanOpenWindowsAutomatically="NO">
<nil key="identifier"/>
</webPreferences>
@@ -101,7 +99,6 @@
</connections>
</webView>
</subviews>
<animations/>
</view>
<constraints>
<constraint firstItem="18" firstAttribute="top" secondItem="89" secondAttribute="top" constant="1" id="3ps-Yo-uZA"/>
@@ -110,9 +107,6 @@
<constraint firstItem="18" firstAttribute="leading" secondItem="89" secondAttribute="leading" constant="1" id="kSE-Xj-CRB"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="100" id="pvn-8k-9Ev"/>
</constraints>
<animations/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" size="11" name="LucidaGrande"/>
<connections>
<binding destination="-2" name="hidden" keyPath="showsReleaseNotes" id="164">
@@ -127,7 +121,6 @@
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="100" constant="100" id="gkn-FW-9aC"/>
</constraints>
<animations/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="معلومات عن الإصدار:" usesSingleLineMode="YES" id="170">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -150,14 +143,12 @@
<constraint firstItem="89" firstAttribute="leading" secondItem="fKC-QA-GZa" secondAttribute="leading" id="e5T-q1-kq1"/>
<constraint firstItem="17" firstAttribute="leading" secondItem="fKC-QA-GZa" secondAttribute="leading" id="tFH-k0-O7I"/>
</constraints>
<animations/>
</customView>
<button horizontalHuggingPriority="150" verticalHuggingPriority="750" horizontalCompressionResistancePriority="997" translatesAutoresizingMaskIntoConstraints="NO" id="22">
<rect key="frame" x="372" y="12" width="102" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="90" id="2Zy-5G-GBj"/>
</constraints>
<animations/>
<buttonCell key="cell" type="push" title="تذكيري لاحقًا" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="171">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -171,7 +162,6 @@ Gw
</button>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="998" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="103" y="12" width="129" height="32"/>
<animations/>
<buttonCell key="cell" type="push" title="تخطي هذا الإصدار" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="172">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -185,7 +175,6 @@ Gw
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="120" id="N94-uf-6oP"/>
</constraints>
<animations/>
<buttonCell key="cell" type="push" title="تثبيت التحديث" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" inset="2" id="173">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -203,7 +192,6 @@ DQ
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="28" id="0AI-ue-a0r"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="yM1-TA-HfP"/>
</constraints>
<animations/>
<buttonCell key="cell" type="check" title="تنزيل التحديثات وتثبيتها تلقائيًا في المستقبل" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -246,7 +234,6 @@ DQ
<constraint firstAttribute="trailing" secondItem="117" secondAttribute="trailing" constant="21" id="sHI-Hm-eSA"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="22" id="zSE-lw-Ggj"/>
</constraints>
<animations/>
</view>
<connections>
<outlet property="delegate" destination="-2" id="50"/>
Vendored Executable → Regular
+7 -20
View File
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt">
<connections>
<outlet property="cancelButton" destination="14" id="gmk-EB-rHf"/>
<outlet property="checkButton" destination="13" id="JAM-bi-JDs"/>
<outlet property="descriptionTextField" destination="33" id="133"/>
<outlet property="moreInfoButton" destination="71" id="132"/>
<outlet property="moreInfoView" destination="39" id="127"/>
@@ -29,7 +32,6 @@
<button verticalHuggingPriority="750" tag="1" id="13">
<rect key="frame" x="322" y="12" width="102" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="التحقق تلقائيًا" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" tag="1" inset="2" id="176">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="GeezaPro"/>
@@ -44,7 +46,6 @@ DQ
<button verticalHuggingPriority="750" id="14">
<rect key="frame" x="230" y="12" width="92" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="عدم التحقق" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="177">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="GeezaPro"/>
@@ -59,7 +60,6 @@ Gw
<textField verticalHuggingPriority="750" id="32">
<rect key="frame" x="104" y="114" width="315" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="هل تريد أن يتم التحقق من وجود تحديثات تلقائيًا؟" id="178">
<font key="font" size="13" name="GeezaPro-Bold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -69,7 +69,6 @@ Gw
<textField verticalHuggingPriority="750" id="33">
<rect key="frame" x="104" y="81" width="315" height="42"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="DO NOT LOCALIZE" id="179">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -82,7 +81,6 @@ Gw
<button focusRingType="none" id="34">
<rect key="frame" x="104" y="53" width="316" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<animations/>
<buttonCell key="cell" type="check" title="تضمين تقرير عن النظام دون ذكر معلومات عن المستخدم" bezelStyle="regularSquare" imagePosition="right" alignment="right" controlSize="small" state="on" focusRingType="none" inset="2" id="180">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -104,7 +102,6 @@ Gw
<imageView id="37">
<rect key="frame" x="23" y="84" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="axesIndependently" image="NSApplicationIcon" id="181"/>
<connections>
<binding destination="-2" name="value" keyPath="icon" id="130"/>
@@ -113,7 +110,6 @@ Gw
<button focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" id="71">
<rect key="frame" x="80" y="50" width="27" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<animations/>
<buttonCell key="cell" type="disclosureTriangle" bezelStyle="disclosure" imagePosition="overlaps" alignment="center" borderStyle="border" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="182">
<behavior key="behavior" pushIn="YES" changeBackground="YES" changeGray="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -128,7 +124,6 @@ Gw
</connections>
</button>
</subviews>
<animations/>
</view>
</window>
<arrayController editable="NO" preservesSelection="NO" selectsInsertedObjects="NO" avoidsEmptySelection="NO" id="24" userLabel="Array Controller">
@@ -149,7 +144,6 @@ Gw
<textField verticalHuggingPriority="750" id="46">
<rect key="frame" x="1" y="128" width="358" height="70"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="183">
<font key="font" metaFont="smallSystem"/>
<string key="title">Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this.
@@ -167,9 +161,8 @@ This is the information that would be sent:</string>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" id="41">
<rect key="frame" x="0.0" y="0.0" width="353" height="16"/>
<rect key="frame" x="0.0" y="0.0" width="353" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
@@ -209,23 +202,17 @@ This is the information that would be sent:</string>
</tableColumns>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="185">
<rect key="frame" x="-100" y="-100" width="345" height="11"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="NO" id="184">
<rect key="frame" x="-22" y="1" width="11" height="125"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
</subviews>
<animations/>
</customView>
<userDefaultsController id="49" userLabel="User Defaults Controller">
<declaredKeys>
+1 -1
View File
@@ -1,6 +1,6 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "تم تنزيل %1$@ %2$@ وهو جاهز للاستخدام، هل ترغب بتثبيت التحديث وإعادة تشغيل %1$@ الآن؟";
"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "لا يمكن تحديث %1$@ إذا شُغّل من وحدة تخزين للقراءة فقط كصورة قرص أو قارئ الأقراص الضوئية. انقل %1$@ إلى مجلد التطبيقات وأعد تشغيله من هناك ثم حاول مجددًا.";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "لا يمكن تحديث %1$@ إذا شُغّل من وحدة تخزين للقراءة فقط كصورة قرص أو قارئ الأقراص الضوئية. انقل %1$@ إلى مجلد التطبيقات وأعد تشغيله من هناك ثم حاول مجددًا.";
"%@ %@ is currently the newest version available." = "الإصدار %2$@ هو أحدث إصدار متوفر حاليًا لتطبيق %1$@";
+8 -3
View File
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUAutomaticUpdateAlert">
<connections>
<outlet property="installButton" destination="15" id="VHi-SZ-6td"/>
<outlet property="laterButton" destination="16" id="AZg-1M-E8w"/>
<outlet property="skipButton" destination="30" id="LpO-Ax-F1B"/>
<outlet property="window" destination="5" id="22"/>
</connections>
</customObject>
Loaded 100 of 229 files, more files were not shown because too many files have changed in this diff. Show more