Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
892c5f1054 | ||
|
|
84cdbbd45b | ||
|
|
d79507b663 | ||
|
|
ab07cda5eb | ||
|
|
f4e0fceeac | ||
|
|
9344928872 | ||
|
|
5b123215ed | ||
|
|
2bebf0f2d1 | ||
|
|
4a1eddadf2 | ||
|
|
19473aae5e | ||
|
|
e0a1bbbac5 | ||
|
|
ebf9a8172a | ||
|
|
676b713df0 | ||
|
|
b26bfeba0e | ||
|
|
2acc9114e4 | ||
|
|
344433d468 | ||
|
|
4e972c997c | ||
|
|
55a7ca5b9c | ||
|
|
bf9ba560f0 | ||
|
|
2a2eef97a9 | ||
|
|
0e68e5e590 | ||
|
|
dedae6e626 | ||
|
|
b96a37f922 | ||
|
|
f3ed1fafe3 | ||
|
|
3f829bd49c | ||
|
|
72d8e4e5a6 | ||
|
|
5d0fa33725 | ||
|
|
6c9f27106f | ||
|
|
b9b24be4bb | ||
|
|
1dd1fe44e1 | ||
|
|
a7f5217f3d | ||
|
|
eb0411fb51 | ||
|
|
e2674a7549 | ||
|
|
b000517983 | ||
|
|
268c2c9bab | ||
|
|
f464382475 | ||
|
|
7a3890c9c0 | ||
|
|
73ecd41dae | ||
|
|
20fc16a7d5 | ||
|
|
6159e77565 | ||
|
|
20a8ffd955 | ||
|
|
444809da92 | ||
|
|
8c805970fb | ||
|
|
70046f6e07 | ||
|
|
964587274c | ||
|
|
44d544cf5a | ||
|
|
91f5d0125c | ||
|
|
cf4ab0d8e6 | ||
|
|
39db8e1dc6 | ||
|
|
04c8a23f2d | ||
|
|
fa4daa0569 | ||
|
|
8cd2241fed | ||
|
|
1334414d2e | ||
|
|
2049c95770 | ||
|
|
d537efcf9b | ||
|
|
f916f2e723 | ||
|
|
4ca9ba1ce3 | ||
|
|
df6dc14ace | ||
|
|
f8b0f2c5b7 | ||
|
|
8c94f4bb2d | ||
|
|
8ec5f0ca3c | ||
|
|
2f16e3f526 | ||
|
|
a80eeedaeb | ||
|
|
08bc0d574e | ||
|
|
c015f5e968 | ||
|
|
76d5480313 | ||
|
|
135bcb483e | ||
|
|
e2854d3a29 | ||
|
|
ef5a0a997d | ||
|
|
74158c6da9 | ||
|
|
e5d0015185 | ||
|
|
d390a58f72 | ||
|
|
435f89c11f | ||
|
|
9984eb9ba3 | ||
|
|
89f5c6eb4b | ||
|
|
9c787a08aa | ||
|
|
88bc70cb9a | ||
|
|
7262555d72 | ||
|
|
1ce94b8e2f | ||
|
|
a62180b3ac | ||
|
|
e7b7094372 | ||
|
|
e17d55146d | ||
|
|
98e5959461 | ||
|
|
06a897ed03 | ||
|
|
2348532907 | ||
|
|
98cde3310d | ||
|
|
bb990ad172 | ||
|
|
d33cc1efd6 | ||
|
|
1eedc27e5f | ||
|
|
133a701d24 | ||
|
|
2459733d26 | ||
|
|
0585a22f07 | ||
|
|
07a6893e1f | ||
|
|
4b119a1eed | ||
|
|
c2c94bdb1f | ||
|
|
d14e89ef53 | ||
|
|
7bd4e56cd5 | ||
|
|
8577ed8953 | ||
|
|
7b8fd7c097 | ||
|
|
cb15481e88 | ||
|
|
efa8447b1f | ||
|
|
e140353ed5 | ||
|
|
d6316b6d9c | ||
|
|
b0c9c31dc1 | ||
|
|
9d03d79ca7 | ||
|
|
519dccf64b | ||
|
|
1392f5155a | ||
|
|
76ce31f2f6 | ||
|
|
f46d7b5c1e | ||
|
|
d94c316583 | ||
|
|
c97a0462ae | ||
|
|
a62db7348d | ||
|
|
bd77daac35 | ||
|
|
b41165e2e2 | ||
|
|
49c622b36b | ||
|
|
2d33235886 | ||
|
|
2aa4899efd | ||
|
|
a0f368823b | ||
|
|
afec652729 | ||
|
|
0ae81e3c05 | ||
|
|
90d319cb02 | ||
|
|
4ffb2d2361 | ||
|
|
e8508a4a66 | ||
|
|
a5b92c2008 | ||
|
|
d7185de470 | ||
|
|
0c1eca9f82 | ||
|
|
88de072950 | ||
|
|
5efef76004 | ||
|
|
95eb6456e3 | ||
|
|
4cbffd02e3 | ||
|
|
47a4978e6a | ||
|
|
0400bc4d66 | ||
|
|
e1ef953067 | ||
|
|
bfa28948f0 | ||
|
|
409b35c20f | ||
|
|
aa92d572dd | ||
|
|
f1d3e4dd7f | ||
|
|
8a45304d55 | ||
|
|
f56a6025a0 | ||
|
|
805447d748 | ||
|
|
cdfd506cc0 | ||
|
|
90098dae5a | ||
|
|
3148182f1b | ||
|
|
31172f61f9 | ||
|
|
d35a68f5be | ||
|
|
6745346f1d | ||
|
|
1ab5de851f | ||
|
|
358933f965 | ||
|
|
a60255c95c | ||
|
|
2c54ec012d | ||
|
|
b671c6bef6 | ||
|
|
6f24f56f0d | ||
|
|
59f9e0ee1b | ||
|
|
ac7fd917d3 | ||
|
|
53f0f4f9ee | ||
|
|
55c57abd2f | ||
|
|
006e71fa89 | ||
|
|
c6d47ed68d | ||
|
|
fd906d9589 | ||
|
|
3e6431f94d | ||
|
|
4a015ada8f | ||
|
|
2c1b3783e4 | ||
|
|
808bde2699 | ||
|
|
fde6b4775e | ||
|
|
92bafa92bf | ||
|
|
7e2d4b019e | ||
|
|
10b8872afb | ||
|
|
d4d984f42c | ||
|
|
bd98b33e25 | ||
|
|
79f447d537 | ||
|
|
a4759c871e | ||
|
|
a3b9a74fe1 | ||
|
|
faba759574 | ||
|
|
91800e3036 | ||
|
|
d7dbbe4bb9 | ||
|
|
2579f2c3a3 | ||
|
|
01e9bd82be | ||
|
|
d34d2853f6 | ||
|
|
fd1ffce3e2 | ||
|
|
6ae7b68659 | ||
|
|
54dc6d0071 | ||
|
|
a773ac5856 | ||
|
|
686c87242c | ||
|
|
f2eaaeb4a3 | ||
|
|
5676acaebc | ||
|
|
0055adcc52 | ||
|
|
ad518eb209 | ||
|
|
20100c283f | ||
|
|
fc88f94d5d | ||
|
|
222ab3edd9 | ||
|
|
4b831a1394 | ||
|
|
bdc45d7e47 | ||
|
|
6ca5c3a337 | ||
|
|
4ab8fd1010 | ||
|
|
3f40f444db | ||
|
|
f1d5103a07 | ||
|
|
890f1fb393 | ||
|
|
d7993257fe | ||
|
|
c99378c170 | ||
|
|
00d8b64b41 | ||
|
|
6a79789d32 | ||
|
|
ec8f46af91 | ||
|
|
2ae8248c35 | ||
|
|
d9d3ff2a8e | ||
|
|
b420ad65be | ||
|
|
5504d6896f | ||
|
|
d888705fd8 | ||
|
|
8d1109b59f | ||
|
|
25aca9f56f | ||
|
|
e75a9b0591 | ||
|
|
5dfc6ab3b2 | ||
|
|
76cca58776 | ||
|
|
7141818b31 | ||
|
|
52bee98867 | ||
|
|
b262c2b581 | ||
|
|
192c3b4c2d | ||
|
|
cfe375b5f3 | ||
|
|
271970697e | ||
|
|
1539c0c077 | ||
|
|
aa25194536 | ||
|
|
6ab4163957 | ||
|
|
dfa27acde2 | ||
|
|
50c3df3a6f | ||
|
|
31a49c83b5 | ||
|
|
a57eb736cb | ||
|
|
52b2d75d63 | ||
|
|
9ea81e21b9 | ||
|
|
eda214a3ec | ||
|
|
d2b7fd6236 | ||
|
|
77ce7c19e9 | ||
|
|
048ce10ed5 | ||
|
|
b23d4a9641 | ||
|
|
843bbe7ece | ||
|
|
a7dbe4184c | ||
|
|
3287299f53 | ||
|
|
1b71d3ebd1 | ||
|
|
ef8edef094 | ||
|
|
c793adf2ed | ||
|
|
5cf229ba41 | ||
|
|
4789ebdec5 | ||
|
|
0ed83cf9f2 | ||
|
|
c37fc01bb1 | ||
|
|
7fae28135e | ||
|
|
82c722ba37 | ||
|
|
aba5567a15 | ||
|
|
1325d3fe40 | ||
|
|
8d2054e62a | ||
|
|
d593a04dda | ||
|
|
8fa758f8aa | ||
|
|
2a0d8afe4e | ||
|
|
3e3a11bd0f | ||
|
|
41b2f054f8 | ||
|
|
93ebf843c2 | ||
|
|
984aac852f | ||
|
|
69c9c70d21 | ||
|
|
478c7fd8cd | ||
|
|
243fdf8f7f | ||
|
|
337002f421 | ||
|
|
a7ba6a7421 | ||
|
|
7b3928db9b | ||
|
|
b86770c39f | ||
|
|
f6622104bf | ||
|
|
860739fce2 | ||
|
|
08065bc05b | ||
|
|
38eb63a7a2 | ||
|
|
f7daf04204 | ||
|
|
2350c59cc8 | ||
|
|
4eebdb82c4 | ||
|
|
066d634ef6 | ||
|
|
9e2e489109 | ||
|
|
f9c428ee06 | ||
|
|
16cdd6bf64 | ||
|
|
e657bcf03a | ||
|
|
d138f64bd6 | ||
|
|
3c37f775fb | ||
|
|
7a283bfaeb | ||
|
|
c1510a5bea | ||
|
|
7a20432b1b | ||
|
|
3d8be2d2da | ||
|
|
a59e8ff958 | ||
|
|
26077f47af | ||
|
|
118f3c5141 | ||
|
|
22b65a3095 | ||
|
|
05c51a1c05 | ||
|
|
21f95465da | ||
|
|
ab74bdca79 | ||
|
|
69d471aefb | ||
|
|
d620dc0b52 | ||
|
|
d3f975816e | ||
|
|
91ac9178f1 | ||
|
|
ae52d2743e | ||
|
|
a4082a0e54 | ||
|
|
9c8e825289 | ||
|
|
9662452c09 | ||
|
|
0a3051349a | ||
|
|
1c258cb690 | ||
|
|
4ba453f337 | ||
|
|
6960045e2b | ||
|
|
803925f2cf | ||
|
|
97c71ef700 | ||
|
|
595c6ce491 | ||
|
|
6b7752792d | ||
|
|
b7dc2438a7 | ||
|
|
12904a5af6 | ||
|
|
7fc9e32ce7 | ||
|
|
9aa3015929 | ||
|
|
09f0c43e7c | ||
|
|
a570191859 | ||
|
|
d7dea30de6 | ||
|
|
409e7e22bf | ||
|
|
ed456740b0 | ||
|
|
8a25500eca | ||
|
|
cdfcd1469e | ||
|
|
4c54349c23 | ||
|
|
4d00e8c569 | ||
|
|
02088e0da6 | ||
|
|
f341d0c3a9 | ||
|
|
833081ffa9 | ||
|
|
faed494d4e | ||
|
|
dbebe4b3b2 | ||
|
|
e27828d248 | ||
|
|
44cf0d0e51 | ||
|
|
320b3aa62a | ||
|
|
1d8adc8fac | ||
|
|
bc458a6ab5 | ||
|
|
6be55685c8 | ||
|
|
29b7321094 | ||
|
|
449b00ed3e | ||
|
|
4c2573702e | ||
|
|
88d4b348d9 | ||
|
|
bf07a9435b | ||
|
|
799b2a381f | ||
|
|
8b4cf14e53 | ||
|
|
515511d5e9 | ||
|
|
aca8cc6fbf | ||
|
|
1bc3834345 | ||
|
|
73e96cdcab | ||
|
|
760e32c5bd | ||
|
|
cf1b167954 | ||
|
|
5ef6c64568 | ||
|
|
7e05e97c95 | ||
|
|
5cd98c5508 | ||
|
|
e6deed9c56 | ||
|
|
290f64f552 | ||
|
|
59caa1f300 | ||
|
|
882b5c9b8a | ||
|
|
7ba0c583af | ||
|
|
b275cab13f | ||
|
|
6a48420e07 | ||
|
|
59f9236009 | ||
|
|
f20c121745 | ||
|
|
25040affc2 | ||
|
|
82e6250250 | ||
|
|
9f2d53a3a2 | ||
|
|
ec4ebbdcfb | ||
|
|
716bb30e7c | ||
|
|
aeeae26d1c | ||
|
|
095d223e70 | ||
|
|
55eed9efd8 | ||
|
|
d092ae9295 | ||
|
|
5457476e4a | ||
|
|
5dce90eafa | ||
|
|
268ea201da | ||
|
|
613b759077 | ||
|
|
02e090c291 | ||
|
|
f6a2e76685 | ||
|
|
8f5b9f03ac | ||
|
|
bb682da743 | ||
|
|
bf38b0c9fd | ||
|
|
e64516c089 | ||
|
|
fc725cce01 | ||
|
|
95398cd26f | ||
|
|
b515c15f9b | ||
|
|
01e8cf90c6 | ||
|
|
7152bd0ffa | ||
|
|
05861e5340 | ||
|
|
aa853a0f0f | ||
|
|
a47151c638 | ||
|
|
06642bba20 | ||
|
|
f04a460d63 | ||
|
|
7d4ce0daeb | ||
|
|
a2bcd53eaa | ||
|
|
5a47fb64c3 | ||
|
|
c96aa2eda8 | ||
|
|
e30a342813 | ||
|
|
320672c1f9 | ||
|
|
0bd27c0cb7 | ||
|
|
436107f20e | ||
|
|
abda56d047 | ||
|
|
950e3894b3 | ||
|
|
2300f2bcb0 | ||
|
|
a6d776ca04 | ||
|
|
76e79d6f92 | ||
|
|
9cc1905f87 | ||
|
|
78e24a6fe6 | ||
|
|
f1a353840a | ||
|
|
0f34252f4a | ||
|
|
000a24c63b | ||
|
|
32d4f249d4 | ||
|
|
96272fce7d | ||
|
|
dc925712dc | ||
|
|
e71915b4fb | ||
|
|
31b9ba8dde | ||
|
|
83708695af | ||
|
|
bb363db7f8 | ||
|
|
ba6c3b6854 | ||
|
|
200da2b1be | ||
|
|
db652744ef | ||
|
|
9f3d4fb524 | ||
|
|
86b6502342 | ||
|
|
fa671073fa | ||
|
|
4f1e5a72a0 | ||
|
|
bca574119b | ||
|
|
acb8f5f076 | ||
|
|
16ff5c6683 | ||
|
|
67d53c04b7 | ||
|
|
910f78b569 | ||
|
|
fdaf26e95d | ||
|
|
a8854375f5 | ||
|
|
9937e5a17b | ||
|
|
67b0860a9f | ||
|
|
5b90432f7e | ||
|
|
7cd8974b7e | ||
|
|
9c042a5767 | ||
|
|
3db00fa137 | ||
|
|
f6710e2379 | ||
|
|
990dee6a8d | ||
|
|
7bfec0f3c0 | ||
|
|
3ea1a9eee4 | ||
|
|
f6e292fad3 | ||
|
|
1cce7890d8 | ||
|
|
61340cab17 | ||
|
|
4a95dbeddc | ||
|
|
45178111b3 | ||
|
|
eef0f5f0dc | ||
|
|
1e1025f17d | ||
|
|
69407123ba | ||
|
|
096d43a7a6 | ||
|
|
00b67269d6 | ||
|
|
5fe0a7cb59 | ||
|
|
7baf50506b | ||
|
|
40616b864a | ||
|
|
561bbbe294 | ||
|
|
fba7231261 | ||
|
|
b3ac18f173 | ||
|
|
e2a59fccb2 | ||
|
|
a8f26b16c2 | ||
|
|
b7a3999da8 | ||
|
|
a5c8e0b1e2 | ||
|
|
2768e60ce1 | ||
|
|
9075d4a037 | ||
|
|
da35ef695b | ||
|
|
394319e1fc | ||
|
|
0c6e6fdd84 | ||
|
|
39bb82bd9a | ||
|
|
25d7faea7b | ||
|
|
a0c2de60d3 | ||
|
|
e8299fd116 | ||
|
|
4548228238 | ||
|
|
fe1372c962 | ||
|
|
a6fcfa61b5 | ||
|
|
c34e9b3c34 | ||
|
|
ea81eeec57 | ||
|
|
19ae8506ab | ||
|
|
803676d56a | ||
|
|
5975703b13 | ||
|
|
ecd2ce227b | ||
|
|
3f502b6151 | ||
|
|
fb43787317 | ||
|
|
f81bfd9f1c | ||
|
|
24ebb7b379 | ||
|
|
2460f2fcf7 | ||
|
|
401e696590 | ||
|
|
29035199f3 | ||
|
|
b4210d8f61 | ||
|
|
c120af6b1f | ||
|
|
96ea09e44f | ||
|
|
f5a1b1c27d | ||
|
|
5cdfffa521 | ||
|
|
a5245accf4 | ||
|
|
9bc63ccf7e | ||
|
|
2e3ed79753 | ||
|
|
da3b5c2570 | ||
|
|
756b37d4a5 | ||
|
|
36b7d434ad | ||
|
|
b21b308203 | ||
|
|
dab8a36a13 | ||
|
|
152e6f9572 | ||
|
|
f8fbf370bc | ||
|
|
61291c77d7 | ||
|
|
b90df8b254 | ||
|
|
4dbc0dd47f | ||
|
|
9d3db1b103 | ||
|
|
b8c8b9e605 | ||
|
|
d7260665d6 | ||
|
|
b96c95066c | ||
|
|
3d352c6fcd | ||
|
|
874572f7bb | ||
|
|
8f0d7d0805 | ||
|
|
65f8d2629a | ||
|
|
c0ca2249a5 | ||
|
|
efe903bc73 | ||
|
|
fd20e0725b | ||
|
|
6c8f094bbe | ||
|
|
50b76d59f7 | ||
|
|
4f76b42bb5 | ||
|
|
d593ab38ad | ||
|
|
a17f974357 | ||
|
|
40dee9958b | ||
|
|
575bdda768 | ||
|
|
9b116929ad | ||
|
|
2e8fa61a5a | ||
|
|
cd93eb9098 | ||
|
|
4c765d86ee | ||
|
|
fa8aaced55 | ||
|
|
1b02ab5f7f | ||
|
|
0e609cc528 | ||
|
|
5ec4c74b0b | ||
|
|
4d7006950a | ||
|
|
e49a69895a | ||
|
|
27f2b9c219 | ||
|
|
db820fbb0f | ||
|
|
ad4e9c74e0 | ||
|
|
4797446f7c | ||
|
|
0ffcde4fbb | ||
|
|
f555e1143f | ||
|
|
bc3fd4542b | ||
|
|
d3fac14586 | ||
|
|
d0425a140a | ||
|
|
64ec0c317e | ||
|
|
5f694f82af | ||
|
|
590122f25a | ||
|
|
9b670b9ea7 | ||
|
|
65e836cba1 | ||
|
|
c634f61f2a | ||
|
|
776e78c459 | ||
|
|
a03235851c | ||
|
|
d2f843f92c | ||
|
|
e9c69673ad | ||
|
|
a453afa29a | ||
|
|
cee669c276 | ||
|
|
2e0c1b0086 | ||
|
|
7686c86792 | ||
|
|
2e0f0211d1 | ||
|
|
4f8d745305 | ||
|
|
9788c6849e | ||
|
|
48dfbac37a | ||
|
|
e4eccce811 | ||
|
|
097c2fea42 | ||
|
|
5a5b171a68 | ||
|
|
343d6866c4 | ||
|
|
2ad144c739 | ||
|
|
983ad61d78 | ||
|
|
27e87143e1 | ||
|
|
d0b802e09b | ||
|
|
8c67631efb | ||
|
|
18df114b70 | ||
|
|
c51bf739cf | ||
|
|
43a0a7db4f | ||
|
|
bbcfe7edf4 | ||
|
|
a11578a863 | ||
|
|
b546304d5d | ||
|
|
d7774c0dc0 | ||
|
|
bd80144c7b | ||
|
|
315cbaab1b | ||
|
|
af37928283 | ||
|
|
6a3df43017 | ||
|
|
c747ffc35b | ||
|
|
7bfbe83d87 | ||
|
|
a871569867 | ||
|
|
65b071eb86 | ||
|
|
0e99d4fa80 | ||
|
|
8f00c3c274 | ||
|
|
4fad53007f | ||
|
|
e7435964a2 | ||
|
|
8ea15468b4 | ||
|
|
9025bef687 | ||
|
|
ffc44bb089 | ||
|
|
6c968489eb | ||
|
|
2fc1b66a79 | ||
|
|
bd99d0451d | ||
|
|
d62e47cd2e | ||
|
|
ab23fedd0c | ||
|
|
43a603c1cc | ||
|
|
9b5b541c82 | ||
|
|
119bac527f | ||
|
|
e9bc6a2915 | ||
|
|
2979338f8a | ||
|
|
830f633a6e | ||
|
|
0d51d12e43 | ||
|
|
2d47989616 | ||
|
|
f259b5e825 | ||
|
|
3800b33c1a | ||
|
|
dfe0eff095 | ||
|
|
8cdec40a03 | ||
|
|
6169234300 | ||
|
|
3ff2d82ecf | ||
|
|
3ef4c09f71 | ||
|
|
79bd7ac090 | ||
|
|
6e648f14f4 | ||
|
|
c3d8254324 | ||
|
|
15095640eb | ||
|
|
6070419761 | ||
|
|
db2f48ad09 | ||
|
|
cfe5206252 | ||
|
|
975f679148 | ||
|
|
b571a3d58d | ||
|
|
5090d4b3a0 | ||
|
|
799b00211d | ||
|
|
afe8afc41f | ||
|
|
090e7c0ecb | ||
|
|
e557b78394 | ||
|
|
c53f961690 | ||
|
|
9e6b51fac9 | ||
|
|
a6f98158a7 | ||
|
|
ca040bdf9a | ||
|
|
f95cf6454d | ||
|
|
827c6adc03 | ||
|
|
59d9ece06b | ||
|
|
1dd1b09e5f | ||
|
|
58296ecaf7 | ||
|
|
3b0674320f | ||
|
|
a8b2b4f962 | ||
|
|
6fc32b6800 | ||
|
|
1e20d43c2a | ||
|
|
52814bcbd0 | ||
|
|
74fccaaab5 | ||
|
|
6813a06455 | ||
|
|
e423cfee35 | ||
|
|
7316a00e9c | ||
|
|
54299d766a | ||
|
|
f2a7b4b349 | ||
|
|
150718ad6f | ||
|
|
0904ec151c | ||
|
|
dff6e0832c | ||
|
|
e983c03232 | ||
|
|
d1c54608f7 | ||
|
|
24b6c88935 | ||
|
|
6397e56c06 | ||
|
|
9785111857 | ||
|
|
522ffb08f0 | ||
|
|
22129e3ec7 | ||
|
|
4431864770 | ||
|
|
23a57f7876 | ||
|
|
05b75aa44c | ||
|
|
e35a1ca231 | ||
|
|
1cc6c2b9ca | ||
|
|
8c092c7453 | ||
|
|
6631fce15f | ||
|
|
7071142aad | ||
|
|
34586bca5a | ||
|
|
516638a6d7 | ||
|
|
d4c39a2ad9 | ||
|
|
d6288c175e | ||
|
|
08b785083a | ||
|
|
a7818f0f64 | ||
|
|
52642aa11a | ||
|
|
27c886f6b9 | ||
|
|
85eb5a7496 | ||
|
|
91c242ac04 | ||
|
|
8ff6c147f2 | ||
|
|
8b4bb5a078 | ||
|
|
9d260f9b0e | ||
|
|
59cd48f3de | ||
|
|
b11db20742 | ||
|
|
f186aa6896 | ||
|
|
2bedf000a8 | ||
|
|
3d6f4544f1 | ||
|
|
13deac9b58 | ||
|
|
21c60ef7ce | ||
|
|
83adbb2979 | ||
|
|
c614b679e1 | ||
|
|
10bcc69c80 | ||
|
|
9eb4368d6f | ||
|
|
783fd4b475 | ||
|
|
00efab8ad2 | ||
|
|
d73b3745bf | ||
|
|
ccd44c0cb2 | ||
|
|
9a0acca849 | ||
|
|
95f9658a7e | ||
|
|
0fa24ce313 | ||
|
|
28ad466aa8 | ||
|
|
7e9fc0f20b | ||
|
|
7f5689835b | ||
|
|
478e0a53d0 | ||
|
|
588cad8d91 | ||
|
|
1d3ab8d6bb | ||
|
|
e086aa1660 | ||
|
|
188a15a948 | ||
|
|
874660f52e | ||
|
|
29bd46d68d | ||
|
|
cb80e0ef51 | ||
|
|
ccef53a3d3 | ||
|
|
d201803259 | ||
|
|
74b206dc77 | ||
|
|
42cda2d2e0 | ||
|
|
c386b704b5 | ||
|
|
84be00b29f | ||
|
|
d064b589ae | ||
|
|
90edd12e43 | ||
|
|
c71bf3ccbe | ||
|
|
724b4de07e | ||
|
|
444b0a928d | ||
|
|
ec8fcbc02f | ||
|
|
68e2cd67d1 | ||
|
|
c21e1aba35 | ||
|
|
ec7f38d157 | ||
|
|
5b38483981 | ||
|
|
46312a2d15 | ||
|
|
8a240f7c46 | ||
|
|
17ca061cda | ||
|
|
4da902b46c | ||
|
|
7b39268171 | ||
|
|
0343569cdc | ||
|
|
32a804e2ea | ||
|
|
7ce078eb16 | ||
|
|
f9dda21088 | ||
|
|
00c5ae4a42 | ||
|
|
d73d8333a1 | ||
|
|
9c720fd6b7 | ||
|
|
7228235ce3 | ||
|
|
5684a1477e | ||
|
|
347dd73269 | ||
|
|
a14850458d | ||
|
|
e249e3cfb6 | ||
|
|
d1c0978ee5 | ||
|
|
e3226d3511 | ||
|
|
ae7c416f16 | ||
|
|
1456fa0f75 | ||
|
|
d6acd07d5c | ||
|
|
d8149e9eb0 | ||
|
|
d6557e21a0 | ||
|
|
3bccef8d22 | ||
|
|
a27e8316fe | ||
|
|
b419948c8d | ||
|
|
211555639d | ||
|
|
46125abdeb | ||
|
|
69e4e7cc49 | ||
|
|
fe9dedb9ad | ||
|
|
47e6a96800 | ||
|
|
f42fb51952 | ||
|
|
1aea1b699a | ||
|
|
e769ba58cc | ||
|
|
f815eec2c0 | ||
|
|
de9be8b481 | ||
|
|
7454b8f2f6 | ||
|
|
b4c7dbe478 | ||
|
|
e14727dcc3 | ||
|
|
ac4e4e405b | ||
|
|
898216ac9f | ||
|
|
c42e3a3f47 | ||
|
|
cec9166956 | ||
|
|
675c66ff9d | ||
|
|
962a110b16 | ||
|
|
405410b8c8 | ||
|
|
32e014af06 | ||
|
|
0af86bbb9d | ||
|
|
a31dc3a102 | ||
|
|
7b212ea7fd | ||
|
|
b3f3944495 | ||
|
|
58a05e2ee7 | ||
|
|
3146ffb8e1 | ||
|
|
b815ce9db4 | ||
|
|
b14aa16a23 | ||
|
|
4397d85727 | ||
|
|
98832c4914 | ||
|
|
720269b118 | ||
|
|
c9bd13213b | ||
|
|
5fdddaeede | ||
|
|
8570539aab | ||
|
|
f4c6738793 | ||
|
|
e018ee98d3 | ||
|
|
95aabd561b | ||
|
|
a1b295c2c9 | ||
|
|
bc7aff3f11 | ||
|
|
dc249c1ec5 | ||
|
|
660228fb0e | ||
|
|
57c1f3e067 | ||
|
|
6ed9ae4bb9 | ||
|
|
752f754bb2 | ||
|
|
44a547341d | ||
|
|
c3f2c693a2 | ||
|
|
918217f6d2 | ||
|
|
bbdc432a20 | ||
|
|
5ba9562b17 | ||
|
|
fabfdcd178 | ||
|
|
33fac1c5af | ||
|
|
d60b87d98e | ||
|
|
c7881dec35 | ||
|
|
df0178e2de | ||
|
|
aaa60d261d | ||
|
|
88ab4b6f52 | ||
|
|
f9d3dbfa61 | ||
|
|
41d05dd922 | ||
|
|
82c2448321 | ||
|
|
a67b546a02 | ||
|
|
842d318277 | ||
|
|
251706d646 | ||
|
|
cbaa635a89 | ||
|
|
0a4bc6576a | ||
|
|
9a266ca52e | ||
|
|
4b6fc55056 | ||
|
|
c9bdb6ef04 | ||
|
|
bc52c0141a | ||
|
|
b2145b6838 | ||
|
|
74337fb65a | ||
|
|
4ffb7ea64a | ||
|
|
3d7e8c6c95 | ||
|
|
50de4d78e5 | ||
|
|
14358a8c37 | ||
|
|
9afa5febc2 | ||
|
|
70e09246ee | ||
|
|
4e8e3b9774 | ||
|
|
32129634ee |
No files matched your search
@@ -1,4 +0,0 @@
|
||||
*.pbxuser
|
||||
.DS_Store
|
||||
*.perspective*
|
||||
.svn
|
||||
@@ -0,0 +1,45 @@
|
||||
AccessModifierOffset: -4
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: true
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 0
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
#DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: foreach,Q_FOREACH
|
||||
IndentCaseLabels: true
|
||||
IndentFunctionDeclarationAfterType: true
|
||||
IndentWidth: 4
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
#PointerAlignment: Right
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
Standard: Cpp03
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
@@ -0,0 +1,36 @@
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.xcuserstate
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
@@ -0,0 +1,283 @@
|
||||
# 1.7.1
|
||||
|
||||
* Removed option to install unverified updates (Kornel Lesiński)
|
||||
* Added detailed log when code signing verification fails (Sam Deane)
|
||||
* Restored original Sparkle icon. (Jake Petroules)
|
||||
* Switched SUUpdateAlert.xib to AutoLayout (Kornel Lesiński)
|
||||
* Replace references to andymatuschak.org with sparkle-project.org. (Jake Petroules)
|
||||
* Several code cleanups, modernizations, fixed warnings and improved code formatting (Jake Petroules)
|
||||
* Make the repository significantly more organized. (Jake Petroules)
|
||||
* Xcode project: set organization name and class prefix. (Jake Petroules)
|
||||
* Link to Foundation and AppKit instead of Cocoa. (Jake Petroules)
|
||||
* Use new operatingSystemVersion API when available. (Jake Petroules)
|
||||
* Add .clang-format configuration file for source code formatting. (Jake Petroules)
|
||||
* Add a target to build Sparkle API documentation using Doxygen. (Jake Petroules)
|
||||
|
||||
# 1.7.0
|
||||
|
||||
* Dropped support for OS X 10.6. Sparkle now supports 10.7 and newer (including 10.10 Yosemite) on 64-bit Intel Macs (the last 32-bit Mac was released in 2006).
|
||||
* Removed use of deprecated functions (Zachary Waldowski)
|
||||
* Switched to modern Obj-C runtime and new literals syntax
|
||||
* Removed pre-10.7 code. (C.W. Betts)
|
||||
* Use more Blocks/libdispatch code. (C.W. Betts)
|
||||
* Cleaned up and improved security of `generate_keys`/`sign_update` scripts
|
||||
|
||||
# 1.6.1
|
||||
|
||||
* Removed archive password prompt (Kornel Lesiński)
|
||||
* (Re)fixes bug where URLs are naively double escaped (Andrew Madsen)
|
||||
* Fixed typo that caused crashes in BinaryDelta (Tamas Lustyik)
|
||||
* SUStandardVersionComparator.h is public (Vincent CARLIER)
|
||||
* Remove pre-10.6-specific code. (C.W. Betts)
|
||||
* Objective C 2 getters and setters. (C.W. Betts)
|
||||
* Define correct dependencies on locale scripts (Antonin Hildebrand)
|
||||
|
||||
# 1.6.0
|
||||
|
||||
* Cleaned up and deleted redundant strings files (Kornel Lesiński)
|
||||
* Modern Objective C syntax, properties where possible. (C.W. Betts)
|
||||
* Make SUAppcastDelegate a formal protocol. (C.W. Betts)
|
||||
* Fixed default font in release notes WebView (Kornel Lesiński)
|
||||
* Configurable name for finish_installation.app (Kornel Lesiński)
|
||||
* Removed code for 10.4 (Kornel Lesiński)
|
||||
* Convert all strings files to UTF-8 (UTF-16 must die) (Kornel Lesiński)
|
||||
* Removing GC target (Matt Thomas)
|
||||
* finish_installation.app and pkg files will not removed when we use *.pkg installer and restart system in the installer (Takayama Fumihiko)
|
||||
* Select Korean and Slovak for Sparkle.strings localization (Shon Frazier)
|
||||
* Updated the Romanian translation (Gabe)
|
||||
* pt-BR localization polishing (BR Lingo)
|
||||
* update zh_CN (61)
|
||||
* Shut up some warnings & make build with newer Xcode (Uli Kusterer)
|
||||
* Less unsafety with format strings (Uli Kusterer)
|
||||
* New icon (Rick Fillion)
|
||||
* fixed a 'content rectangle not entirely onscreen' warning (Simone Manganelli)
|
||||
* updated sends system profile to use info.plist if user defaults key isn't present (Jamie Pinkham)
|
||||
* Support for notifications on some updater events (Doug Russell)
|
||||
* Allow the delegate to trigger a silent install and relaunch (Matt Stevens)
|
||||
* Support silent relaunches (Matt Stevens)
|
||||
* Increment the sudden termination counter if installing on quit (Matt Stevens)
|
||||
* Prompts the user to update after a week (rather than a day) if he doesn't quit the app (Andy Matuschak)
|
||||
* Adding <sparkle:tags> appcast item element, <sparkle:criticalUpdate /> tag (Andy Matuschak)
|
||||
* We have this check box that says "Automatically download and install updates in the future." But we only download them automatically. We still ask permission again before installing them. (Andy Matuschak)
|
||||
|
||||
# 1.5.0-beta6
|
||||
|
||||
* Important Changes
|
||||
* Sparkle now requires DSA signatures on your updates. Check the documentation for more information on how to set that up if you don't already sign your updates. You can bypass this requirement if you deliver both your appcast and your updates over SSL.
|
||||
* Sparkle will no longer display release notes located at file:// URLs, since Javascript on such a page would be able to read files on your file system.
|
||||
* For security reasons, Sparkle will refuse to install updates which appear to "downgrade" the app.
|
||||
* SUUpdater now implements new keys: "automaticallyDownloadsUpdates", "lastUpdateCheckDate", and "sendsSystemProfile."
|
||||
* Fixed a bug that could prevent SUProbingUpdateDriver from working.
|
||||
* Fixed a bug that prevented the updaterWillRelaunchApplication: delegate method from getting called.
|
||||
* Fixed displaying release notes transmitted "loose" in the <description> key.
|
||||
* Fixed Sparkle compilation on 10.4 systems.
|
||||
* Fixed a bug that could cause window confusion if an app changed its LSUIElement at runtime.
|
||||
* Added support for Sparkle 1.1's behavior of disabling updates when the check interval is 0.
|
||||
* Sparkle can now handle appending parameters to URLs which already have parameters.
|
||||
* If an update's sparkle:shortVersionString is the same as the host's CFBundleShortVersionString, the sparkle:version and CFBundleVersion will be presented in parentheticals.
|
||||
|
||||
# 1.5.0-beta5
|
||||
|
||||
* Important Changes!
|
||||
* Made every Sparkle class private except for SUUpdater, SUAppcast, SUAppcastItem, and the SUVersionComparisonProtocol.
|
||||
* There is now a single SUUpdater singleton for every host bundle; instead of -[SUUpdater setHostBundle], you can use +[SUUpdater updaterForBundle].
|
||||
* Redefined the (entire) delegate protocol accordingly.
|
||||
* Renamed -[SUUpdater updatePreferencesChanged] to -[SUUpdater resetUpdateCycle]. This provides better semantics for non-apps, which need to start the update cycle manually.
|
||||
* -[SUUpdater checkForUpdatesWithDriver] is private. If you were using SUProbingUpdateDriver, you can now use -[SUUpdater checkForUpdateInformation] for a similar effect.
|
||||
* All the user defaults keys are now private; instead, SUUpdater is KVC-compliant for automaticallyChecksForUpdates, updateCheckInterval, and feedURL.
|
||||
* Reduced the size of the English-only framework by 25%.
|
||||
* System profiling information is now only submitted to the server once per week; this will help normalize your statistics across users with different interval preferences.
|
||||
* The feedParamatersForUpdater: delegate method now requires "displayKey" and "displayVersion" keys so that it can inform the user what's being sent.
|
||||
* Added a delegate method called pathToRelaunchForUpdater: which can be used for plugins to provide the path which should be used when relaunching the client after installing an update.
|
||||
* Added support for xml:lang to pick localized nodes in appcasts (for release notes, etc).
|
||||
* Fixed a bug which would cause the "checking for updates" window to not disappear in certain extraordinary error conditions.
|
||||
* Fixed a DSA signature checking bug for .tar.gz archives.
|
||||
* Sparkle now refuses to update on any read-only volume, not just dmgs.
|
||||
* Sparkle will clean up the host app's name and version before sending it as the user agent string; some non-ASCII characters were causing problems.
|
||||
* Added an Italian localization courtesy Michele Longhi.
|
||||
* Added a Swedish localization courtesy Daniel Bergman.
|
||||
* Fixes to the French localization courtesy Ronald Leroux and Yann Ricqueberg.
|
||||
* Fixes to the German localization courtesy Sven-S. Porst.
|
||||
* Fixes to the Russian localization courtesy Alexander Bykov and Anton Sotkov.
|
||||
* Fixed a number of issues related to archive format detection: I reverted back to extensions from UTIs.
|
||||
* Focus behavior fixes for LSUIElement apps.
|
||||
* The status window progress bar now animates even when indeterminate.
|
||||
* Major refactorings to improve functionality for non-app bundles.
|
||||
|
||||
# 1.5.0-beta4
|
||||
|
||||
* Fixed a critical bug which prevented non-.dmgs from unarchiving properly.
|
||||
* Added reporting of 64-bit capability to the profiling system.
|
||||
|
||||
# 1.5.0-beta3
|
||||
|
||||
* Added a new delegate method to SUUpdater.h to allow delegates to specify custom version comparators.
|
||||
* Added a German localization, courtesy the Camino localizer team: Dominik Tobschall, Tobias Stohr, and Friedemann Bochow.
|
||||
* Bug fixes:
|
||||
* Fixed a serious bug which could cause a server to be DDoS'd (or the host app to crash!) if an appcast fails to be parsed.
|
||||
* Fixed .tbz extraction if the archive was made with Stuffit.
|
||||
* Fixed support for .tar.bz2 and .tar.gz; Sparkle has to assume the archive is a tar when it sees "bz2" and "gz"; don't use those without tarring.
|
||||
* Fixed a typo which caused the shouldPromptForPermissionToCheckForUpdatesToHostBundle: method to not work in 1.5b2.
|
||||
* Fixed .zip extraction on Tiger (Apple changed the UTI between releases)
|
||||
* Fixed a crasher on Tiger.
|
||||
* Fixed display of the default app icon when the host app doesn't have an icon.
|
||||
* Sparkle now displays a sensible progress string and uses an indeterminate progress bar when the server doesn't report a file size.
|
||||
* Fixed some memory leaks.
|
||||
|
||||
# 1.5.0-beta2
|
||||
|
||||
* Compatibility Issues:
|
||||
* Most of the delegate method selectors have changed to scale better. See SUUpdater.h for changes; you'll likely have to make changes if you implement any delegate methods.
|
||||
* If you're using .tar.gz or .tar.bz2 archives, name them ".tbz" or ".tgz" instead; Sparkle now uses UTIs for archive detection, and it's not smart about double extensions.
|
||||
* I'm no longer supporting 10.3. This may or may not work on Panther—probably not.
|
||||
* Sparkle's no longer built for ppc64 by default. If you want to ship that, feel free to build your own, but this saves a few hundred k.
|
||||
* Enhancements:
|
||||
* Sparkle now detects if the preferences for automatic update checks or the time interval change mid-cycle.
|
||||
* If your product is a non-.app, you need to clue Sparkle in on the change by calling [[SUUpdater sharedUpdater] updatePreferencesChanged].
|
||||
* Added a cancel to the "checking for updates..." dialog.
|
||||
* Sparkle now cleans up all its litter in /tmp.
|
||||
* Made SUUpdater's delegate an IBOutlet so you can hook it up in IB.
|
||||
* Bug fixes:
|
||||
* Sparkle no longer crashes on non-GC hosts when the user cancels an update's downloads.
|
||||
* Sparkle no longer gets stuck in an inconsistent state or crashes when it can't parse the appcast on scheduled updates.
|
||||
* Added the sharedUpdater method to SUUpdater, as it should have been.
|
||||
* Fixed a bug where the "checking for updates..." window wouldn't go away if an error occurs while checking for updates.
|
||||
* Made the dual-mode build configuration actually use the .xcconfig which builds it with GC support. (oops!)
|
||||
* Fixed relaunching for prefpanes.
|
||||
* Sparkle no longer fails to install updates on Snow Leopard (though there's still an issue with trashing the old version of the app, but it seems to be a 10.6 bug)
|
||||
* Sparkle now handles redirects correctly under Tiger.
|
||||
* Fixed the installation path for non-.app bundles.
|
||||
* Fixed a bug which could crash Sparkle under non-English locales.
|
||||
* Fixed a weird race condition which could cause the relaunch tool to never notice that its target relaunched.
|
||||
* Fixed a bug where if the host app is inactive when an update occurs, the update alert sometimes doesn't become key.
|
||||
* Minor textual fixes.
|
||||
* Localizations:
|
||||
* Dutch: Maarten Van Coile
|
||||
* French: Yann Ricquebourg
|
||||
* Spanish: Ernesto Gomez Cereijo
|
||||
|
||||
# 1.5.0-beta1
|
||||
|
||||
* The most important things to know:
|
||||
* The 10.3 support is untested at best; sketchy at worst. Test with it thoroughly before you use it.
|
||||
* Sparkle now asks for permission to update on second launch; don't be surprised at that. You can change that behavior with a delegate method; read SUUpdater.h for more info.
|
||||
* We no longer distinguish between "check on startup" and "scheduled updates"; everything is scheduled, with the default being every day.
|
||||
* The test application is using the new profiling features, but that's only for demonstration: these are off by default. More on this later.
|
||||
* There are no localizations yet.
|
||||
* New features:
|
||||
* Sparkle now supports .pkgs. Just name the .pkg the name of the app and put in the update archive.
|
||||
* Sparkle now sends optional demographic profiling information; set SUEnableSystemProfiling to YES in your Info.plist and check out the GET data sent to your webserver when fetching the appcast. More on this in the documentation. The test application has this on so you can see the behavior.
|
||||
* Sparkle now supports updating non-.apps. Just call -setHostBundle: on the global SUUpdater to let it know what you're trying to update.
|
||||
* Sparkle now supports garbage collection in the host app. Use "Sparkle-with-GC.framework" for that, but be aware it's 10.5-only.
|
||||
* Sparkle is now 64-bit compatible, compiling both ppc64 and x86_64.
|
||||
* Sparkle now supports a sparkle:minimumSystemVersion key you can set on appcast items. It does what you think it does.
|
||||
* Sparkle now checks to see if the host app is running from a disk image and refuses to update if it is. (10.4+ only)
|
||||
* Added support for entities in enclosure paths.
|
||||
* The file size output is now formatted prettily.
|
||||
* Sparkle now gives visual indication that it's checking for updates when the update's user initiated. ie: it pops up a status controller saying "checking for updates..."
|
||||
* Added support for an SUPublicDSAKeyFile, so people don't have to copy/paste their entire key into their Info.plist. Set this key in your Info.plist to the filename of the key in your Resources directory.
|
||||
* Added an actually maintainable codebase.
|
||||
* Changes:
|
||||
* Sparkle version comparison is now dramatically less stupid and verified by a bunch of unit tests. If something doesn't work the way you think it should, add a test to SUVersionComparisonTest.m
|
||||
* Added a minimum to the check interval so that developers don't accidentally release their apps into the wild with 60-second test check intervals and have DOS-attack-like results. It's an hour now for release mode; feel free to change it.
|
||||
* The relaunching process now uses a separate helper app, which is a much more robust method.
|
||||
* Changed CFBundleShortVersionString behavior: Sparkle no longer uses Apple's about box style of displaying ShortVersionString (CFBundleVersion) when the latter is available.
|
||||
* No more MD5 checking. Use DSA: it's actually secure.
|
||||
* The abomination that was SUStatusChecker is dead. Use SUProbingUpdateDriver instead.
|
||||
* Bugfixes:
|
||||
* Fixed a huge bug with fully-automatic updating: before, if the user chose to relaunch later, the app would be running from the trash for a while. Now the buttons are "install and relaunch" or "install later."
|
||||
* Sparkle forces Spotlight to reindex the updated app so that it won't keep pointing to the one in the trash.
|
||||
* Sparkle trims whitespace from around DSA signatures; this could cause crashes before.
|
||||
* Fixed a bug where the user choosing to skip a version would inhibit future automatic updates until the next launch.
|
||||
* Fixed a bug that could occur when the app has a localized CFBundleName.
|
||||
* .dmgs now work on Leopard.
|
||||
* The status controller's button now sizes appropriately to the localization.
|
||||
* Sparkle now works correctly with LSUIElement apps: it focuses them before displaying the update alert.
|
||||
* Sparkle now deletes failed partial downloads.
|
||||
* The update alert no longer floats above everything in the app.
|
||||
* Fixed varied and sundry memory leaks.
|
||||
* A ton of other things that I've forgotten or were too small to mention!
|
||||
|
||||
# 1.1
|
||||
|
||||
* Optimized framework size: now only 1.4mb with all localizations and 384kb with only English (an English-only version is in the Extras folder).
|
||||
* Added a new SUStatusChecker class for programmatically determining if a new version is available (see the docs); thanks, Evan Schoenberg!
|
||||
* Added support for apps using SIGCHLD; thanks, Augie Fackler!
|
||||
* Added a zh_CN update from JT Lee
|
||||
* Added a Polish update from Piotr Chylinski
|
||||
* Fixed DMG support for images with /Applications symlinks.
|
||||
* Fixed a really stupid interval-checking bug that could cause repeated hits to the appcast.
|
||||
* Fixed a bug where the check interval would be inconsistent if a value of 0 was stored in the user defaults.
|
||||
|
||||
# 1.0
|
||||
|
||||
* Additions:
|
||||
* Added real version comparison courtesy Kevin Ballard: Sparkle now knows that 0.89 < 1.0a3 < 1.0.
|
||||
* Added many localizations courtesy David Kocher's localization team.
|
||||
* Added a much better installation mechanism courtesy Allan Odgaard.
|
||||
* Added a user agent string to the RSS fetch request.
|
||||
* Added support for CFBundleShortVersionString in addition to CFBundleVersion, and support for a sparkle:shortVersionString attribute on the enclosure.
|
||||
* Added support for CFBundleDisplayName if available.
|
||||
* Changes:
|
||||
* Automatic updating is now allowed by default, but only if DSA signing is on.
|
||||
* Pressing Escape or closing the update alert now reminds the user later.
|
||||
* Now when there's a stored check interval, Sparkle doesn't check immediately on startup the first time the app is launched because the user hasn't consented to it yet.
|
||||
* The update alert now remembers its size and floats.
|
||||
* Bug Fixes:
|
||||
* Fixed installation of DMGs with multiple files enclosed.
|
||||
* Fixed a nasty memory leak.
|
||||
* Fixed a bug wherein having no value for allowing automatic updates would display a checkbox for the updates but would not honor it.
|
||||
* Fixed a bug in zip extraction that occurred in Panther.
|
||||
* Fixed release notes caching.
|
||||
* Fixed a bug wherein Sparkle refused to authenticate the installation if the user had cancelled authentication previously in that session.
|
||||
* Fixed a weird bug that would cause a second help menu to appear on first launch.
|
||||
* Fixed a bug that could occur when changing the scheduled check interval.
|
||||
* Fixed a bug wherein the host app could crash if the user clicked Remind Me Later before the release notes finished loading.
|
||||
* Fixed a bug wherein the behavior was undefined if the user manually initiated a check when an automatic one was already taking place.
|
||||
* Fixed wrapping on the description field in the update alert.
|
||||
|
||||
# 1.0-beta3
|
||||
|
||||
* Fixed a nasty crasher that occurred often when the user was not connected to the internet.
|
||||
|
||||
# 1.0-beta2
|
||||
|
||||
* Major Improvements:
|
||||
* Fully automatic updating! (see the Documentation: this is beta and off by default)
|
||||
* Added support for DSA signatures (see the Documentation).
|
||||
* Added support for MD5 sum verification.
|
||||
* Added Security.framework-based authentication for installing to privileged directories.
|
||||
* Huge refactoring of the codebase: there's now a Sparkle Xcode project, Sparkle is now a framework, and everything is modular / abstracted. And no more code-generated interface.
|
||||
* Minor Improvements:
|
||||
* A SUUpdaterWillRestartNotification is sent out before restarting now.
|
||||
* Added key equivalents to alert panel buttons.
|
||||
* Error handling is much prettier now: technical messages are not presented to the user anymore.
|
||||
* There's now a test app for developers to see what Sparkle's like before using it.
|
||||
* Wrote new, pretty, extremely thorough documentation.
|
||||
* Bug Fixes:
|
||||
* Relaunch behavior is much improved and shouldn't fail in huge apps anymore.
|
||||
* Fixed a bug wherein a failing tar command could crash the host app.
|
||||
* Sparkle now looks at InfoPlist.strings in addition to Info.plist.
|
||||
* Fixed some stupid typos.
|
||||
|
||||
# 1.0-beta1
|
||||
|
||||
* Major New Features:
|
||||
* Sparkle now supports scheduled periodic updates—read the Readme for information on how to use it.
|
||||
* Sparkle now supports WebKit-based release notes (for CSS and full HTML), which it displays in the main update alert, not a separate panel. The Readme has much more information. Sparkle will, of course, fall back on NSTextView if the host app does not include WebKit.
|
||||
* Minor New Features:
|
||||
* Added support for .zip update archives.
|
||||
* Added support for .dmg update archives.
|
||||
* Implemented Remind Me Later to replace simple update cancellation.
|
||||
* Implemented Skip This Version functionality.
|
||||
* Added support for multiple feeds via the user defaults SUFeedURL key taking precedent over the one in Info.plist.
|
||||
* Added support for Sparkle's custom XML namespace, which is optional but may prove useful. See the Readme for more information.
|
||||
* Bug Fixes:
|
||||
* Sparkle will no longer enter an inconsistent state if the user tries to update again while one is already in progress.
|
||||
* Sparkle now uses CFBundleName to determine the application's name instead of the app's filename.
|
||||
* Sparkle no longer crashes if the user cancels during extraction.
|
||||
* Lots of code refactoring.
|
||||
|
||||
# 0.1
|
||||
|
||||
* Initial Release
|
||||
@@ -0,0 +1,4 @@
|
||||
// BinaryDelta tool only
|
||||
|
||||
PRODUCT_NAME = BinaryDelta
|
||||
GCC_PREFIX_HEADER =
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "ConfigBinaryDelta.xcconfig"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "ConfigBinaryDelta.xcconfig"
|
||||
@@ -1,38 +1,61 @@
|
||||
// Common
|
||||
|
||||
PREBINDING = NO
|
||||
ZERO_LINK = NO
|
||||
CURRENT_PROJECT_VERSION = 1.5
|
||||
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.3
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
|
||||
GCC_C_LANGUAGE_STANDARD = c99
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES
|
||||
FINISH_INSTALL_TOOL_NAME = Autoupdate
|
||||
|
||||
SPARKLE_VERSION_MAJOR = 1
|
||||
SPARKLE_VERSION_MINOR = 7
|
||||
SPARKLE_VERSION_PATCH = 1
|
||||
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||
|
||||
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h
|
||||
GCC_FAST_OBJC_DISPATCH = YES
|
||||
GCC_FAST_OBJC_DISPATCH[arch=ppc] = NO // requires 10.4
|
||||
ARCHS = $(ARCHS_STANDARD)
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = FINISH_INSTALL_TOOL_NAME=$(FINISH_INSTALL_TOOL_NAME)
|
||||
|
||||
// Enable warnings
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
|
||||
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES
|
||||
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES
|
||||
GCC_WARN_SHADOW = YES
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
|
||||
CLANG_WARN_EMPTY_BODY = YES
|
||||
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES
|
||||
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES
|
||||
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
|
||||
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
|
||||
CLANG_WARN_OBJC_RECEIVER_WEAK = YES
|
||||
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
||||
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
||||
GCC_WARN_MISSING_PARENTHESES = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
||||
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
||||
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES
|
||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
|
||||
GCC_WARN_PEDANTIC = YES
|
||||
GCC_WARN_SHADOW = YES
|
||||
GCC_WARN_SIGN_COMPARE = YES
|
||||
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = YES
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES
|
||||
GCC_WARN_UNUSED_FUNCTION = YES
|
||||
GCC_WARN_UNUSED_LABEL = YES
|
||||
GCC_WARN_UNUSED_PARAMETER = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
||||
WARNING_CFLAGS = -Wall
|
||||
|
||||
// These should be removed once the conversion to ARC is complete
|
||||
WARNING_CFLAGS_EXTRA = -Wno-objc-interface-ivars -Wno-direct-ivar-access -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-empty-translation-unit -Wno-unused-macros -Wno-gnu-statement-expression $(WARNING_CFLAGS_EXTRA)
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
|
||||
// Debug only
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG -fstack-protector -D_FORTIFY_SOURCE=2
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG
|
||||
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
|
||||
ARCHS = $(NATIVE_ARCH_ACTUAL)
|
||||
ONLY_ACTIVE_ARCH = YES
|
||||
COPY_PHASE_STRIP = NO
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
|
||||
// Release only
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
DEAD_CODE_STRIPPING = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||
ARCHS = ppc i386 x86_64
|
||||
@@ -1,10 +1,11 @@
|
||||
// Framework only
|
||||
|
||||
INSTALL_PATH = @executable_path/../Frameworks
|
||||
DYLIB_COMPATIBILITY_VERSION = 1.5
|
||||
DYLIB_CURRENT_VERSION = 1.5
|
||||
INSTALL_PATH = @loader_path/../Frameworks
|
||||
DYLIB_COMPATIBILITY_VERSION = 1.6
|
||||
DYLIB_CURRENT_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||
PRODUCT_NAME = Sparkle
|
||||
WRAPPER_EXTENSION = framework
|
||||
OTHER_LDFLAGS = -lcrypto
|
||||
FRAMEWORK_VERSION = A
|
||||
INFOPLIST_FILE = Info.plist
|
||||
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
|
||||
GCC_PREFIX_HEADER = Sparkle/Sparkle.pch
|
||||
SKIP_INSTALL = YES
|
||||
@@ -1,5 +1,2 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigFramework.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -fsingle-precision-constant -DDEBUG
|
||||
@@ -1,3 +1,2 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigFramework.xcconfig"
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "ConfigFrameworkRelease.xcconfig"
|
||||
|
||||
GCC_ENABLE_OBJC_GC = supported
|
||||
@@ -1,3 +1,7 @@
|
||||
// Relaunch Tool only
|
||||
|
||||
PRODUCT_NAME = relaunch
|
||||
INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist
|
||||
PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME)
|
||||
SKIP_INSTALL = YES
|
||||
GCC_PREFIX_HEADER = Sparkle/Autoupdate/Autoupdate.pch
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||
@@ -1,5 +1 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigRelaunch.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -fsingle-precision-constant -DDEBUG
|
||||
@@ -1,3 +1 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigRelaunch.xcconfig"
|
||||
@@ -1,5 +1,6 @@
|
||||
// Test Application only
|
||||
|
||||
INFOPLIST_FILE = Test Application/Test Application-Info.plist
|
||||
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
|
||||
PRODUCT_NAME = Sparkle Test App
|
||||
WRAPPER_EXTENSION = app
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||
@@ -1,5 +1,2 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigTestApp.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -fsingle-precision-constant -DDEBUG
|
||||
@@ -1,3 +1 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigTestApp.xcconfig"
|
||||
@@ -0,0 +1,6 @@
|
||||
// Unit Test only
|
||||
|
||||
INFOPLIST_FILE = Tests/SparkleTests-Info.plist
|
||||
PRODUCT_NAME = Sparkle Unit Tests
|
||||
WRAPPER_EXTENSION = xctest
|
||||
WARNING_CFLAGS = $(inherited) -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments
|
||||
@@ -0,0 +1 @@
|
||||
#include "ConfigUnitTest.xcconfig"
|
||||
@@ -0,0 +1 @@
|
||||
#include "ConfigUnitTest.xcconfig"
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$ACTION" = "" ] ; then
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.zip"
|
||||
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp "$SRCROOT/CHANGELOG" "$SRCROOT/LICENSE" "$SRCROOT/Resources/SampleAppcast.xml" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
|
||||
|
||||
cd "$CONFIGURATION_BUILD_DIR/staging"
|
||||
zip --symlinks -r "../Sparkle-$CURRENT_PROJECT_VERSION.zip" .
|
||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
html
|
||||
@@ -0,0 +1,20 @@
|
||||
PROJECT_NAME = Sparkle
|
||||
PROJECT_NUMBER = 1.7.1
|
||||
PROJECT_BRIEF = "A software update framework for OS X"
|
||||
PROJECT_LOGO = Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png
|
||||
|
||||
RECURSIVE = YES
|
||||
INPUT = Sparkle
|
||||
OUTPUT_DIRECTORY = Documentation
|
||||
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
QT_AUTOBRIEF = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$ACTION" = "" ] ; then
|
||||
if which -s doxygen ; then
|
||||
doxygen Documentation/Doxyfile
|
||||
else
|
||||
echo "warning: Doxygen not found in PATH"
|
||||
fi
|
||||
elif [ "$ACTION" = "clean" ] ; then
|
||||
rm -rf "$SRCROOT/Documentation/html"
|
||||
fi
|
||||
@@ -0,0 +1,50 @@
|
||||
Copyright (c) 2006-2014 Andy Matuschak
|
||||
Copyright (c) 2013-2014 Kornel Lesinski
|
||||
Copyright (c) 2014 Petroules Corporation, Sparkle Project contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
=================
|
||||
EXTERNAL LICENSES
|
||||
=================
|
||||
|
||||
License for bsdiff.c and bspatch.c, from bsdiff 4.3 (<http://www.daemonology.net/bsdiff/>):
|
||||
|
||||
Copyright 2003-2005 Colin Percival
|
||||
All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted providing that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,7 +0,0 @@
|
||||
Copyright (c) 2006 Andy Matuschak
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,7 +1,13 @@
|
||||
.PHONY: all localizable-strings
|
||||
|
||||
localizable-strings:
|
||||
rm en.lproj/Sparkle.strings || TRUE
|
||||
genstrings -o en.lproj -s SULocalizedString *.m *.h
|
||||
mv en.lproj/Localizable.strings en.lproj/Sparkle.strings
|
||||
builddir := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX")
|
||||
|
||||
localizable-strings:
|
||||
rm Sparkle/en.lproj/Sparkle.strings || TRUE
|
||||
genstrings -o Sparkle/en.lproj -s SULocalizedString Sparkle/*.m Sparkle/*.h
|
||||
iconv -f UTF-16 -t UTF-8 < Sparkle/en.lproj/Localizable.strings > Sparkle/en.lproj/Sparkle.strings
|
||||
rm Sparkle/en.lproj/Localizable.strings
|
||||
|
||||
release:
|
||||
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(builddir)"
|
||||
open -R "$(builddir)/Build/Products/Release/Sparkle-"*.zip
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// NSBundle+SUAdditions.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 12/21/07.
|
||||
// Copyright 2007 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSBUNDLE_PLUS_ADDITIONS_H
|
||||
#define NSBUNDLE_PLUS_ADDITIONS_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSBundle (SUAdditions)
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns a name for the bundle suitable for display to the user.
|
||||
@discussion This is performed by asking NSFileManager for the display name of the bundle.
|
||||
*/
|
||||
- (NSString *)name;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns the current internal version of the bundle.
|
||||
@discussion This uses the CFBundleVersion info value. This string is not appropriate for display to users: use -displayVersion instead.
|
||||
*/
|
||||
- (NSString *)version;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns the bundle's version, suitable for display to the user.
|
||||
@discussion If the CFBundleShortVersionString is available and different from the CFBundleVersion, this looks like CFBundleShortVersionString (CFBundleVersion). If the version strings are the same or CFBundleShortVersionString is not defined, this is equivalent to -version.
|
||||
*/
|
||||
- (NSString *)displayVersion;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns a suitable icon for this bundle.
|
||||
@discussion Uses the CFBundleIconFile icon if defined; otherwise, uses the default application icon.
|
||||
*/
|
||||
- (NSImage *)icon;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns whether the application is running from a disk image.
|
||||
*/
|
||||
- (BOOL)isRunningFromDiskImage;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns a profile of the users system useful for statistical purposes.
|
||||
@discussion Returns an array of dictionaries; each dictionary represents a piece of data and has keys "key", "visibleKey", "value", and "visibleValue".
|
||||
*/
|
||||
- (NSArray *)systemProfile;
|
||||
|
||||
- (NSString *)publicDSAKey;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,89 +0,0 @@
|
||||
//
|
||||
// NSBundle+SUAdditions.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 12/21/07.
|
||||
// Copyright 2007 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NSBundle+SUAdditions.h"
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_4
|
||||
#define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
|
||||
@implementation NSBundle (SUAdditions)
|
||||
|
||||
- (NSString *)name
|
||||
{
|
||||
NSString *name = [self objectForInfoDictionaryKey:@"CFBundleDisplayName"];
|
||||
if (name) return name;
|
||||
|
||||
name = [self objectForInfoDictionaryKey:@"CFBundleName"];
|
||||
if (name) return name;
|
||||
|
||||
return [[[NSFileManager defaultManager] displayNameAtPath:[self bundlePath]] stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
- (NSString *)version
|
||||
{
|
||||
return [self objectForInfoDictionaryKey:@"CFBundleVersion"];
|
||||
}
|
||||
|
||||
- (NSString *)displayVersion
|
||||
{
|
||||
NSString *shortVersionString = [self objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
if (shortVersionString)
|
||||
return shortVersionString;
|
||||
else
|
||||
return [self version]; // Fall back on the normal version string.
|
||||
}
|
||||
|
||||
- (NSImage *)icon
|
||||
{
|
||||
// Cache the application icon.
|
||||
NSString *iconPath = [self pathForResource:[self objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType:@"icns"];
|
||||
// According to the OS X docs, "CFBundleIconFile - This key identifies the file containing
|
||||
// the icon for the bundle. The filename you specify does not need to include the .icns
|
||||
// extension, although it may."
|
||||
//
|
||||
// However, if it *does* include the '.icns' the above method fails (tested on OS X 10.3.9) so we'll also try:
|
||||
if (!iconPath)
|
||||
iconPath = [self pathForResource:[self objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType: nil];
|
||||
NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:iconPath] autorelease];
|
||||
// Use a default icon if none is defined.
|
||||
if (!icon) { [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)]; }
|
||||
return icon;
|
||||
}
|
||||
|
||||
- (BOOL)isRunningFromDiskImage
|
||||
{
|
||||
// This check causes crashes on 10.3; for now, we'll just skip it.
|
||||
if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_4)
|
||||
return NO;
|
||||
|
||||
NSDictionary *pathProperties = [[NSWorkspace sharedWorkspace] propertiesForPath:[self bundlePath]];
|
||||
BOOL isDiskImage = [pathProperties objectForKey:NSWorkspace_RBimagefilepath] != nil;
|
||||
BOOL isFileVault = [[pathProperties objectForKey:NSWorkspace_RBmntonname] hasPrefix:@"/Users/"];
|
||||
return isDiskImage && !isFileVault;
|
||||
}
|
||||
|
||||
- (NSString *)publicDSAKey
|
||||
{
|
||||
// Maybe the key is just a string in the Info.plist.
|
||||
NSString *key = [self objectForInfoDictionaryKey:SUPublicDSAKeyKey];
|
||||
if (key) { return key; }
|
||||
|
||||
// More likely, we've got a reference to a Resources file by filename:
|
||||
NSString *keyFilename = [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
|
||||
if (!keyFilename) { return nil; }
|
||||
return [NSString stringWithContentsOfFile:[self pathForResource:keyFilename ofType:nil]];
|
||||
}
|
||||
|
||||
- (NSArray *)systemProfile
|
||||
{
|
||||
return [[SUSystemProfiler sharedSystemProfiler] systemProfileArrayForHostBundle:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Aliases.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 2/4/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSFILEMANAGER_PLUS_ALIASES_H
|
||||
#define NSFILEMANAGER_PLUS_ALIASES_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSFileManager (SUAliases)
|
||||
- (BOOL)isAliasFolderAtPath:(NSString *)path;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Aliases.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 2/4/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSFileManager+Aliases.h"
|
||||
|
||||
|
||||
@implementation NSFileManager (SUAliases)
|
||||
|
||||
- (BOOL)isAliasFolderAtPath:(NSString *)path
|
||||
{
|
||||
FSRef fileRef;
|
||||
OSStatus err = noErr;
|
||||
Boolean aliasFileFlag, folderFlag;
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:path];
|
||||
|
||||
if (FALSE == CFURLGetFSRef((CFURLRef)fileURL, &fileRef))
|
||||
err = coreFoundationUnknownErr;
|
||||
|
||||
if (noErr == err)
|
||||
err = FSIsAliasFile(&fileRef, &aliasFileFlag, &folderFlag);
|
||||
|
||||
if (noErr == err)
|
||||
return (BOOL)(aliasFileFlag && folderFlag);
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Authentication.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/9/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSFILEMANAGER_PLUS_AUTHENTICATION_H
|
||||
#define NSFILEMANAGER_PLUS_AUTHENTICATION_H
|
||||
|
||||
@interface NSFileManager (SUAuthenticationAdditions)
|
||||
- (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst error:(NSError **)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,249 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Authentication.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/9/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
// This code based on generous contribution from Allan Odgaard. Thanks, Allan!
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NSFileManager+Authentication.h"
|
||||
|
||||
#import <Security/Security.h>
|
||||
#import <sys/stat.h>
|
||||
#import <sys/wait.h>
|
||||
#import <dirent.h>
|
||||
#import <unistd.h>
|
||||
|
||||
#import "NSFileManager+ExtendedAttributes.h"
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const char* const* arguments)
|
||||
{
|
||||
sig_t oldSigChildHandler = signal(SIGCHLD, SIG_DFL);
|
||||
BOOL returnValue = YES;
|
||||
|
||||
if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, (char* const*)arguments, NULL) == errAuthorizationSuccess)
|
||||
{
|
||||
int status;
|
||||
pid_t pid = wait(&status);
|
||||
if (pid == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||
returnValue = NO;
|
||||
}
|
||||
else
|
||||
returnValue = NO;
|
||||
|
||||
signal(SIGCHLD, oldSigChildHandler);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@implementation NSFileManager (SUAuthenticationAdditions)
|
||||
|
||||
- (BOOL)currentUserOwnsPath:(NSString *)oPath
|
||||
{
|
||||
const char *path = [oPath fileSystemRepresentation];
|
||||
uid_t uid = getuid();
|
||||
bool res = false;
|
||||
struct stat sb;
|
||||
if(stat(path, &sb) == 0)
|
||||
{
|
||||
if(sb.st_uid == uid)
|
||||
{
|
||||
res = true;
|
||||
if(sb.st_mode & S_IFDIR)
|
||||
{
|
||||
DIR* dir = opendir(path);
|
||||
struct dirent* entry = NULL;
|
||||
while(res && (entry = readdir(dir)))
|
||||
{
|
||||
if(strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
size_t len = strlen(path) + 1 + entry->d_namlen + 1;
|
||||
char descend[len];
|
||||
strlcpy(descend, path, len);
|
||||
strlcat(descend, "/", len);
|
||||
strlcat(descend, entry->d_name, len);
|
||||
NSString* newPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:descend length:strlen(descend)];
|
||||
res = [self currentUserOwnsPath:newPath];
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
- (NSString *)_temporaryCopyNameForPath:(NSString *)path
|
||||
{
|
||||
// Let's try to read the version number so the filename will be more meaningful.
|
||||
NSString *postFix;
|
||||
NSBundle *bundle;
|
||||
if ((bundle = [NSBundle bundleWithPath:path]))
|
||||
{
|
||||
// We'll clean it up a little for safety.
|
||||
// The cast is necessary because of a bug in the headers in pre-10.5 SDKs
|
||||
NSMutableCharacterSet *validCharacters = (id)[NSMutableCharacterSet alphanumericCharacterSet];
|
||||
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
|
||||
postFix = [[bundle objectForInfoDictionaryKey:@"CFBundleVersion"] stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
|
||||
}
|
||||
else
|
||||
postFix = @"old";
|
||||
NSString *prefix = [[path stringByDeletingPathExtension] stringByAppendingFormat:@" (%@)", postFix];
|
||||
NSString *tempDir = [prefix stringByAppendingPathExtension:[path pathExtension]];
|
||||
// Now let's make sure we get a unique path.
|
||||
int cnt=2;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999999)
|
||||
tempDir = [NSString stringWithFormat:@"%@ %d.%@", prefix, cnt++, [path pathExtension]];
|
||||
return tempDir;
|
||||
}
|
||||
|
||||
- (BOOL)_copyPathWithForcedAuthentication:(NSString *)src toPath:(NSString *)dst error:(NSError **)error
|
||||
{
|
||||
NSString *tmp = [self _temporaryCopyNameForPath:dst];
|
||||
const char* srcPath = [src fileSystemRepresentation];
|
||||
const char* tmpPath = [tmp fileSystemRepresentation];
|
||||
const char* dstPath = [dst fileSystemRepresentation];
|
||||
|
||||
struct stat dstSB;
|
||||
stat(dstPath, &dstSB);
|
||||
|
||||
AuthorizationRef auth = NULL;
|
||||
OSStatus authStat = errAuthorizationDenied;
|
||||
while (authStat == errAuthorizationDenied) {
|
||||
authStat = AuthorizationCreate(NULL,
|
||||
kAuthorizationEmptyEnvironment,
|
||||
kAuthorizationFlagDefaults,
|
||||
&auth);
|
||||
}
|
||||
|
||||
BOOL res = NO;
|
||||
if (authStat == errAuthorizationSuccess) {
|
||||
res = YES;
|
||||
|
||||
char uidgid[42];
|
||||
snprintf(uidgid, sizeof(uidgid), "%d:%d",
|
||||
dstSB.st_uid, dstSB.st_gid);
|
||||
|
||||
const char* executables[] = {
|
||||
"/bin/rm",
|
||||
"/bin/mv",
|
||||
"/bin/mv",
|
||||
"/bin/rm",
|
||||
NULL, // pause here and do some housekeeping before
|
||||
// continuing
|
||||
"/usr/sbin/chown",
|
||||
NULL // stop here for real
|
||||
};
|
||||
|
||||
// 4 is the maximum number of arguments to any command,
|
||||
// including the NULL that signals the end of an argument
|
||||
// list.
|
||||
const char* const argumentLists[][4] = {
|
||||
{ "-rf", tmpPath, NULL }, // make room for the temporary file... this is kinda unsafe; should probably do something better.
|
||||
{ "-f", dstPath, tmpPath, NULL }, // mv
|
||||
{ "-f", srcPath, dstPath, NULL }, // mv
|
||||
{ "-rf", tmpPath, NULL }, // rm
|
||||
{ NULL }, // pause
|
||||
{ "-R", uidgid, dstPath, NULL }, // chown
|
||||
{ NULL } // stop
|
||||
};
|
||||
|
||||
// Process the commands up until the first NULL
|
||||
int commandIndex = 0;
|
||||
for (; executables[commandIndex] != NULL; ++commandIndex) {
|
||||
if (res)
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, executables[commandIndex], kAuthorizationFlagDefaults, argumentLists[commandIndex]);
|
||||
}
|
||||
|
||||
// If the currently-running application is trusted, the new
|
||||
// version should be trusted as well. Remove it from the
|
||||
// quarantine to avoid a delay at launch, and to avoid
|
||||
// presenting the user with a confusing trust dialog.
|
||||
//
|
||||
// This needs to be done after the application is moved to its
|
||||
// new home with "mv" in case it's moved across filesystems: if
|
||||
// that happens, "mv" actually performs a copy and may result
|
||||
// in the application being quarantined. It also needs to be
|
||||
// done before "chown" changes ownership, because the ownership
|
||||
// change will almost certainly make it impossible to change
|
||||
// attributes to release the files from the quarantine.
|
||||
if (res) {
|
||||
[self releaseFromQuarantine:dst];
|
||||
}
|
||||
|
||||
// Now move past the NULL we found and continue executing
|
||||
// commands from the list.
|
||||
++commandIndex;
|
||||
|
||||
for (; executables[commandIndex] != NULL; ++commandIndex) {
|
||||
if (res)
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, executables[commandIndex], kAuthorizationFlagDefaults, argumentLists[commandIndex]);
|
||||
}
|
||||
|
||||
AuthorizationFree(auth, 0);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
// Something went wrong somewhere along the way, but we're not sure exactly where.
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Authenticated file copy from %@ to %@ failed.", src, dst];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:@"Couldn't get permission to authenticate." forKey:NSLocalizedDescriptionKey]];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
- (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst error:(NSError **)error
|
||||
{
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:dst])
|
||||
{
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Couldn't copy %@ over %@ because there is no file at %@.", src, dst, dst];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![[NSFileManager defaultManager] isWritableFileAtPath:dst] || ![[NSFileManager defaultManager] isWritableFileAtPath:[dst stringByDeletingLastPathComponent]])
|
||||
return [self _copyPathWithForcedAuthentication:src toPath:dst error:error];
|
||||
|
||||
NSString *tmpPath = [self _temporaryCopyNameForPath:dst];
|
||||
|
||||
if (![[NSFileManager defaultManager] movePath:dst toPath:tmpPath handler:self])
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
if (![[NSFileManager defaultManager] copyPath:src toPath:dst handler:self])
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Trash the old copy of the app.
|
||||
NSInteger tag = 0;
|
||||
if (![[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tmpPath stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[tmpPath lastPathComponent]] tag:&tag])
|
||||
NSLog(@"Sparkle error: couldn't move %@ to the trash. This is often a sign of a permissions error.", tmpPath);
|
||||
|
||||
// If the currently-running application is trusted, the new
|
||||
// version should be trusted as well. Remove it from the
|
||||
// quarantine to avoid a delay at launch, and to avoid
|
||||
// presenting the user with a confusing trust dialog.
|
||||
//
|
||||
// This needs to be done after the application is moved to its
|
||||
// new home in case it's moved across filesystems: if that
|
||||
// happens, the move is actually a copy, and it may result
|
||||
// in the application being quarantined.
|
||||
[self releaseFromQuarantine:dst];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// NSFileManager+ExtendedAttributes.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Mentovai on 2008-01-22.
|
||||
// Copyright 2008 Mark Mentovai. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSFILEMANAGER_PLUS_EXTENDEDATTRIBUTES
|
||||
#define NSFILEMANAGER_PLUS_EXTENDEDATTRIBUTES
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSFileManager (MMExtendedAttributes)
|
||||
|
||||
// Wraps the removexattr system call, allowing an AppKit-style NSString* to
|
||||
// be used for the pathname argument. Note that the order of the arguments
|
||||
// has changed from what removexattr accepts, so that code reads more
|
||||
// naturally.
|
||||
//
|
||||
// removexattr is only available on Mac OS X 10.4 ("Tiger") and later. If
|
||||
// built with an SDK that includes removexattr, this method will link against
|
||||
// removexattr directly. When using earlier SDKs, this method will dynamically
|
||||
// look up the removexattr symbol at runtime. If the symbol is not present,
|
||||
// as will be the case when running on 10.3, this method returns -1 and sets
|
||||
// errno to ENOSYS.
|
||||
- (int)removeXAttr:(const char*)name
|
||||
fromFile:(NSString*)file
|
||||
options:(int)options;
|
||||
|
||||
// Removes the directory tree rooted at |root| from the file quarantine.
|
||||
// The quarantine was introduced on Mac OS X 10.5 and is described at:
|
||||
//
|
||||
// http://developer.apple.com/releasenotes/Carbon/RN-LaunchServices/index.html
|
||||
//#apple_ref/doc/uid/TP40001369-DontLinkElementID_2
|
||||
//
|
||||
// If |root| is not a directory, then it alone is removed from the quarantine.
|
||||
// Symbolic links, including |root| if it is a symbolic link, will not be
|
||||
// traversed.
|
||||
//
|
||||
// Ordinarily, the quarantine is managed by calling LSSetItemAttribute
|
||||
// to set the kLSItemQuarantineProperties attribute to a dictionary specifying
|
||||
// the quarantine properties to be applied. However, it does not appear to be
|
||||
// possible to remove an item from the quarantine directly through any public
|
||||
// Launch Services calls. Instead, this method takes advantage of the fact
|
||||
// that the quarantine is implemented in part by setting an extended attribute,
|
||||
// "com.apple.quarantine", on affected files. Removing this attribute is
|
||||
// sufficient to remove files from the quarantine.
|
||||
- (void)releaseFromQuarantine:(NSString*)root;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,98 +0,0 @@
|
||||
//
|
||||
// NSFileManager+ExtendedAttributes.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Mentovai on 2008-01-22.
|
||||
// Copyright 2008 Mark Mentovai. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSFileManager+ExtendedAttributes.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
|
||||
// Extended attribute support was introduced in Mac OS X 10.4 ("Tiger").
|
||||
// If building with an earlier SDK, provide definitions needed to handle
|
||||
// extended attributes at runtime.
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 // SDK >= 10.4
|
||||
#include <sys/xattr.h>
|
||||
#else // SDK >= 10.4
|
||||
#define XATTR_NOFOLLOW 1
|
||||
#endif // SDK >= 10.4
|
||||
|
||||
@implementation NSFileManager (MMExtendedAttributes)
|
||||
|
||||
- (int)removeXAttr:(const char*)name
|
||||
fromFile:(NSString*)file
|
||||
options:(int)options
|
||||
{
|
||||
typedef int (*removexattr_type)(const char*, const char*, int);
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 // SDK >= 10.4
|
||||
// Reference removexattr directly, it's in the SDK.
|
||||
static removexattr_type removexattr_func = removexattr;
|
||||
#else // SDK >= 10.4
|
||||
// removexattr isn't in this SDK, look it up at runtime.
|
||||
static removexattr_type removexattr_func = NULL;
|
||||
static BOOL didSymbolLookup = NO;
|
||||
if (!didSymbolLookup) {
|
||||
didSymbolLookup = YES;
|
||||
removexattr_func = dlsym(RTLD_NEXT, "removexattr");
|
||||
}
|
||||
#endif // SDK >= 10.4
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 // DT < 10.4
|
||||
// Make sure that the symbol is present. This checks the deployment
|
||||
// target instead of the SDK so that it's able to catch dlsym failures
|
||||
// as well as the null symbol that would result from building with the
|
||||
// 10.4 SDK and a lower deployment target, and running on 10.3.
|
||||
if (!removexattr_func) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif // DT < 10.4
|
||||
|
||||
const char* path = NULL;
|
||||
@try {
|
||||
path = [file fileSystemRepresentation];
|
||||
}
|
||||
@catch (id exception) {
|
||||
// -[NSString fileSystemRepresentation] throws an exception if it's
|
||||
// unable to convert the string to something suitable. Map that to
|
||||
// EDOM, "argument out of domain", which sort of conveys that there
|
||||
// was a conversion failure.
|
||||
errno = EDOM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return removexattr_func(path, name, options);
|
||||
}
|
||||
|
||||
- (void)releaseFromQuarantine:(NSString*)root
|
||||
{
|
||||
const char* quarantineAttribute = "com.apple.quarantine";
|
||||
const int removeXAttrOptions = XATTR_NOFOLLOW;
|
||||
|
||||
[self removeXAttr:quarantineAttribute
|
||||
fromFile:root
|
||||
options:removeXAttrOptions];
|
||||
|
||||
// Only recurse if it's actually a directory. Don't recurse into a
|
||||
// root-level symbolic link.
|
||||
NSDictionary* rootAttributes =
|
||||
[self fileAttributesAtPath:root traverseLink:NO];
|
||||
NSString* rootType = [rootAttributes objectForKey:NSFileType];
|
||||
|
||||
if (rootType == NSFileTypeDirectory) {
|
||||
// The NSDirectoryEnumerator will avoid recursing into any contained
|
||||
// symbolic links, so no further type checks are needed.
|
||||
NSDirectoryEnumerator* directoryEnumerator = [self enumeratorAtPath:root];
|
||||
NSString* file = nil;
|
||||
while ((file = [directoryEnumerator nextObject])) {
|
||||
[self removeXAttr:quarantineAttribute
|
||||
fromFile:[root stringByAppendingPathComponent:file]
|
||||
options:removeXAttrOptions];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,17 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Verification.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSFILEMANAGER_PLUS_VERIFICATION_H
|
||||
#define NSFILEMANAGER_PLUS_VERIFICATION_H
|
||||
|
||||
// For the paranoid folks!
|
||||
@interface NSFileManager (SUVerification)
|
||||
- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,151 +0,0 @@
|
||||
//
|
||||
// NSFileManager+Verification.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
// DSA stuff adapted from code provided by Allan Odgaard. Thanks, Allan!
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NSFileManager+Verification.h"
|
||||
|
||||
#import <stdio.h>
|
||||
#import <openssl/evp.h>
|
||||
#import <openssl/bio.h>
|
||||
#import <openssl/pem.h>
|
||||
#import <openssl/rsa.h>
|
||||
#import <openssl/sha.h>
|
||||
|
||||
long b64decode(unsigned char* str)
|
||||
{
|
||||
unsigned char *cur, *start;
|
||||
int d, dlast, phase;
|
||||
unsigned char c;
|
||||
static int table[256] = {
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00-0F */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10-1F */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20-2F */
|
||||
52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30-3F */
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40-4F */
|
||||
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50-5F */
|
||||
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60-6F */
|
||||
41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70-7F */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80-8F */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90-9F */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0-AF */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0-BF */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0-CF */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0-DF */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0-EF */
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */
|
||||
};
|
||||
|
||||
d = dlast = phase = 0;
|
||||
start = str;
|
||||
for (cur = str; *cur != '\0'; ++cur )
|
||||
{
|
||||
if(*cur == '\n' || *cur == '\r'){phase = dlast = 0; continue;}
|
||||
d = table[(int)*cur];
|
||||
if(d != -1)
|
||||
{
|
||||
switch(phase)
|
||||
{
|
||||
case 0:
|
||||
++phase;
|
||||
break;
|
||||
case 1:
|
||||
c = ((dlast << 2) | ((d & 0x30) >> 4));
|
||||
*str++ = c;
|
||||
++phase;
|
||||
break;
|
||||
case 2:
|
||||
c = (((dlast & 0xf) << 4) | ((d & 0x3c) >> 2));
|
||||
*str++ = c;
|
||||
++phase;
|
||||
break;
|
||||
case 3:
|
||||
c = (((dlast & 0x03 ) << 6) | d);
|
||||
*str++ = c;
|
||||
phase = 0;
|
||||
break;
|
||||
}
|
||||
dlast = d;
|
||||
}
|
||||
}
|
||||
*str = '\0';
|
||||
return str - start;
|
||||
}
|
||||
|
||||
EVP_PKEY* load_dsa_key(char *key)
|
||||
{
|
||||
EVP_PKEY* pkey = NULL;
|
||||
BIO *bio;
|
||||
if((bio = BIO_new_mem_buf(key, (int)strlen(key))))
|
||||
{
|
||||
DSA* dsa_key = 0;
|
||||
if(PEM_read_bio_DSA_PUBKEY(bio, &dsa_key, NULL, NULL))
|
||||
{
|
||||
if((pkey = EVP_PKEY_new()))
|
||||
{
|
||||
if(EVP_PKEY_assign_DSA(pkey, dsa_key) != 1)
|
||||
{
|
||||
DSA_free(dsa_key);
|
||||
EVP_PKEY_free(pkey);
|
||||
pkey = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIO_free(bio);
|
||||
}
|
||||
return pkey;
|
||||
}
|
||||
|
||||
@implementation NSFileManager (SUVerification)
|
||||
|
||||
- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString
|
||||
{
|
||||
BOOL result = NO;
|
||||
if (!encodedSignature) { return NO; }
|
||||
if (!pkeyString) { return NO; }
|
||||
|
||||
// Remove whitespace around each line of the key.
|
||||
NSMutableArray *pkeyTrimmedLines = [NSMutableArray array];
|
||||
NSEnumerator *pkeyLinesEnumerator = [[pkeyString componentsSeparatedByString:@"\n"] objectEnumerator];
|
||||
NSString *pkeyLine;
|
||||
while ((pkeyLine = [pkeyLinesEnumerator nextObject]) != nil)
|
||||
{
|
||||
[pkeyTrimmedLines addObject:[pkeyLine stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
}
|
||||
pkeyString = [pkeyTrimmedLines componentsJoinedByString:@"\n"]; // Put them back together.
|
||||
|
||||
EVP_PKEY* pkey = NULL;
|
||||
pkey = load_dsa_key((char *)[pkeyString UTF8String]);
|
||||
if (!pkey) { return NO; }
|
||||
|
||||
// Now, the signature is in base64; we have to decode it into a binary stream.
|
||||
unsigned char *signature = (unsigned char *)[encodedSignature UTF8String];
|
||||
long length = b64decode(signature); // Decode the signature in-place and get the new length of the signature string.
|
||||
|
||||
// We've got the signature, now get the file data.
|
||||
NSData *pathData = [NSData dataWithContentsOfFile:path];
|
||||
if (!pathData) { return NO; }
|
||||
|
||||
// Hash the file with SHA-1.
|
||||
unsigned char md[SHA_DIGEST_LENGTH];
|
||||
SHA1([pathData bytes], [pathData length], md);
|
||||
|
||||
// Actually verify the signature on the file.
|
||||
EVP_MD_CTX ctx;
|
||||
if(EVP_VerifyInit(&ctx, EVP_dss1()) == 1) // We're using DSA keys.
|
||||
{
|
||||
EVP_VerifyUpdate(&ctx, md, SHA_DIGEST_LENGTH);
|
||||
result = (EVP_VerifyFinal(&ctx, signature, (unsigned int)length, pkey) == 1);
|
||||
}
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// NSNumber+Units.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Jonas Witt on 5/18/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface NSNumber (JWUnits)
|
||||
|
||||
+ (NSString *)humanReadableSizeFromDouble:(double)value;
|
||||
|
||||
@end
|
||||
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// NSNumber+Units.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Jonas Witt on 5/18/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSNumber+Units.h"
|
||||
#import "Sparkle.h"
|
||||
|
||||
@implementation NSNumber (JWUnits)
|
||||
|
||||
+ (NSString *)humanReadableSizeFromDouble:(double)value
|
||||
{
|
||||
if (value < 1024)
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value, SULocalizedString(@"B", @"the unit for bytes")];
|
||||
|
||||
if (value < 1024 * 1024)
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1024.0, SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
|
||||
if (value < 1024 * 1024 * 1024)
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1024.0 / 1024.0, SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1024.0 / 1024.0 / 1024.0, SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2002, Brent Simmons
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of ranchero.com or Brent Simmons nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NSSTRING_PLUS_EXTRAS_H
|
||||
#define NSSTRING_PLUS_EXTRAS_H
|
||||
|
||||
|
||||
/*
|
||||
NSString+extras.h
|
||||
NetNewsWire
|
||||
|
||||
Created by Brent Simmons on Fri Jun 14 2002.
|
||||
Copyright (c) 2002 Brent Simmons. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#import "SUConstants.h" // for NSInteger
|
||||
|
||||
@interface NSString (BSextras)
|
||||
|
||||
- (NSString *)stringWithSubstitute:(NSString *)subs forCharactersFromSet:(NSCharacterSet *)set;
|
||||
|
||||
- (NSString *) trimWhiteSpace;
|
||||
|
||||
- (NSString *) stripHTML;
|
||||
|
||||
- (NSString *) ellipsizeAfterNWords: (NSInteger) n;
|
||||
|
||||
+ (BOOL) stringIsEmpty: (NSString *) s;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2002, Brent Simmons
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of ranchero.com or Brent Simmons nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
NSString+extras.m
|
||||
NetNewsWire
|
||||
|
||||
Created by Brent Simmons on Fri Jun 14 2002.
|
||||
Copyright (c) 2002 Brent Simmons. All rights reserved.
|
||||
*/
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NSString+extras.h"
|
||||
|
||||
|
||||
@implementation NSString (BSextras)
|
||||
|
||||
- (NSString *)stringWithSubstitute:(NSString *)subs forCharactersFromSet:(NSCharacterSet *)set
|
||||
{
|
||||
NSRange r = [self rangeOfCharacterFromSet:set];
|
||||
if (r.location == NSNotFound) return self;
|
||||
NSMutableString *newString = [self mutableCopy];
|
||||
do
|
||||
{
|
||||
[newString replaceCharactersInRange:r withString:subs];
|
||||
r = [newString rangeOfCharacterFromSet:set];
|
||||
}
|
||||
while (r.location != NSNotFound);
|
||||
return [newString autorelease];
|
||||
}
|
||||
|
||||
- (NSString *) trimWhiteSpace {
|
||||
|
||||
NSMutableString *s = [[self mutableCopy] autorelease];
|
||||
|
||||
CFStringTrimWhitespace ((CFMutableStringRef) s);
|
||||
|
||||
return (NSString *) [[s copy] autorelease];
|
||||
} /*trimWhiteSpace*/
|
||||
|
||||
|
||||
- (NSString *) ellipsizeAfterNWords: (NSInteger) n {
|
||||
|
||||
NSArray *stringComponents = [self componentsSeparatedByString: @" "];
|
||||
NSMutableArray *componentsCopy = [stringComponents mutableCopy];
|
||||
NSInteger ix = n;
|
||||
NSInteger len = [componentsCopy count];
|
||||
|
||||
if (len < n)
|
||||
ix = len;
|
||||
|
||||
[componentsCopy removeObjectsInRange: NSMakeRange (ix, len - ix)];
|
||||
|
||||
return [componentsCopy componentsJoinedByString: @" "];
|
||||
} /*ellipsizeAfterNWords*/
|
||||
|
||||
|
||||
- (NSString *) stripHTML {
|
||||
|
||||
NSUInteger len = [self length];
|
||||
NSMutableString *s = [NSMutableString stringWithCapacity: len];
|
||||
NSUInteger i = 0, level = 0;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
|
||||
NSString *ch = [self substringWithRange: NSMakeRange (i, 1)];
|
||||
|
||||
if ([ch isEqualTo: @"<"])
|
||||
level++;
|
||||
|
||||
else if ([ch isEqualTo: @">"]) {
|
||||
|
||||
level--;
|
||||
|
||||
if (level == 0)
|
||||
[s appendString: @" "];
|
||||
} /*else if*/
|
||||
|
||||
else if (level == 0)
|
||||
[s appendString: ch];
|
||||
} /*for*/
|
||||
|
||||
return (NSString *) [[s copy] autorelease];
|
||||
} /*stripHTML*/
|
||||
|
||||
|
||||
+ (BOOL) stringIsEmpty: (NSString *) s {
|
||||
|
||||
NSString *copy;
|
||||
|
||||
if (s == nil)
|
||||
return (YES);
|
||||
|
||||
if ([s isEqualTo: @""])
|
||||
return (YES);
|
||||
|
||||
copy = [[s copy] autorelease];
|
||||
|
||||
if ([[copy trimWhiteSpace] isEqualTo: @""])
|
||||
return (YES);
|
||||
|
||||
return (NO);
|
||||
} /*stringIsEmpty*/
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// NSURL+Parameters.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/6/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSURL_PLUS_PARAMETERS_H
|
||||
#define NSURL_PLUS_PARAMETERS_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSURL (SUParameterAdditions)
|
||||
- (NSURL *)URLWithParameters:(NSArray *)parameters;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// NSURL+Parameters.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/6/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSURL+Parameters.h"
|
||||
|
||||
@implementation NSURL (SUParameterAdditions)
|
||||
- (NSURL *)URLWithParameters:(NSArray *)parameters;
|
||||
{
|
||||
if (parameters == nil || [parameters count] == 0) { return self; }
|
||||
NSMutableArray *profileInfo = [NSMutableArray array];
|
||||
NSEnumerator *profileInfoEnumerator = [parameters objectEnumerator];
|
||||
NSDictionary *currentProfileInfo;
|
||||
while ((currentProfileInfo = [profileInfoEnumerator nextObject])) {
|
||||
[profileInfo addObject:[NSString stringWithFormat:@"%@=%@", [currentProfileInfo objectForKey:@"key"], [currentProfileInfo objectForKey:@"value"]]];
|
||||
}
|
||||
|
||||
NSString *appcastStringWithProfile = [NSString stringWithFormat:@"%@?%@", [self absoluteString], [profileInfo componentsJoinedByString:@"&"]];
|
||||
|
||||
// Clean it up so it's a valid URL
|
||||
return [NSURL URLWithString:[appcastStringWithProfile stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// NSWorkspace+SystemVersion.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/7/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSWORKSPACE_PLUS_SYSTEMVERSION_H
|
||||
#define NSWORKSPACE_PLUS_SYSTEMVERSION_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSWorkspace (SUSystemVersion)
|
||||
+ (NSString *)systemVersionString;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// NSWorkspace+SystemVersion.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/7/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSWorkspace+SystemVersion.h"
|
||||
|
||||
|
||||
@implementation NSWorkspace (SUSystemVersion)
|
||||
+ (NSString *)systemVersionString
|
||||
{
|
||||
// This returns a version string of the form X.Y.Z
|
||||
// There may be a better way to deal with the problem that gestaltSystemVersionMajor
|
||||
// et al. are not defined in 10.3, but this is probably good enough.
|
||||
NSString* verStr = nil;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
|
||||
SInt32 major, minor, bugfix;
|
||||
OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major);
|
||||
OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix);
|
||||
if (!err1 && !err2 && !err3)
|
||||
{
|
||||
verStr = [NSString stringWithFormat:@"%d.%d.%d", major, minor, bugfix];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
NSString *versionPlistPath = @"/System/Library/CoreServices/SystemVersion.plist";
|
||||
verStr = [[[NSDictionary dictionaryWithContentsOfFile:versionPlistPath] objectForKey:@"ProductVersion"] retain];
|
||||
}
|
||||
return verStr;
|
||||
}
|
||||
@end
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// NSWorkspace_RBAdditions.h
|
||||
// PathProps
|
||||
//
|
||||
// Created by Rainer Brockerhoff on 10/04/2007.
|
||||
// Copyright 2007 Rainer Brockerhoff. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSWORKSPACE_RBADDITIONS_H
|
||||
#define NSWORKSPACE_RBADDITIONS_H
|
||||
|
||||
|
||||
extern NSString* NSWorkspace_RBfstypename;
|
||||
extern NSString* NSWorkspace_RBmntonname;
|
||||
extern NSString* NSWorkspace_RBmntfromname;
|
||||
extern NSString* NSWorkspace_RBdeviceinfo;
|
||||
extern NSString* NSWorkspace_RBimagefilepath;
|
||||
extern NSString* NSWorkspace_RBconnectiontype;
|
||||
extern NSString* NSWorkspace_RBpartitionscheme;
|
||||
extern NSString* NSWorkspace_RBserverURL;
|
||||
|
||||
@interface NSWorkspace (NSWorkspace_RBAdditions)
|
||||
|
||||
// This method will return nil if the input path is invalid. Otherwise, the returned NSDictionary may contain
|
||||
// the following keys:
|
||||
//- NSWorkspace_RBfstypename: will always be present.Shows the filesystem type (usually "hfs"), from statfs.
|
||||
//- NSWorkspace_RBmntonname: will always be present. Shows the volume mount point.
|
||||
//- NSWorkspace_RBmntfromname: will always be present. Shows the BSD device path for local volumes; info for
|
||||
// remote volumes depends on the filesystem type.
|
||||
//- NSWorkspace_RBconnectiontype: should always be present for local volumes. Shows the connection type ("SATA", "USB", etc.).
|
||||
//- NSWorkspace_RBpartitionscheme: should always be present for local volumes. Shows the partition scheme.
|
||||
//- NSWorkspace_RBdeviceinfo: should always be present for local volumes. Shows some information about the
|
||||
// physical device; varies widely.
|
||||
//- NSWorkspace_RBimagefilepath: should be present for disk images only. Shows the path of the disk image file.
|
||||
//- NSWorkspace_RBserverURL: should be present for remote volumes only. Shows the server URL.
|
||||
|
||||
- (NSDictionary*)propertiesForPath:(NSString*)path;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,177 +0,0 @@
|
||||
//
|
||||
// NSWorkspace_RBAdditions.m
|
||||
// PathProps
|
||||
//
|
||||
// Created by Rainer Brockerhoff on 10/04/2007.
|
||||
// Copyright 2007 Rainer Brockerhoff. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NSWorkspace_RBAdditions.h"
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <sys/mount.h>
|
||||
#include <mach/mach.h>
|
||||
|
||||
NSString* NSWorkspace_RBfstypename = @"NSWorkspace_RBfstypename";
|
||||
NSString* NSWorkspace_RBmntonname = @"NSWorkspace_RBmntonname";
|
||||
NSString* NSWorkspace_RBmntfromname = @"NSWorkspace_RBmntfromname";
|
||||
NSString* NSWorkspace_RBdeviceinfo = @"NSWorkspace_RBdeviceinfo";
|
||||
NSString* NSWorkspace_RBimagefilepath = @"NSWorkspace_RBimagefilepath";
|
||||
NSString* NSWorkspace_RBconnectiontype = @"NSWorkspace_RBconnectiontype";
|
||||
NSString* NSWorkspace_RBpartitionscheme = @"NSWorkspace_RBpartitionscheme";
|
||||
NSString* NSWorkspace_RBserverURL = @"NSWorkspace_RBserverURL";
|
||||
|
||||
// This static funtion concatenates two strings, but first checks several possibilities...
|
||||
// like one or the other nil, or one containing the other already.
|
||||
|
||||
static NSString* AddPart(NSString* first,NSString* second) {
|
||||
if (!second) {
|
||||
return first;
|
||||
}
|
||||
second = [second stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (first) {
|
||||
if ([first rangeOfString:second options:NSCaseInsensitiveSearch].location==NSNotFound) {
|
||||
if ([second rangeOfString:first options:NSCaseInsensitiveSearch].location==NSNotFound) {
|
||||
return [NSString stringWithFormat:@"%@; %@",first,second];
|
||||
}
|
||||
return second;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
return second;
|
||||
}
|
||||
|
||||
// This static functions recurses "upwards" over the IO registry. Returns strings that are concatenated
|
||||
// and ultimately end up under the NSWorkspace_RBdeviceinfo key.
|
||||
// This isn't too robust in that it assumes that objects returned by the objectForKey methods are
|
||||
// either strings or dictionaries. A "standard" implementations would use either only CoreFoundation and
|
||||
// IOKit calls for this, or do more robust type checking on the returned objects.
|
||||
//
|
||||
// Also notice that this works as determined experimentally in 10.4.9, there's no official docs I could find.
|
||||
// YMMV, and it may stop working in any new version of Mac OS X.
|
||||
|
||||
static NSString* CheckParents(io_object_t thing,NSString* part,NSMutableDictionary* dict) {
|
||||
NSString* result = part;
|
||||
io_iterator_t parentsIterator = 0;
|
||||
kern_return_t kernResult = IORegistryEntryGetParentIterator(thing,kIOServicePlane,&parentsIterator);
|
||||
if ((kernResult==KERN_SUCCESS)&&parentsIterator) {
|
||||
io_object_t nextParent = 0;
|
||||
while ((nextParent = IOIteratorNext(parentsIterator))) {
|
||||
NSDictionary* props = nil;
|
||||
NSString* image = nil;
|
||||
NSString* partition = nil;
|
||||
NSString* connection = nil;
|
||||
kernResult = IORegistryEntryCreateCFProperties(nextParent,(CFMutableDictionaryRef*)&props,kCFAllocatorDefault,0);
|
||||
if (IOObjectConformsTo(nextParent,"IOApplePartitionScheme")) {
|
||||
partition = [props objectForKey:@"Content Mask"];
|
||||
} else if (IOObjectConformsTo(nextParent,"IOMedia")) {
|
||||
partition = [props objectForKey:@"Content"];
|
||||
} else if (IOObjectConformsTo(nextParent,"IODiskImageBlockStorageDeviceOutKernel")) {
|
||||
NSData* data = nil;
|
||||
if ((data = [[props objectForKey:@"Protocol Characteristics"] objectForKey:@"Virtual Interface Location Path"])) {
|
||||
image = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease];
|
||||
}
|
||||
} else if (IOObjectConformsTo(nextParent,"IOHDIXHDDriveInKernel")) {
|
||||
image = [props objectForKey:@"KDIURLPath"];
|
||||
}
|
||||
NSDictionary* subdict;
|
||||
if ((subdict = [props objectForKey:@"Protocol Characteristics"])) {
|
||||
connection = [subdict objectForKey:@"Physical Interconnect"];
|
||||
} else {
|
||||
connection = [props objectForKey:@"Physical Interconnect"];
|
||||
}
|
||||
if (connection) {
|
||||
[dict setObject:AddPart([dict objectForKey:NSWorkspace_RBconnectiontype],connection) forKey:NSWorkspace_RBconnectiontype];
|
||||
}
|
||||
if (partition) {
|
||||
[dict setObject:partition forKey:NSWorkspace_RBpartitionscheme];
|
||||
}
|
||||
if (image) {
|
||||
[dict setObject:image forKey:NSWorkspace_RBimagefilepath];
|
||||
}
|
||||
NSString* value;
|
||||
if ((subdict = [props objectForKey:@"Device Characteristics"])) {
|
||||
if ((value = [subdict objectForKey:@"Product Name"])) {
|
||||
result = AddPart(result,value);
|
||||
}
|
||||
if ((value = [subdict objectForKey:@"Product Revision Level"])) {
|
||||
result = AddPart(result,value);
|
||||
}
|
||||
if ((value = [subdict objectForKey:@"Vendor Name"])) {
|
||||
result = AddPart(result,value);
|
||||
}
|
||||
}
|
||||
if ((value = [props objectForKey:@"USB Serial Number"])) {
|
||||
result = AddPart(result,value);
|
||||
}
|
||||
if ((value = [props objectForKey:@"USB Vendor Name"])) {
|
||||
result = AddPart(result,value);
|
||||
}
|
||||
io_name_t ts; // char[128]
|
||||
NSString* cls = ( IOObjectGetClass (nextParent, ts) == KERN_SUCCESS ) ? [NSString stringWithUTF8String:ts ] : nil;
|
||||
if (![cls isEqualToString:@"IOPCIDevice"]) {
|
||||
|
||||
// Uncomment the following line to have the device tree dumped to the console.
|
||||
// NSLog(@"=================================> %@:%@\n",cls,props);
|
||||
|
||||
result = CheckParents(nextParent,result,dict);
|
||||
}
|
||||
if (props) { CFRelease(props); }
|
||||
IOObjectRelease(nextParent);
|
||||
}
|
||||
}
|
||||
if (parentsIterator) {
|
||||
IOObjectRelease(parentsIterator);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@implementation NSWorkspace (NSWorkspace_RBAdditions)
|
||||
|
||||
// Returns a NSDictionary with properties for the path. See details in the .h file.
|
||||
// This assumes that the length of path is less than PATH_MAX (currently 1024 characters).
|
||||
|
||||
- (NSDictionary*)propertiesForPath:(NSString*)path {
|
||||
const char* ccpath = [path fileSystemRepresentation];
|
||||
NSMutableDictionary* result = nil;
|
||||
struct statfs fs = {};
|
||||
if (!statfs(ccpath,&fs)) {
|
||||
NSString* from = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:fs.f_mntfromname length:strlen(fs.f_mntfromname)];
|
||||
result = [NSMutableDictionary dictionaryWithObjectsAndKeys:[NSString stringWithUTF8String:fs.f_fstypename], NSWorkspace_RBfstypename, [[NSFileManager defaultManager] stringWithFileSystemRepresentation:fs.f_mntonname length:strlen(fs.f_mntonname)], NSWorkspace_RBmntonname, nil];
|
||||
const char* devstring = "/dev/";
|
||||
size_t devstringlen = 5;
|
||||
if (strncmp(fs.f_mntfromname,devstring,devstringlen)==0) {
|
||||
// For a local volume,get the IO registry tree and search it for further info.
|
||||
mach_port_t masterPort = 0;
|
||||
io_iterator_t mediaIterator = 0;
|
||||
kern_return_t kernResult = IOMasterPort(bootstrap_port,&masterPort);
|
||||
if (kernResult==KERN_SUCCESS) {
|
||||
CFMutableDictionaryRef classesToMatch = IOBSDNameMatching(masterPort,0,&fs.f_mntfromname[devstringlen]);
|
||||
if (classesToMatch) {
|
||||
kernResult = IOServiceGetMatchingServices(masterPort,classesToMatch,&mediaIterator);
|
||||
if ((kernResult==KERN_SUCCESS)&&mediaIterator) {
|
||||
io_object_t firstMedia = 0;
|
||||
while ((firstMedia = IOIteratorNext(mediaIterator))) {
|
||||
NSString* stuff = CheckParents(firstMedia,nil,result);
|
||||
if (stuff) {
|
||||
[result setObject:stuff forKey:NSWorkspace_RBdeviceinfo];
|
||||
}
|
||||
IOObjectRelease(firstMedia);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mediaIterator) {
|
||||
IOObjectRelease(mediaIterator);
|
||||
}
|
||||
if (masterPort) {
|
||||
mach_port_deallocate(mach_task_self(),masterPort);
|
||||
}
|
||||
}
|
||||
[result setObject:from forKey:NSWorkspace_RBmntfromname];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,29 +0,0 @@
|
||||
//
|
||||
// NTSynchronousTask.h
|
||||
// CocoatechCore
|
||||
//
|
||||
// Created by Steve Gehrman on 9/29/05.
|
||||
// Copyright 2005 Steve Gehrman. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NTSYNCHRONOUSTASK_H
|
||||
#define NTSYNCHRONOUSTASK_H
|
||||
|
||||
@interface NTSynchronousTask : NSObject
|
||||
{
|
||||
NSTask *mv_task;
|
||||
NSPipe *mv_outputPipe;
|
||||
NSPipe *mv_inputPipe;
|
||||
|
||||
NSData* mv_output;
|
||||
BOOL mv_done;
|
||||
int mv_result;
|
||||
}
|
||||
|
||||
// pass nil for directory if not needed
|
||||
// returns the result
|
||||
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,262 +0,0 @@
|
||||
//
|
||||
// NTSynchronousTask.m
|
||||
// CocoatechCore
|
||||
//
|
||||
// Created by Steve Gehrman on 9/29/05.
|
||||
// Copyright 2005 Steve Gehrman. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
|
||||
@interface NTSynchronousTask (Private)
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
- (NSTask *)task;
|
||||
- (void)setTask:(NSTask *)theTask;
|
||||
|
||||
- (NSPipe *)outputPipe;
|
||||
- (void)setOutputPipe:(NSPipe *)theOutputPipe;
|
||||
|
||||
- (NSPipe *)inputPipe;
|
||||
- (void)setInputPipe:(NSPipe *)theInputPipe;
|
||||
|
||||
- (NSData *)output;
|
||||
- (void)setOutput:(NSData *)theOutput;
|
||||
|
||||
- (BOOL)done;
|
||||
- (void)setDone:(BOOL)flag;
|
||||
|
||||
- (int)result;
|
||||
- (void)setResult:(int)theResult;
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask
|
||||
|
||||
- (id)init;
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[self setTask:[[[NSTask alloc] init] autorelease]];
|
||||
[self setOutputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
[self setInputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
|
||||
[[self task] setStandardInput:[self inputPipe]];
|
||||
[[self task] setStandardOutput:[self outputPipe]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// dealloc
|
||||
//----------------------------------------------------------
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[self setTask:nil];
|
||||
[self setOutputPipe:nil];
|
||||
[self setInputPipe:nil];
|
||||
[self setOutput:nil];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSData* result=nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
if ([task result] == 0)
|
||||
result = [[task output] retain];
|
||||
|
||||
[task release];
|
||||
}
|
||||
NS_HANDLER;
|
||||
NS_ENDHANDLER;
|
||||
|
||||
[pool drain];
|
||||
|
||||
// retained above
|
||||
[result autorelease];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask (Private)
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
{
|
||||
BOOL success = NO;
|
||||
|
||||
if (currentDirectory)
|
||||
[[self task] setCurrentDirectoryPath: currentDirectory];
|
||||
|
||||
[[self task] setLaunchPath:toolPath];
|
||||
[[self task] setArguments:args];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskOutputAvailable:)
|
||||
name:NSFileHandleReadToEndOfFileCompletionNotification
|
||||
object:[[self outputPipe] fileHandleForReading]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskDidTerminate:)
|
||||
name:NSTaskDidTerminateNotification
|
||||
object:[self task]];
|
||||
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
|
||||
|
||||
NS_DURING
|
||||
[[self task] launch];
|
||||
success = YES;
|
||||
NS_HANDLER
|
||||
;
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (input)
|
||||
{
|
||||
// feed the running task our input
|
||||
[[[self inputPipe] fileHandleForWriting] writeData:input];
|
||||
[[[self inputPipe] fileHandleForWriting] closeFile];
|
||||
}
|
||||
|
||||
// loop until we are done receiving the data
|
||||
if (![self done])
|
||||
{
|
||||
double resolution = 1;
|
||||
BOOL isRunning;
|
||||
NSDate* next;
|
||||
|
||||
do {
|
||||
next = [NSDate dateWithTimeIntervalSinceNow:resolution];
|
||||
|
||||
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
|
||||
beforeDate:next];
|
||||
} while (isRunning && ![self done]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// task
|
||||
//----------------------------------------------------------
|
||||
- (NSTask *)task
|
||||
{
|
||||
return mv_task;
|
||||
}
|
||||
|
||||
- (void)setTask:(NSTask *)theTask
|
||||
{
|
||||
if (mv_task != theTask) {
|
||||
[mv_task release];
|
||||
mv_task = [theTask retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// outputPipe
|
||||
//----------------------------------------------------------
|
||||
- (NSPipe *)outputPipe
|
||||
{
|
||||
return mv_outputPipe;
|
||||
}
|
||||
|
||||
- (void)setOutputPipe:(NSPipe *)theOutputPipe
|
||||
{
|
||||
if (mv_outputPipe != theOutputPipe) {
|
||||
[mv_outputPipe release];
|
||||
mv_outputPipe = [theOutputPipe retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// inputPipe
|
||||
//----------------------------------------------------------
|
||||
- (NSPipe *)inputPipe
|
||||
{
|
||||
return mv_inputPipe;
|
||||
}
|
||||
|
||||
- (void)setInputPipe:(NSPipe *)theInputPipe
|
||||
{
|
||||
if (mv_inputPipe != theInputPipe) {
|
||||
[mv_inputPipe release];
|
||||
mv_inputPipe = [theInputPipe retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// output
|
||||
//----------------------------------------------------------
|
||||
- (NSData *)output
|
||||
{
|
||||
return mv_output;
|
||||
}
|
||||
|
||||
- (void)setOutput:(NSData *)theOutput
|
||||
{
|
||||
if (mv_output != theOutput) {
|
||||
[mv_output release];
|
||||
mv_output = [theOutput retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// done
|
||||
//----------------------------------------------------------
|
||||
- (BOOL)done
|
||||
{
|
||||
return mv_done;
|
||||
}
|
||||
|
||||
- (void)setDone:(BOOL)flag
|
||||
{
|
||||
mv_done = flag;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// result
|
||||
//----------------------------------------------------------
|
||||
- (int)result
|
||||
{
|
||||
return mv_result;
|
||||
}
|
||||
|
||||
- (void)setResult:(int)theResult
|
||||
{
|
||||
mv_result = theResult;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask (Notifications)
|
||||
|
||||
- (void)taskOutputAvailable:(NSNotification*)note
|
||||
{
|
||||
[self setOutput:[[note userInfo] objectForKey:NSFileHandleNotificationDataItem]];
|
||||
|
||||
[self setDone:YES];
|
||||
}
|
||||
|
||||
- (void)taskDidTerminate:(NSNotification*)note
|
||||
{
|
||||
[self setResult:[[self task] terminationStatus]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Sparkle <img src="Resources/Sparkle.png" width=48 height=48 alt=""/>
|
||||
is an easy-to-use software update framework for Cocoa developers.
|
||||
|
||||
## Changes since 1.5
|
||||
|
||||
* Up to date with 10.9 SDK and Xcode 5/6. Supports OS X 10.7+.
|
||||
* Merged bugfixes, security fixes and some features from multiple Sparkle forks.
|
||||
* Merged official Sparkle branch with truly automatic background updates (no UI at all)
|
||||
when user agreed to "Automatically download and install updates in the future."
|
||||
* Ability to mark updates as critical.
|
||||
* Progress and status notifications for the host app.
|
||||
* Name of finish_installation.app can be configured to match your app's name.
|
||||
|
||||
## Features
|
||||
|
||||
* True self-updating—no work required from the user.
|
||||
* Displays release notes to the user via WebKit.
|
||||
* Displays a detailed progress window to the user.
|
||||
* Supports authentication for installing in secure locations.
|
||||
* Really, really easy to install.
|
||||
* Uses appcasts for release information.
|
||||
* The user can choose to automatically download and install all updates.
|
||||
* Seamless integration—there's no mention of Sparkle; your icons and app name are used.
|
||||
* Supports DSA signatures for ultra-secure updates.
|
||||
* Sparkle requires no code in your app, so it's trivial to upgrade or remove the module.
|
||||
* Optionally sends user demographic information to the server when checking for updates.
|
||||
* Sparkle doesn't bug the user until second launch for better first impressions.
|
||||
* Sparkle can install .pkg files for more complicated products.
|
||||
* Supports bundles, preference panes, plugins, and other non-.app software.
|
||||
* Supports branches due to minimum OS version requirements.
|
||||
* Deep delegate support to make Sparkle work exactly as you need.
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2002, Brent Simmons
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of ranchero.com or Brent Simmons nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef RSS_H
|
||||
#define RSS_H
|
||||
|
||||
|
||||
/*
|
||||
RSS.h
|
||||
A class for reading RSS feeds.
|
||||
|
||||
Created by Brent Simmons on Wed Apr 17 2002.
|
||||
Copyright (c) 2002 Brent Simmons. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#import "NSString+extras.h"
|
||||
|
||||
|
||||
@interface RSS : NSObject {
|
||||
NSMutableData *incrementalData;
|
||||
id delegate;
|
||||
|
||||
NSDictionary *headerItems;
|
||||
NSMutableArray *newsItems;
|
||||
NSString *version;
|
||||
|
||||
BOOL flRdf;
|
||||
BOOL normalize;
|
||||
}
|
||||
|
||||
- (RSS *)initWithURL:(NSURL *) url userAgent:(NSString*)userAgent delegate:delegate;
|
||||
- (BOOL)loadData:(NSData *)rssData normalize:(BOOL)fl;
|
||||
|
||||
- (NSMutableArray *)newsItems;
|
||||
- (NSDictionary *)newestItem;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (RSSDelegateProtocol)
|
||||
- (void)feedDidFinishLoading:(RSS *)feed;
|
||||
- (void)feed:(RSS *)feed didFailWithError:(NSError *)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,727 +0,0 @@
|
||||
/*
|
||||
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2002, Brent Simmons
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of ranchero.com or Brent Simmons nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
RSS.m
|
||||
A class for reading RSS feeds.
|
||||
|
||||
Created by Brent Simmons on Wed Apr 17 2002.
|
||||
Copyright (c) 2002 Brent Simmons. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "RSS.h"
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
|
||||
@interface NSError (TigerPlusMethods)
|
||||
- (NSString *)localizedFailureReason;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface RSS (Private)
|
||||
- (void) createheaderdictionary: (CFXMLTreeRef) tree;
|
||||
- (void) createitemsarray: (CFXMLTreeRef) tree;
|
||||
- (void) setversionstring: (CFXMLTreeRef) tree;
|
||||
- (void) flattenimagechildren: (CFXMLTreeRef) tree into: (NSMutableDictionary *) dictionary;
|
||||
- (void) flattensourceattributes: (CFXMLNodeRef) node into: (NSMutableDictionary *) dictionary;
|
||||
- (CFXMLTreeRef) getchanneltree: (CFXMLTreeRef) tree;
|
||||
- (CFXMLTreeRef) getnamedtree: (CFXMLTreeRef) currentTree name: (NSString *) name;
|
||||
- (void) normalizeRSSItem: (NSMutableDictionary *) rssItem;
|
||||
- (NSString *) getelementvalue: (CFXMLTreeRef) tree;
|
||||
@end
|
||||
|
||||
// This comparator function is used to sort the RSS items by their published date.
|
||||
NSComparisonResult compareNewsItems(id item1, id item2, void *context)
|
||||
{
|
||||
// We compare item2 with item1 instead of the other way 'round because we want descending, not ascending. Bit of a hack.
|
||||
return [(NSDate *)[NSDate dateWithNaturalLanguageString:[item2 objectForKey:@"pubDate"]] compare:(NSDate *)[NSDate dateWithNaturalLanguageString:[item1 objectForKey:@"pubDate"]]];
|
||||
}
|
||||
|
||||
@implementation RSS
|
||||
|
||||
|
||||
#define titleKey @"title"
|
||||
#define linkKey @"link"
|
||||
#define descriptionKey @"description"
|
||||
|
||||
|
||||
/*Public interface*/
|
||||
|
||||
- (NSDictionary *)newestItem
|
||||
{
|
||||
// The news items are already sorted by published date, descending.
|
||||
return [[self newsItems] objectAtIndex:0];
|
||||
}
|
||||
|
||||
- (RSS *) initWithTitle: (NSString *) title andDescription: (NSString *) description {
|
||||
|
||||
/*
|
||||
Create an empty feed. Useful for synthetic feeds.
|
||||
*/
|
||||
|
||||
NSMutableDictionary *header;
|
||||
|
||||
flRdf = NO;
|
||||
|
||||
header = [NSMutableDictionary dictionaryWithCapacity: 2];
|
||||
|
||||
[header setObject: title forKey: titleKey];
|
||||
|
||||
[header setObject: description forKey: descriptionKey];
|
||||
|
||||
headerItems = (NSDictionary *) [header copy];
|
||||
|
||||
newsItems = [[NSMutableArray alloc] initWithCapacity: 0];
|
||||
|
||||
version = [[NSString alloc] initWithString: @"synthetic"];
|
||||
|
||||
return (self);
|
||||
} /*initWithTitle*/
|
||||
|
||||
|
||||
- (BOOL)loadData:(NSData *)rssData normalize:(BOOL)fl
|
||||
{
|
||||
CFXMLTreeRef tree;
|
||||
flRdf = NO;
|
||||
normalize = fl;
|
||||
|
||||
NS_DURING
|
||||
tree = CFXMLTreeCreateFromData (kCFAllocatorDefault, (CFDataRef) rssData,
|
||||
NULL, kCFXMLParserSkipWhitespace, kCFXMLNodeCurrentVersion);
|
||||
NS_HANDLER
|
||||
tree = nil;
|
||||
NS_ENDHANDLER
|
||||
|
||||
if (tree == nil)
|
||||
return NO;
|
||||
|
||||
[self createheaderdictionary: tree];
|
||||
[self createitemsarray: tree];
|
||||
[self setversionstring: tree];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (RSS *)initWithURL:(NSURL *)url userAgent:(NSString*)userAgent delegate:del
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
delegate = del;
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: url cachePolicy: NSURLRequestReloadIgnoringCacheData
|
||||
timeoutInterval: 30.0];
|
||||
if (userAgent)
|
||||
[request setValue: userAgent forHTTPHeaderField: @"User-Agent"];
|
||||
|
||||
incrementalData = [[NSMutableData data] retain];
|
||||
NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:self];
|
||||
CFRetain(connection);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
|
||||
{
|
||||
[incrementalData appendData:data];
|
||||
}
|
||||
|
||||
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
|
||||
{
|
||||
CFRelease(connection);
|
||||
|
||||
NSError *error = nil;
|
||||
@try
|
||||
{
|
||||
if (![self loadData:incrementalData normalize:YES])
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:[NSDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while parsing the update feed.", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
}
|
||||
@catch (NSException *parseException)
|
||||
{
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"An error occurred while parsing the update feed: %@", nil), [parseException reason]] forKey:NSLocalizedFailureReasonErrorKey]];
|
||||
}
|
||||
|
||||
if (error)
|
||||
[delegate feed:self didFailWithError:error];
|
||||
else
|
||||
[delegate feedDidFinishLoading:self];
|
||||
}
|
||||
|
||||
- (void)connection:(NSURLConnection*) connection didFailWithError:(NSError *)error
|
||||
{
|
||||
CFRelease(connection);
|
||||
[delegate feed:self didFailWithError:error];
|
||||
}
|
||||
|
||||
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
- (NSDictionary *) headerItems {
|
||||
|
||||
return (headerItems);
|
||||
} /*headerItems*/
|
||||
|
||||
|
||||
- (NSMutableArray *) newsItems {
|
||||
|
||||
return (newsItems);
|
||||
} /*newsItems*/
|
||||
|
||||
|
||||
- (NSString *) version {
|
||||
|
||||
return (version);
|
||||
} /*version*/
|
||||
|
||||
|
||||
- (void) dealloc {
|
||||
[incrementalData release];
|
||||
[headerItems release];
|
||||
|
||||
[newsItems release];
|
||||
|
||||
[version release];
|
||||
[super dealloc];
|
||||
} /*dealloc*/
|
||||
|
||||
|
||||
|
||||
/*Private methods. Don't call these: they may change.*/
|
||||
|
||||
|
||||
- (void) createheaderdictionary: (CFXMLTreeRef) tree {
|
||||
|
||||
CFXMLTreeRef channelTree, childTree;
|
||||
CFXMLNodeRef childNode;
|
||||
CFIndex childCount, i;
|
||||
NSString *childName;
|
||||
NSMutableDictionary *headerItemsMutable;
|
||||
|
||||
channelTree = [self getchanneltree: tree];
|
||||
|
||||
if (channelTree == nil) {
|
||||
|
||||
NSException *exception = [NSException exceptionWithName: @"RSSCreateHeaderDictionaryFailed"
|
||||
reason: @"Couldn't find the channel tree." userInfo: nil];
|
||||
|
||||
[exception raise];
|
||||
} /*if*/
|
||||
|
||||
childCount = CFTreeGetChildCount (channelTree);
|
||||
|
||||
headerItemsMutable = [NSMutableDictionary dictionaryWithCapacity: childCount];
|
||||
|
||||
for (i = 0; i < childCount; i++) {
|
||||
|
||||
childTree = CFTreeGetChildAtIndex (channelTree, i);
|
||||
|
||||
childNode = CFXMLTreeGetNode (childTree);
|
||||
|
||||
childName = (NSString *) CFXMLNodeGetString (childNode);
|
||||
|
||||
if ([childName hasPrefix: @"rss:"])
|
||||
childName = [childName substringFromIndex: 4];
|
||||
|
||||
if ([childName isEqualToString: @"item"])
|
||||
break;
|
||||
|
||||
if ([childName isEqualTo: @"image"])
|
||||
[self flattenimagechildren: childTree into: headerItemsMutable];
|
||||
|
||||
[headerItemsMutable setObject: [self getelementvalue: childTree] forKey: childName];
|
||||
} /*for*/
|
||||
|
||||
headerItems = [headerItemsMutable copy];
|
||||
} /*initheaderdictionary*/
|
||||
|
||||
|
||||
- (void) createitemsarray: (CFXMLTreeRef) tree {
|
||||
|
||||
CFXMLTreeRef channelTree, childTree, itemTree;
|
||||
CFXMLNodeRef childNode, itemNode;
|
||||
NSString *childName;
|
||||
NSString *itemName, *itemValue;
|
||||
CFIndex childCount, itemChildCount, i, j;
|
||||
NSMutableDictionary *itemDictionaryMutable;
|
||||
NSMutableArray *itemsArrayMutable;
|
||||
|
||||
if (flRdf)
|
||||
channelTree = [self getnamedtree: tree name: @"rdf:RDF"];
|
||||
else
|
||||
channelTree = [self getchanneltree: tree];
|
||||
|
||||
if (channelTree == nil) {
|
||||
|
||||
NSException *exception = [NSException exceptionWithName: @"RSSCreateItemsArrayFailed"
|
||||
reason: @"Couldn't find the news items." userInfo: nil];
|
||||
|
||||
[exception raise];
|
||||
} /*if*/
|
||||
|
||||
childCount = CFTreeGetChildCount (channelTree);
|
||||
|
||||
itemsArrayMutable = [NSMutableArray arrayWithCapacity: childCount];
|
||||
|
||||
for (i = 0; i < childCount; i++) {
|
||||
|
||||
childTree = CFTreeGetChildAtIndex (channelTree, i);
|
||||
|
||||
childNode = CFXMLTreeGetNode (childTree);
|
||||
|
||||
childName = (NSString *) CFXMLNodeGetString (childNode);
|
||||
|
||||
if ([childName hasPrefix: @"rss:"])
|
||||
childName = [childName substringFromIndex: 4];
|
||||
|
||||
if (![childName isEqualToString: @"item"])
|
||||
continue;
|
||||
|
||||
itemChildCount = CFTreeGetChildCount (childTree);
|
||||
|
||||
itemDictionaryMutable = [NSMutableDictionary dictionaryWithCapacity: itemChildCount];
|
||||
|
||||
for (j = 0; j < itemChildCount; j++) {
|
||||
|
||||
itemTree = CFTreeGetChildAtIndex (childTree, j);
|
||||
|
||||
itemNode = CFXMLTreeGetNode (itemTree);
|
||||
|
||||
itemName = (NSString *) CFXMLNodeGetString (itemNode);
|
||||
|
||||
if ([itemName hasPrefix: @"rss:"])
|
||||
itemName = [itemName substringFromIndex: 4];
|
||||
|
||||
if ([itemName isEqualTo:@"enclosure"])
|
||||
{
|
||||
// Hack to add attributes to the dictionary in addition to children. (AMM)
|
||||
const CFXMLElementInfo *websiteInfo = CFXMLNodeGetInfoPtr(itemNode);
|
||||
NSMutableDictionary *enclosureDictionary = [NSMutableDictionary dictionary];
|
||||
id keyEnumerator = [(NSDictionary *)websiteInfo->attributes keyEnumerator], current;
|
||||
while ((current = [keyEnumerator nextObject]))
|
||||
{
|
||||
NSString *escapedAttributeValue = [(NSDictionary *)websiteInfo->attributes objectForKey:current];
|
||||
CFStringRef attributeValue = CFXMLCreateStringByUnescapingEntities(kCFAllocatorDefault, (CFStringRef)escapedAttributeValue, NULL);
|
||||
if (attributeValue)
|
||||
{
|
||||
// Do a stringWithString dance rather than just casting so that it's GC safe without using the 10.4+ CFMakeCollectable.
|
||||
[enclosureDictionary setObject:[NSString stringWithString:(NSString *)attributeValue] forKey:current];
|
||||
CFRelease(attributeValue);
|
||||
}
|
||||
}
|
||||
[itemDictionaryMutable setObject: enclosureDictionary forKey: itemName];
|
||||
continue;
|
||||
}
|
||||
|
||||
itemValue = [self getelementvalue: itemTree];
|
||||
|
||||
if ([itemName isEqualTo: @"source"])
|
||||
[self flattensourceattributes: itemNode into: itemDictionaryMutable];
|
||||
|
||||
[itemDictionaryMutable setObject: itemValue forKey: itemName];
|
||||
} /*for*/
|
||||
|
||||
if (normalize)
|
||||
[self normalizeRSSItem: itemDictionaryMutable];
|
||||
|
||||
[itemsArrayMutable addObject: itemDictionaryMutable];
|
||||
} /*for*/
|
||||
|
||||
// Sort the news items by published date, descending.
|
||||
newsItems = [[itemsArrayMutable sortedArrayUsingFunction:compareNewsItems context:NULL] retain];
|
||||
} /*createitemsarray*/
|
||||
|
||||
|
||||
- (void) setversionstring: (CFXMLTreeRef) tree {
|
||||
|
||||
CFXMLTreeRef rssTree;
|
||||
const CFXMLElementInfo *elementInfo;
|
||||
CFXMLNodeRef node;
|
||||
|
||||
if (flRdf) {
|
||||
|
||||
version = [[NSString alloc] initWithString: @"rdf"];
|
||||
|
||||
return;
|
||||
} /*if*/
|
||||
|
||||
rssTree = [self getnamedtree: tree name: @"rss"];
|
||||
|
||||
node = CFXMLTreeGetNode (rssTree);
|
||||
|
||||
elementInfo = CFXMLNodeGetInfoPtr (node);
|
||||
|
||||
version = [[NSString alloc] initWithString: [(NSDictionary *) (*elementInfo).attributes objectForKey: @"version"]];
|
||||
} /*setversionstring*/
|
||||
|
||||
|
||||
- (void) flattenimagechildren: (CFXMLTreeRef) tree into: (NSMutableDictionary *) dictionary {
|
||||
|
||||
CFIndex childCount = CFTreeGetChildCount (tree);
|
||||
CFIndex i = 0;
|
||||
CFXMLTreeRef childTree;
|
||||
CFXMLNodeRef childNode;
|
||||
NSString *childName, *childValue, *keyName;
|
||||
|
||||
if (childCount < 1)
|
||||
return;
|
||||
|
||||
for (i = 0; i < childCount; i++) {
|
||||
|
||||
childTree = CFTreeGetChildAtIndex (tree, i);
|
||||
|
||||
childNode = CFXMLTreeGetNode (childTree);
|
||||
|
||||
childName = (NSString *) CFXMLNodeGetString (childNode);
|
||||
|
||||
if ([childName hasPrefix: @"rss:"])
|
||||
childName = [childName substringFromIndex: 4];
|
||||
|
||||
childValue = [self getelementvalue: childTree];
|
||||
|
||||
keyName = [NSString stringWithFormat: @"image%@", childName];
|
||||
|
||||
[dictionary setObject: childValue forKey: keyName];
|
||||
} /*for*/
|
||||
} /*flattenimagechildren*/
|
||||
|
||||
|
||||
- (void) flattensourceattributes: (CFXMLNodeRef) node into: (NSMutableDictionary *) dictionary {
|
||||
|
||||
const CFXMLElementInfo *elementInfo;
|
||||
NSString *sourceHomeUrl, *sourceRssUrl;
|
||||
|
||||
elementInfo = CFXMLNodeGetInfoPtr (node);
|
||||
|
||||
sourceHomeUrl = [(NSDictionary *) (*elementInfo).attributes objectForKey: @"homeUrl"];
|
||||
|
||||
sourceRssUrl = [(NSDictionary *) (*elementInfo).attributes objectForKey: @"url"];
|
||||
|
||||
if (sourceHomeUrl != nil)
|
||||
[dictionary setObject: sourceHomeUrl forKey: @"sourceHomeUrl"];
|
||||
|
||||
if (sourceRssUrl != nil)
|
||||
[dictionary setObject: sourceRssUrl forKey: @"sourceRssUrl"];
|
||||
} /*flattensourceattributes*/
|
||||
|
||||
|
||||
- (CFXMLTreeRef) getchanneltree: (CFXMLTreeRef) tree {
|
||||
|
||||
CFXMLTreeRef rssTree, channelTree;
|
||||
|
||||
rssTree = [self getnamedtree: tree name: @"rss"];
|
||||
|
||||
if (rssTree == nil) { /*It might be "rdf:RDF" instead, a 1.0 or greater feed.*/
|
||||
|
||||
rssTree = [self getnamedtree: tree name: @"rdf:RDF"];
|
||||
|
||||
if (rssTree != nil)
|
||||
flRdf = YES; /*This info will be needed later when creating the items array.*/
|
||||
} /*if*/
|
||||
|
||||
if (rssTree == nil)
|
||||
return (nil);
|
||||
|
||||
channelTree = [self getnamedtree: rssTree name: @"channel"];
|
||||
|
||||
if (channelTree == nil)
|
||||
channelTree = [self getnamedtree: rssTree name: @"rss:channel"];
|
||||
|
||||
return (channelTree);
|
||||
} /*getchanneltree*/
|
||||
|
||||
|
||||
- (CFXMLTreeRef) getnamedtree: (CFXMLTreeRef) currentTree name: (NSString *) name {
|
||||
|
||||
CFIndex childCount, i;
|
||||
CFXMLNodeRef xmlNode;
|
||||
CFXMLTreeRef xmlTreeNode;
|
||||
NSString *itemName;
|
||||
|
||||
childCount = CFTreeGetChildCount (currentTree);
|
||||
|
||||
for (i = childCount - 1; i >= 0; i--) {
|
||||
|
||||
xmlTreeNode = CFTreeGetChildAtIndex (currentTree, i);
|
||||
|
||||
xmlNode = CFXMLTreeGetNode (xmlTreeNode);
|
||||
|
||||
itemName = (NSString *) CFXMLNodeGetString (xmlNode);
|
||||
|
||||
if ([itemName isEqualToString: name])
|
||||
return (xmlTreeNode);
|
||||
} /*for*/
|
||||
|
||||
return (nil);
|
||||
} /*getnamedtree*/
|
||||
|
||||
|
||||
- (void) normalizeRSSItem: (NSMutableDictionary *) rssItem {
|
||||
|
||||
/*
|
||||
Make sure item, link, and description are present and have
|
||||
reasonable values. Description and link may be "".
|
||||
Also trim white space, remove HTML when appropriate.
|
||||
*/
|
||||
|
||||
NSString *description, *normalizedLink, *title;
|
||||
BOOL nilDescription = NO;
|
||||
|
||||
/*Description*/
|
||||
|
||||
description = [rssItem objectForKey: descriptionKey];
|
||||
|
||||
if (description == nil) {
|
||||
|
||||
description = @"";
|
||||
|
||||
nilDescription = YES;
|
||||
} /*if*/
|
||||
|
||||
description = [description trimWhiteSpace];
|
||||
|
||||
if ([description isEqualTo: @""])
|
||||
nilDescription = YES;
|
||||
|
||||
[rssItem setObject: description forKey: descriptionKey];
|
||||
|
||||
/*Link*/
|
||||
|
||||
normalizedLink = [rssItem objectForKey: linkKey];
|
||||
|
||||
if ([NSString stringIsEmpty: normalizedLink]) {
|
||||
|
||||
/*Try to get a URL from the description.*/
|
||||
|
||||
if (!nilDescription) {
|
||||
|
||||
NSArray *stringComponents = [description componentsSeparatedByString: @"href=\""];
|
||||
|
||||
if ([stringComponents count] > 1) {
|
||||
|
||||
normalizedLink = [stringComponents objectAtIndex: 1];
|
||||
|
||||
stringComponents = [normalizedLink componentsSeparatedByString: @"\""];
|
||||
|
||||
normalizedLink = [stringComponents objectAtIndex: 0];
|
||||
} /*if*/
|
||||
} /*if*/
|
||||
} /*if*/
|
||||
|
||||
if (normalizedLink == nil)
|
||||
normalizedLink = @"";
|
||||
|
||||
normalizedLink = [normalizedLink trimWhiteSpace];
|
||||
|
||||
[rssItem setObject: normalizedLink forKey: linkKey];
|
||||
|
||||
/*Title*/
|
||||
|
||||
title = [rssItem objectForKey: titleKey];
|
||||
|
||||
if (title != nil) {
|
||||
|
||||
title = [title stripHTML];
|
||||
|
||||
title = [title trimWhiteSpace];
|
||||
} /*if*/
|
||||
|
||||
if ([NSString stringIsEmpty: title]) {
|
||||
|
||||
/*Grab a title from the description.*/
|
||||
|
||||
if (!nilDescription) {
|
||||
|
||||
NSArray *stringComponents = [description componentsSeparatedByString: @">"];
|
||||
|
||||
if ([stringComponents count] > 1) {
|
||||
|
||||
title = [stringComponents objectAtIndex: 1];
|
||||
|
||||
stringComponents = [title componentsSeparatedByString: @"<"];
|
||||
|
||||
title = [stringComponents objectAtIndex: 0];
|
||||
|
||||
title = [title stripHTML];
|
||||
|
||||
title = [title trimWhiteSpace];
|
||||
} /*if*/
|
||||
|
||||
if ([NSString stringIsEmpty: title]) { /*use first part of description*/
|
||||
|
||||
NSString *shortTitle = [[[description stripHTML] trimWhiteSpace] ellipsizeAfterNWords: 5];
|
||||
|
||||
shortTitle = [shortTitle trimWhiteSpace];
|
||||
|
||||
title = [NSString stringWithFormat: @"%@\u2026", shortTitle];
|
||||
} /*else*/
|
||||
} /*if*/
|
||||
|
||||
title = [title stripHTML];
|
||||
|
||||
title = [title trimWhiteSpace];
|
||||
|
||||
if ([NSString stringIsEmpty: title])
|
||||
title = @"Untitled";
|
||||
} /*if*/
|
||||
|
||||
[rssItem setObject: title forKey: titleKey];
|
||||
|
||||
/*dangerousmeta case: super-long title with no description*/
|
||||
|
||||
if ((nilDescription) && ([title length] > 50)) {
|
||||
|
||||
NSString *shortTitle = [[[title stripHTML] trimWhiteSpace] ellipsizeAfterNWords: 7];
|
||||
|
||||
description = [[title copy] autorelease];
|
||||
|
||||
[rssItem setObject: description forKey: descriptionKey];
|
||||
|
||||
title = [NSString stringWithFormat: @"%@\u2026", shortTitle];
|
||||
|
||||
[rssItem setObject: title forKey: titleKey];
|
||||
} /*if*/
|
||||
|
||||
{ /*deal with entities*/
|
||||
|
||||
const char *tempcstring;
|
||||
NSAttributedString *s = nil;
|
||||
NSString *convertedTitle = nil;
|
||||
NSArray *stringComponents;
|
||||
|
||||
stringComponents = [title componentsSeparatedByString: @"&"];
|
||||
|
||||
if ([stringComponents count] > 1) {
|
||||
|
||||
stringComponents = [title componentsSeparatedByString: @";"];
|
||||
|
||||
if ([stringComponents count] > 1) {
|
||||
|
||||
size_t len;
|
||||
|
||||
tempcstring = [title UTF8String];
|
||||
|
||||
len = strlen (tempcstring);
|
||||
|
||||
if (len > 0) {
|
||||
|
||||
s = [[NSAttributedString alloc]
|
||||
initWithHTML: [NSData dataWithBytes: tempcstring length: strlen (tempcstring)]
|
||||
documentAttributes: (NSDictionary **) NULL];
|
||||
|
||||
convertedTitle = [s string];
|
||||
|
||||
[s autorelease];
|
||||
|
||||
convertedTitle = [convertedTitle stripHTML];
|
||||
|
||||
convertedTitle = [convertedTitle trimWhiteSpace];
|
||||
} /*if*/
|
||||
|
||||
if ([NSString stringIsEmpty: convertedTitle])
|
||||
convertedTitle = @"Untitled";
|
||||
|
||||
[rssItem setObject: convertedTitle forKey: @"convertedTitle"];
|
||||
} /*if*/
|
||||
} /*if*/
|
||||
} /*deal with entities*/
|
||||
} /*normalizeRSSItem*/
|
||||
|
||||
|
||||
- (NSString *) getelementvalue: (CFXMLTreeRef) tree {
|
||||
|
||||
CFXMLNodeRef node;
|
||||
CFXMLTreeRef itemTree;
|
||||
CFIndex childCount, ix;
|
||||
NSMutableString *valueMutable;
|
||||
NSString *value;
|
||||
NSString *name;
|
||||
|
||||
childCount = CFTreeGetChildCount (tree);
|
||||
|
||||
valueMutable = [[NSMutableString alloc] init];
|
||||
|
||||
for (ix = 0; ix < childCount; ix++) {
|
||||
|
||||
itemTree = CFTreeGetChildAtIndex (tree, ix);
|
||||
|
||||
node = CFXMLTreeGetNode (itemTree);
|
||||
|
||||
name = (NSString *) CFXMLNodeGetString (node);
|
||||
|
||||
if (name != nil) {
|
||||
|
||||
if (CFXMLNodeGetTypeCode (node) == kCFXMLNodeTypeEntityReference) {
|
||||
|
||||
if ([name isEqualTo: @"lt"])
|
||||
name = @"<";
|
||||
|
||||
else if ([name isEqualTo: @"gt"])
|
||||
name = @">";
|
||||
|
||||
else if ([name isEqualTo: @"quot"])
|
||||
name = @"\"";
|
||||
|
||||
else if ([name isEqualTo: @"amp"])
|
||||
name = @"&";
|
||||
|
||||
else if ([name isEqualTo: @"rsquo"]) {
|
||||
char rsquo[4] = { 0xe2, 0x80, 0x99, 0x0 };
|
||||
name = [NSString stringWithUTF8String: rsquo];
|
||||
}
|
||||
|
||||
else if ([name isEqualTo: @"lsquo"]) {
|
||||
char lsquo[4] = { 0xe2, 0x80, 0x98, 0x0 };
|
||||
name = [NSString stringWithUTF8String: lsquo];
|
||||
}
|
||||
|
||||
else if ([name isEqualTo: @"apos"])
|
||||
name = @"'";
|
||||
else
|
||||
name = [NSString stringWithFormat: @"&%@;", name];
|
||||
} /*if*/
|
||||
|
||||
[valueMutable appendString: name];
|
||||
} /*if*/
|
||||
} /*for*/
|
||||
|
||||
value = [[valueMutable trimWhiteSpace] retain];
|
||||
|
||||
[valueMutable autorelease];
|
||||
|
||||
return ([value autorelease]);
|
||||
} /*getelementvalue*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_16x16.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_16x16@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_32x32.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_32x32@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_128x128.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_128x128@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_256x256.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -4,14 +4,78 @@
|
||||
<dict>
|
||||
<key>ADP2,1</key>
|
||||
<string>Developer Transition Kit</string>
|
||||
<key>iMac1,1</key>
|
||||
<string>iMac G3 (Rev A-D)</string>
|
||||
<key>iMac4,1</key>
|
||||
<string>iMac (Core Duo)</string>
|
||||
<key>iMac4,2</key>
|
||||
<string>iMac for Education (17 inch, Core Duo)</string>
|
||||
<key>iMac5,1</key>
|
||||
<string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string>
|
||||
<key>iMac5,2</key>
|
||||
<string>iMac (Core 2 Duo, 17 inch, Combo Drive)</string>
|
||||
<key>iMac6,1</key>
|
||||
<string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string>
|
||||
<key>iMac8,1</key>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early 2008 )</string>
|
||||
<key>iMac9,1</key>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early or Mid 2009 )</string>
|
||||
<key>iMac10,1</key>
|
||||
<string>iMac (Core 2 Duo, 21.5 or 27 inch, Late 2009 )</string>
|
||||
<key>iMac11,1</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2009)</string>
|
||||
<key>iMac11,2</key>
|
||||
<string>iMac (Core i3 or i5, 27 inch Mid 2010)</string>
|
||||
<key>iMac11,3</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2010)</string>
|
||||
<key>iMac12,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Mid 2010 or Late 2011)</string>
|
||||
<key>iMac12,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2011)</string>
|
||||
<key>iMac13,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Late 2012 or Early 2013)</string>
|
||||
<key>iMac13,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2012)</string>
|
||||
<key>iMac14,1</key>
|
||||
<string>iMac (Core i5, 21.5 inch Late 2013)</string>
|
||||
<key>iMac14,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2013)</string>
|
||||
<key>iMac14,3</key>
|
||||
<string>iMac (Core i5 or i7, 21.5 inch Late 2013)</string>
|
||||
<key>MacBook1,1</key>
|
||||
<string>MacBook (Core Duo)</string>
|
||||
<key>MacBook2,1</key>
|
||||
<string>MacBook (Core 2 Duo)</string>
|
||||
<key>MacBook4,1</key>
|
||||
<string>MacBook (Core 2 Duo Feb 2008)</string>
|
||||
<key>MacBook5,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2008, Unibody)</string>
|
||||
<key>MacBook5,2</key>
|
||||
<string>MacBook (Core 2 Duo, Early 2009, White)</string>
|
||||
<key>MacBook6,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2009, Unibody)</string>
|
||||
<key>MacBook7,1</key>
|
||||
<string>MacBook (Core 2 Duo, Mid 2010, White)</string>
|
||||
<key>MacBookAir1,1</key>
|
||||
<string>MacBook Air (January 2008)</string>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Early 2008)</string>
|
||||
<key>MacBookAir2,1</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Mid 2009)</string>
|
||||
<key>MacBookAir3,1</key>
|
||||
<string>MacBook Air (Core 2 Duo, 11 inch, Late 2010)</string>
|
||||
<key>MacBookAir3,2</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Late 2010)</string>
|
||||
<key>MacBookAir4,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2011)</string>
|
||||
<key>MacBookAir4,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2011)</string>
|
||||
<key>MacBookAir5,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2012)</string>
|
||||
<key>MacBookAir5,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2012)</string>
|
||||
<key>MacBookAir6,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookAir6,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookPro1,1</key>
|
||||
<string>MacBook Pro Core Duo (15-inch)</string>
|
||||
<key>MacBookPro1,2</key>
|
||||
@@ -26,14 +90,18 @@
|
||||
<string>MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo)</string>
|
||||
<key>MacBookPro4,1</key>
|
||||
<string>MacBook Pro (Core 2 Duo Feb 2008)</string>
|
||||
<key>Macmini1,1</key>
|
||||
<string>Mac Mini (Core Solo/Duo)</string>
|
||||
<key>MacPro1,1</key>
|
||||
<string>Mac Pro (four-core)</string>
|
||||
<key>MacPro2,1</key>
|
||||
<string>Mac Pro (eight-core)</string>
|
||||
<key>MacPro3,1</key>
|
||||
<string>Mac Pro (January 2008 4- or 8- core "Harpertown")</string>
|
||||
<key>Macmini1,1</key>
|
||||
<string>Mac Mini (Core Solo/Duo)</string>
|
||||
<string>Mac Pro (January 2008 4- or 8- core "Harpertown")</string>
|
||||
<key>MacPro4,1</key>
|
||||
<string>Mac Pro (March 2009)</string>
|
||||
<key>MacPro5,1</key>
|
||||
<string>Mac Pro (August 2010)</string>
|
||||
<key>PowerBook1,1</key>
|
||||
<string>PowerBook G3</string>
|
||||
<key>PowerBook2,1</key>
|
||||
@@ -156,19 +224,5 @@
|
||||
<string>Xserve (Intel Xeon)</string>
|
||||
<key>Xserve2,1</key>
|
||||
<string>Xserve (January 2008 quad-core)</string>
|
||||
<key>iMac1,1</key>
|
||||
<string>iMac G3 (Rev A-D)</string>
|
||||
<key>iMac4,1</key>
|
||||
<string>iMac (Core Duo)</string>
|
||||
<key>iMac4,2</key>
|
||||
<string>iMac for Education (17-inch, Core Duo)</string>
|
||||
<key>iMac5,1</key>
|
||||
<string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string>
|
||||
<key>iMac5,2</key>
|
||||
<string>iMac (Core 2 Duo, 17 inch, Combo Drive)</string>
|
||||
<key>iMac6,1</key>
|
||||
<string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string>
|
||||
<key>iMac8,1</key>
|
||||
<string>iMac (April 2008)</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title>Your Great App's Changelog</title>
|
||||
<link>http://you.com/app/appcast.xml</link>
|
||||
<description>Most recent changes with links to updates.</description>
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>Version 2.0 (2 bugs fixed; 3 new features)</title>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/2.0.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:dsaSignature="BAFJW4B6B1K1JyW30nbkBwainOzrN6EQuAh" />
|
||||
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Version 1.5 (8 bugs fixed; 2 new features)</title>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/1.5.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
|
||||
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
|
||||
<item>
|
||||
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/1.4.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream" />
|
||||
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// SUAppcast.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/12/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUAppcast.h"
|
||||
|
||||
@interface SUAppcast (Private)
|
||||
- (void)reportError:(NSError *)error;
|
||||
@end
|
||||
|
||||
@implementation SUAppcast
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[items release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSArray *)items
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
- (void)fetchAppcastFromURL:(NSURL *)url
|
||||
{
|
||||
RSS *feed = [[RSS alloc] initWithURL:url userAgent:userAgentString delegate:self];
|
||||
CFRetain(feed); // Manage the RSS feed's memory manually.
|
||||
}
|
||||
|
||||
- (void)feedDidFinishLoading:(RSS *)feed
|
||||
{
|
||||
// Set up all the appcast items:
|
||||
NSArray *tempItems = [NSMutableArray array];
|
||||
id enumerator = [[feed newsItems] objectEnumerator], current;
|
||||
@try
|
||||
{
|
||||
while ((current = [enumerator nextObject]))
|
||||
{
|
||||
[(NSMutableArray *)tempItems addObject:[[[SUAppcastItem alloc] initWithDictionary:current] autorelease]];
|
||||
}
|
||||
items = [[NSArray arrayWithArray:tempItems] retain]; // Make the items list immutable.
|
||||
|
||||
if ([delegate respondsToSelector:@selector(appcastDidFinishLoading:)])
|
||||
[delegate performSelectorOnMainThread:@selector(appcastDidFinishLoading:) withObject:self waitUntilDone:NO];
|
||||
}
|
||||
@catch (NSException *parseException)
|
||||
{
|
||||
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while parsing the update feed.", nil), NSLocalizedDescriptionKey, [parseException reason], SUTechnicalErrorInformationKey, nil]]];
|
||||
}
|
||||
CFRelease(feed);
|
||||
}
|
||||
|
||||
- (void)feed:(RSS *)feed didFailWithError:(NSError *)error
|
||||
{
|
||||
[self reportError:error];
|
||||
}
|
||||
|
||||
- (void)reportError:(NSError *)error
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(appcast:failedToLoadWithError:)])
|
||||
{
|
||||
[delegate appcast:self failedToLoadWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setUserAgentString:(NSString *)uas
|
||||
{
|
||||
if (uas != userAgentString)
|
||||
{
|
||||
[userAgentString release];
|
||||
userAgentString = [uas copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// SUAppcastItem.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/12/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUAPPCASTITEM_H
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
|
||||
@interface SUAppcastItem : NSObject {
|
||||
NSString *title;
|
||||
NSDate *date;
|
||||
NSString *description;
|
||||
|
||||
NSURL *releaseNotesURL;
|
||||
|
||||
NSString *DSASignature;
|
||||
NSString *minimumSystemVersion;
|
||||
|
||||
NSURL *fileURL;
|
||||
NSString *versionString;
|
||||
NSString *displayVersionString;
|
||||
|
||||
NSDictionary *propertiesDictionary;
|
||||
}
|
||||
|
||||
// Initializes with data from a dictionary provided by the RSS class.
|
||||
- initWithDictionary:(NSDictionary *)dict;
|
||||
|
||||
- (NSString *)title;
|
||||
- (NSString *)versionString;
|
||||
- (NSString *)displayVersionString;
|
||||
- (NSDate *)date;
|
||||
- (NSString *)description;
|
||||
- (NSURL *)releaseNotesURL;
|
||||
- (NSURL *)fileURL;
|
||||
- (NSString *)DSASignature;
|
||||
- (NSString *)minimumSystemVersion;
|
||||
|
||||
// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
|
||||
- (NSDictionary *)propertiesDictionary;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,178 +0,0 @@
|
||||
//
|
||||
// SUAppcastItem.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/12/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUAppcastItem.h"
|
||||
|
||||
@implementation SUAppcastItem
|
||||
|
||||
// Attack of accessors!
|
||||
|
||||
- (NSString *)title { return [[title retain] autorelease]; }
|
||||
|
||||
- (void)setTitle:(NSString *)aTitle
|
||||
{
|
||||
if (title == aTitle) return;
|
||||
[title release];
|
||||
title = [aTitle copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSDate *)date { return [[date retain] autorelease]; }
|
||||
|
||||
- (void)setDate:(NSDate *)aDate
|
||||
{
|
||||
if (date == aDate) return;
|
||||
[date release];
|
||||
date = [aDate copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)description { return [[description retain] autorelease]; }
|
||||
|
||||
- (void)setDescription:(NSString *)aDescription
|
||||
{
|
||||
if (description == aDescription) return;
|
||||
[description release];
|
||||
description = [aDescription copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL *)releaseNotesURL { return [[releaseNotesURL retain] autorelease]; }
|
||||
|
||||
- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL
|
||||
{
|
||||
if (releaseNotesURL == aReleaseNotesURL) return;
|
||||
[releaseNotesURL release];
|
||||
releaseNotesURL = [aReleaseNotesURL copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)DSASignature { return [[DSASignature retain] autorelease]; }
|
||||
|
||||
- (void)setDSASignature:(NSString *)aDSASignature
|
||||
{
|
||||
if (DSASignature == aDSASignature) return;
|
||||
[DSASignature release];
|
||||
DSASignature = [aDSASignature copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL *)fileURL { return [[fileURL retain] autorelease]; }
|
||||
|
||||
- (void)setFileURL:(NSURL *)aFileURL
|
||||
{
|
||||
if (fileURL == aFileURL) return;
|
||||
[fileURL release];
|
||||
fileURL = [aFileURL copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)versionString { return [[versionString retain] autorelease]; }
|
||||
|
||||
- (void)setVersionString:(NSString *)s
|
||||
{
|
||||
if (versionString == s) return;
|
||||
[versionString release];
|
||||
versionString = [s copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)displayVersionString { return [[displayVersionString retain] autorelease]; }
|
||||
|
||||
- (void)setDisplayVersionString:(NSString *)s
|
||||
{
|
||||
if (displayVersionString == s) return;
|
||||
[displayVersionString release];
|
||||
displayVersionString = [s copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)minimumSystemVersion { return [[minimumSystemVersion retain] autorelease]; }
|
||||
- (void)setMinimumSystemVersion:(NSString *)systemVersionString
|
||||
{
|
||||
if (minimumSystemVersion == systemVersionString) return;
|
||||
[minimumSystemVersion release];
|
||||
minimumSystemVersion = [systemVersionString copy];
|
||||
}
|
||||
|
||||
- initWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
propertiesDictionary = [dict retain];
|
||||
[self setTitle:[dict objectForKey:@"title"]];
|
||||
[self setDate:[dict objectForKey:@"pubDate"]];
|
||||
[self setDescription:[dict objectForKey:@"description"]];
|
||||
|
||||
id enclosure = [dict objectForKey:@"enclosure"];
|
||||
if (enclosure == nil || [enclosure objectForKey:@"url"] == nil)
|
||||
[NSException raise:@"SUAppcastException" format:@"Couldn't find an download URL for feed entry %@!", [self title]];
|
||||
[self setFileURL:[NSURL URLWithString:[[enclosure objectForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
[self setDSASignature:[enclosure objectForKey:@"sparkle:dsaSignature"]];
|
||||
|
||||
// Try to find a version string.
|
||||
// Finding the new version number from the RSS feed is a little bit hacky. There are two ways:
|
||||
// 1. A "sparkle:version" attribute on the enclosure tag, an extension from the RSS spec.
|
||||
// 2. If there isn't a version attribute, Sparkle will parse the path in the enclosure, expecting
|
||||
// that it will look like this: http://something.com/YourApp_0.5.zip. It'll read whatever's between the last
|
||||
// underscore and the last period as the version number. So name your packages like this: APPNAME_VERSION.extension.
|
||||
// The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle.
|
||||
// Feel free to change the separator string to a hyphen or something more suited to your needs if you like.
|
||||
NSString *newVersion = [enclosure objectForKey:@"sparkle:version"];
|
||||
if (!newVersion) // no sparkle:version attribute
|
||||
{
|
||||
// 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:@"url"] componentsSeparatedByString:@"_"];
|
||||
if ([fileComponents count] > 1)
|
||||
newVersion = [[fileComponents lastObject] stringByDeletingPathExtension];
|
||||
else
|
||||
[NSException raise:@"SUAppcastException" format:@"Couldn't find a version string for %@! You need a sparkle:version attribute.", [enclosure objectForKey:@"url"]];
|
||||
}
|
||||
[self setVersionString:newVersion];
|
||||
[self setMinimumSystemVersion:[dict objectForKey:@"sparkle:minimumSystemVersion"]];
|
||||
|
||||
NSString *shortVersionString = [enclosure objectForKey:@"sparkle:shortVersionString"];
|
||||
if (shortVersionString)
|
||||
[self setDisplayVersionString:shortVersionString];
|
||||
else
|
||||
[self setDisplayVersionString:[self versionString]];
|
||||
|
||||
// Find the appropriate release notes URL.
|
||||
if ([dict objectForKey:@"sparkle:releaseNotesLink"])
|
||||
[self setReleaseNotesURL:[NSURL URLWithString:[dict objectForKey:@"sparkle:releaseNotesLink"]]];
|
||||
else if ([[self description] hasPrefix:@"http://"]) // if the description starts with http://, use that.
|
||||
[self setReleaseNotesURL:[NSURL URLWithString:[self description]]];
|
||||
else
|
||||
[self setReleaseNotesURL:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self setTitle:nil];
|
||||
[self setDate:nil];
|
||||
[self setDescription:nil];
|
||||
[self setReleaseNotesURL:nil];
|
||||
[self setDSASignature:nil];
|
||||
[self setFileURL:nil];
|
||||
[self setVersionString:nil];
|
||||
[self setDisplayVersionString:nil];
|
||||
[propertiesDictionary release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSDictionary *)propertiesDictionary
|
||||
{
|
||||
return propertiesDictionary;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// SUAutomaticUpdateAlert.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/18/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUAutomaticUpdateAlert.h"
|
||||
|
||||
@implementation SUAutomaticUpdateAlert
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item hostBundle:(NSBundle *)hb delegate:del;
|
||||
{
|
||||
self = [super initWithHostBundle:hb windowNibName:@"SUAutomaticUpdateAlert"];
|
||||
if (self)
|
||||
{
|
||||
updateItem = [item retain];
|
||||
delegate = del;
|
||||
hostBundle = [hb retain];
|
||||
[self setShouldCascadeWindows:NO];
|
||||
[[self window] center];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[hostBundle release];
|
||||
[updateItem release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)installNow:sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUInstallNowChoice];
|
||||
}
|
||||
|
||||
- (IBAction)installLater:sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUInstallLaterChoice];
|
||||
}
|
||||
|
||||
- (IBAction)doNotInstall:sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUDoNotInstallChoice];
|
||||
}
|
||||
|
||||
- (NSImage *)applicationIcon
|
||||
{
|
||||
return [hostBundle icon];
|
||||
}
|
||||
|
||||
- (NSString *)titleText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is ready to install!", nil), [hostBundle name]];
|
||||
}
|
||||
|
||||
- (NSString *)descriptionText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", nil), [hostBundle name], [hostBundle displayVersion]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,77 +0,0 @@
|
||||
//
|
||||
// SUAutomaticUpdateDriver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/6/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUAutomaticUpdateDriver.h"
|
||||
#import "Sparkle.h"
|
||||
|
||||
@implementation SUAutomaticUpdateDriver
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
alert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:updateItem hostBundle:hostBundle delegate:self];
|
||||
if ([NSApp isActive])
|
||||
[[alert window] makeKeyAndOrderFront:self];
|
||||
else
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||
{
|
||||
[[alert window] makeKeyAndOrderFront:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSApplicationDidBecomeActiveNotification" object:NSApp];
|
||||
}
|
||||
|
||||
- (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice;
|
||||
{
|
||||
switch (choice)
|
||||
{
|
||||
case SUInstallNowChoice:
|
||||
[self installUpdate];
|
||||
break;
|
||||
|
||||
case SUInstallLaterChoice:
|
||||
postponingInstallation = YES;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
break;
|
||||
|
||||
case SUDoNotInstallChoice:
|
||||
[[SUUserDefaults standardUserDefaults] setObject:[updateItem versionString] forKey:SUSkippedVersionKey];
|
||||
[self abortUpdate];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldInstallSynchronously { return postponingInstallation; }
|
||||
|
||||
- (void)installUpdate
|
||||
{
|
||||
showErrors = YES;
|
||||
[super installUpdate];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)note
|
||||
{
|
||||
[self installUpdate];
|
||||
}
|
||||
|
||||
- (void)installerFinishedForHostBundle:(NSBundle *)hb
|
||||
{
|
||||
if (hb != hostBundle) { return; }
|
||||
if (!postponingInstallation)
|
||||
[self relaunchHostApp];
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
if (showErrors)
|
||||
[super abortUpdateWithError:error];
|
||||
else
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,282 +0,0 @@
|
||||
//
|
||||
// SUBasicUpdateDriver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/23/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
#import "Sparkle.h"
|
||||
|
||||
@implementation SUBasicUpdateDriver
|
||||
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hb
|
||||
{
|
||||
hostBundle = [hb retain];
|
||||
|
||||
if ([hostBundle isRunningFromDiskImage])
|
||||
{
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a disk image. Move %1$@ to your Applications folder, relaunch it from there, and try again.", nil), [hostBundle name]] forKey:NSLocalizedDescriptionKey]]];
|
||||
return;
|
||||
}
|
||||
|
||||
SUAppcast *appcast = [[SUAppcast alloc] init];
|
||||
CFRetain(appcast); // We'll manage the appcast's memory ourselves so we don't have to make it an IV to support GC.
|
||||
[appcast release];
|
||||
|
||||
[appcast setDelegate:self];
|
||||
[appcast setUserAgentString:[NSString stringWithFormat: @"%@/%@ Sparkle/1.5b2", [hostBundle name], [hostBundle displayVersion]]];
|
||||
[appcast fetchAppcastFromURL:appcastURL];
|
||||
}
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui
|
||||
{
|
||||
return [[SUStandardVersionComparator defaultComparator] compareVersion:[hostBundle version]
|
||||
toVersion:[ui versionString]] == NSOrderedAscending;
|
||||
}
|
||||
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui
|
||||
{
|
||||
if ([ui minimumSystemVersion] == nil || [[ui minimumSystemVersion] isEqualToString:@""]) { return YES; }
|
||||
return [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion]
|
||||
toVersion:[NSWorkspace systemVersionString]] != NSOrderedDescending;
|
||||
}
|
||||
|
||||
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui
|
||||
{
|
||||
NSString *skippedVersion = [[SUUserDefaults standardUserDefaults] objectForKey:SUSkippedVersionKey];
|
||||
if (skippedVersion == nil) { return NO; }
|
||||
return [[SUStandardVersionComparator defaultComparator] compareVersion:[ui versionString]
|
||||
toVersion:skippedVersion] != NSOrderedDescending;
|
||||
}
|
||||
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
|
||||
{
|
||||
return [self hostSupportsItem:ui] && [self isItemNewer:ui] && ![self itemContainsSkippedVersion:ui];
|
||||
}
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(appcastDidFinishLoading:forHostBundle:)])
|
||||
[delegate appcastDidFinishLoading:ac forHostBundle:hostBundle];
|
||||
|
||||
NSArray* updates = [ac items];
|
||||
if ([updates count] > 0)
|
||||
[[SUUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:SULastCheckTimeKey];
|
||||
|
||||
// Now we have to find the best valid update in the appcast.
|
||||
if ([delegate respondsToSelector:@selector(bestValidUpdateInAppcast:forHostBundle:)]) // Does the delegate want to handle it?
|
||||
{
|
||||
updateItem = [delegate bestValidUpdateInAppcast:ac forHostBundle:hostBundle];
|
||||
}
|
||||
else // If not, we'll take care of it ourselves.
|
||||
{
|
||||
// Find the first update we can actually use.
|
||||
NSEnumerator *updateEnumerator = [updates objectEnumerator];
|
||||
do {
|
||||
updateItem = [updateEnumerator nextObject];
|
||||
} while (updateItem && ![self hostSupportsItem:updateItem]);
|
||||
|
||||
[updateItem retain];
|
||||
}
|
||||
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
|
||||
if (updateItem == nil) { [self didNotFindUpdate]; return; }
|
||||
|
||||
if ([self itemContainsValidUpdate:updateItem])
|
||||
[self didFindValidUpdate];
|
||||
else
|
||||
[self didNotFindUpdate];
|
||||
}
|
||||
|
||||
- (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error
|
||||
{
|
||||
CFRelease(ac); // Remember that we're explicitly managing the memory of the appcast.
|
||||
[self abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(didFindValidUpdate:toHostBundle:)])
|
||||
[delegate didFindValidUpdate:updateItem toHostBundle:hostBundle];
|
||||
[self downloadUpdate];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(didNotFindUpdateToHostBundle:)])
|
||||
[delegate didNotFindUpdateToHostBundle:hostBundle];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNoUpdateError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", nil), [hostBundle name]] forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
- (void)downloadUpdate
|
||||
{
|
||||
download = [[NSURLDownload alloc] initWithRequest:[NSURLRequest requestWithURL:[updateItem fileURL]] delegate:self];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name
|
||||
{
|
||||
// If name ends in .txt, the server probably has a stupid MIME configuration. We'll give the developer the benefit of the doubt and chop that off.
|
||||
if ([[name pathExtension] isEqualToString:@"txt"])
|
||||
name = [name stringByDeletingPathExtension];
|
||||
|
||||
// We create a temporary directory in /tmp and stick the file there.
|
||||
// Not using a GUID here because hdiutil for some reason chokes on GUIDs. Too long? I really have no idea.
|
||||
NSString *prefix = [NSString stringWithFormat:@"%@ %@ Update", [hostBundle name], [hostBundle version]];
|
||||
NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:prefix];
|
||||
int cnt=1;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999999)
|
||||
tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];
|
||||
if (!success)
|
||||
{
|
||||
// Okay, something's really broken with /tmp
|
||||
[download cancel];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir] forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
downloadPath = [[tempDir stringByAppendingPathComponent:name] retain];
|
||||
[download setDestination:downloadPath allowOverwrite:YES];
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)d
|
||||
{
|
||||
[self extractUpdate];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
{
|
||||
// Get rid of what we've downloaded so far, if anything.
|
||||
if (downloadPath != nil)
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[downloadPath stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[downloadPath lastPathComponent]] tag:NULL];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
}
|
||||
|
||||
- (void)extractUpdate
|
||||
{
|
||||
// DSA verification, if activated by the developer
|
||||
if ([[hostBundle objectForInfoDictionaryKey:SUExpectsDSASignatureKey] boolValue])
|
||||
{
|
||||
if (![[NSFileManager defaultManager] validatePath:downloadPath withEncodedDSASignature:[updateItem DSASignature] withPublicDSAKey:[hostBundle publicDSAKey]])
|
||||
{
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:[NSDictionary dictionaryWithObject:@"The update is improperly signed." forKey:NSLocalizedDescriptionKey]]];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForURL:[[[NSURL alloc] initFileURLWithPath:downloadPath] autorelease]];
|
||||
if (!unarchiver)
|
||||
{
|
||||
NSLog(@"Sparkle Error: No valid unarchiver for %@!", downloadPath);
|
||||
[self unarchiverDidFail:nil];
|
||||
return;
|
||||
}
|
||||
CFRetain(unarchiver); // Manage this memory manually so we don't have to make it an IV.
|
||||
[unarchiver setDelegate:self];
|
||||
[unarchiver start];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
if (ua) { CFRelease(ua); }
|
||||
[self installUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)ua
|
||||
{
|
||||
if (ua) { CFRelease(ua); }
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:[NSDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
|
||||
- (BOOL)shouldInstallSynchronously { return NO; }
|
||||
|
||||
- (void)installUpdate
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(updateWillInstall:toHostBundle:)])
|
||||
[delegate updateWillInstall:updateItem toHostBundle:hostBundle];
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
|
||||
NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems
|
||||
[[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
|
||||
if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
|
||||
relaunchPath = [targetPath retain];
|
||||
|
||||
[SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHostBundle:hostBundle delegate:self synchronously:[self shouldInstallSynchronously]];
|
||||
}
|
||||
|
||||
- (void)installerFinishedForHostBundle:(NSBundle *)hb
|
||||
{
|
||||
if (hb != hostBundle) { return; }
|
||||
[self relaunchHostApp];
|
||||
}
|
||||
|
||||
- (void)relaunchHostApp
|
||||
{
|
||||
// Give the host app an opportunity to postpone the relaunch.
|
||||
static BOOL postponedOnce = NO;
|
||||
if (!postponedOnce && [delegate respondsToSelector:@selector(shouldPostponeRelaunchForUpdate:toHostBundle:untilInvoking:)])
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[[self class] instanceMethodSignatureForSelector:@selector(relaunchHostApp)] retain]];
|
||||
[invocation setSelector:@selector(relaunchHostApp)];
|
||||
[invocation setTarget:self];
|
||||
postponedOnce = YES;
|
||||
if ([delegate shouldPostponeRelaunchForUpdate:updateItem toHostBundle:hostBundle untilInvoking:invocation])
|
||||
return;
|
||||
}
|
||||
|
||||
[self cleanUp]; // Clean up the download and extracted files.
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self];
|
||||
if ([delegate respondsToSelector:@selector(updaterWillRelaunchApplication)])
|
||||
[delegate updaterWillRelaunchApplication];
|
||||
|
||||
if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath])
|
||||
{
|
||||
// Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin.
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [[NSBundle mainBundle] name]], NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
// We intentionally don't abandon the update here so that the host won't initiate another.
|
||||
return;
|
||||
}
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchPath arguments:[NSArray arrayWithObjects:[hostBundle bundlePath], [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], nil]];
|
||||
|
||||
[NSApp terminate:self];
|
||||
}
|
||||
|
||||
- (void)cleanUp
|
||||
{
|
||||
[[NSFileManager defaultManager] removeFileAtPath:[downloadPath stringByDeletingLastPathComponent] handler:nil];
|
||||
}
|
||||
|
||||
- (void)installerForHostBundle:(NSBundle *)hb failedWithError:(NSError *)error
|
||||
{
|
||||
if (hb != hostBundle) { return; }
|
||||
[[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher.
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[super abortUpdate];
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
if ([error code] != SUNoUpdateError) // Let's not bother logging this.
|
||||
NSLog(@"Sparkle Error: %@", [error localizedDescription]);
|
||||
if ([error localizedFailureReason])
|
||||
NSLog(@"Sparkle Error (continued): %@", [error localizedFailureReason]);
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[hostBundle release];
|
||||
[downloadPath release];
|
||||
[relaunchPath release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,72 +0,0 @@
|
||||
//
|
||||
// SUConstants.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#ifndef SUCONSTANTS_H
|
||||
#define SUCONSTANTS_H
|
||||
|
||||
|
||||
extern NSString *SUUpdaterWillRestartNotification;
|
||||
extern NSString *SUTechnicalErrorInformationKey;
|
||||
|
||||
extern NSString *SUFeedURLKey;
|
||||
extern NSString *SUHasLaunchedBeforeKey;
|
||||
extern NSString *SUShowReleaseNotesKey;
|
||||
extern NSString *SUSkippedVersionKey;
|
||||
extern NSString *SUScheduledCheckIntervalKey;
|
||||
extern NSString *SULastCheckTimeKey;
|
||||
extern NSString *SUExpectsDSASignatureKey;
|
||||
extern NSString *SUPublicDSAKeyKey;
|
||||
extern NSString *SUPublicDSAKeyFileKey;
|
||||
extern NSString *SUAutomaticallyUpdateKey;
|
||||
extern NSString *SUAllowsAutomaticUpdatesKey;
|
||||
extern NSString *SUEnableAutomaticChecksKey;
|
||||
extern NSString *SUEnableAutomaticChecksKeyOld;
|
||||
extern NSString *SUEnableSystemProfilingKey;
|
||||
extern NSString *SUSendProfileInfoKey;
|
||||
|
||||
extern NSString *SUSparkleErrorDomain;
|
||||
// Appcast phase errors.
|
||||
extern OSStatus SUAppcastParseError;
|
||||
extern OSStatus SUNoUpdateError;
|
||||
extern OSStatus SUAppcastError;
|
||||
extern OSStatus SURunningFromDiskImageError;
|
||||
|
||||
// Downlaod phase errors.
|
||||
extern OSStatus SUTemporaryDirectoryError;
|
||||
|
||||
// Extraction phase errors.
|
||||
extern OSStatus SUUnarchivingError;
|
||||
extern OSStatus SUSignatureError;
|
||||
|
||||
// Installation phase errors.
|
||||
extern OSStatus SUFileCopyFailure;
|
||||
extern OSStatus SUAuthenticationFailure;
|
||||
extern OSStatus SUMissingUpdateError;
|
||||
extern OSStatus SUMissingInstallerToolError;
|
||||
extern OSStatus SURelaunchError;
|
||||
extern OSStatus SUInstallationError;
|
||||
|
||||
// NSInteger is a type that was added to Leopard.
|
||||
// Here is some glue to ensure that NSInteger will work with pre-10.5 SDKs:
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
#ifdef NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
#else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
#define NSIntegerMax LONG_MAX
|
||||
#define NSIntegerMin LONG_MIN
|
||||
#define NSUIntegerMax ULONG_MAX
|
||||
#define NSINTEGER_DEFINED 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// SUConstants.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
NSString *SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
|
||||
NSString *SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
|
||||
|
||||
NSString *SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
|
||||
NSString *SUFeedURLKey = @"SUFeedURL";
|
||||
NSString *SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||
NSString *SUSkippedVersionKey = @"SUSkippedVersion";
|
||||
NSString *SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
NSString *SULastCheckTimeKey = @"SULastCheckTime";
|
||||
NSString *SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||
NSString *SUPublicDSAKeyKey = @"SUPublicDSAKey";
|
||||
NSString *SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
|
||||
NSString *SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
|
||||
NSString *SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
|
||||
NSString *SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
|
||||
NSString *SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
|
||||
NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
OSStatus SUAppcastParseError = 1000;
|
||||
OSStatus SUNoUpdateError = 1001;
|
||||
OSStatus SUAppcastError = 1002;
|
||||
OSStatus SURunningFromDiskImageError = 1003;
|
||||
|
||||
OSStatus SUTemporaryDirectoryError = 2000;
|
||||
|
||||
OSStatus SUUnarchivingError = 3000;
|
||||
OSStatus SUSignatureError = 3001;
|
||||
|
||||
OSStatus SUFileCopyFailure = 4000;
|
||||
OSStatus SUAuthenticationFailure = 4001;
|
||||
OSStatus SUMissingUpdateError = 4002;
|
||||
OSStatus SUMissingInstallerToolError = 4003;
|
||||
OSStatus SURelaunchError = 4004;
|
||||
OSStatus SUInstallationError = 4005;
|
||||
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// SUDiskImageUnarchiver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 6/16/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUDiskImageUnarchiver.h"
|
||||
#import "SUUnarchiver_Private.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
|
||||
@implementation SUDiskImageUnarchiver
|
||||
|
||||
+ (BOOL)_canUnarchiveURL:(NSURL *)URL
|
||||
{
|
||||
return [URL conformsToType:@"public.disk-image"];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
- (void)_extractDMG
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *archivePath = [archiveURL path];
|
||||
BOOL mountedSuccessfully = NO;
|
||||
|
||||
// get a unique mount point path
|
||||
NSString *mountPrefix = [@"/Volumes" stringByAppendingPathComponent:[[archivePath lastPathComponent] stringByDeletingPathExtension]];
|
||||
NSString *mountPoint = [mountPrefix stringByAppendingString:[[NSProcessInfo processInfo] globallyUniqueString]];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
|
||||
|
||||
// create mount point folder
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:mountPoint attributes:nil];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
|
||||
|
||||
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];
|
||||
// set up a pipe and push "yes" (y works too), this will accept any license agreement crap
|
||||
// not every .dmg needs this, but this will make sure it works with everyone
|
||||
NSData* yesData = [[[NSData alloc] initWithBytes:"yes\n" length:4] autorelease];
|
||||
|
||||
NSData *result = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:yesData];
|
||||
if (!result) goto reportError;
|
||||
mountedSuccessfully = YES;
|
||||
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]];
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath attributes:nil]) goto reportError;
|
||||
|
||||
// We can't just copyPath: from the volume root because that always fails. Seems to be a bug.
|
||||
id subpathEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:mountPoint] objectEnumerator], currentSubpath;
|
||||
while ((currentSubpath = [subpathEnumerator nextObject]))
|
||||
{
|
||||
if (![[NSFileManager defaultManager] copyPath:[mountPoint stringByAppendingPathComponent:currentSubpath] toPath:[targetPath stringByAppendingPathComponent:currentSubpath] handler:nil])
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (mountedSuccessfully)
|
||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self _registerImplementation:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// SUInstaller.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUINSTALLER_H
|
||||
#define SUINSTALLER_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SUInstaller : NSObject { }
|
||||
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHostBundle:(NSBundle *)hostBundle delegate:delegate synchronously:(BOOL)synchronously;
|
||||
+ (void)_finishInstallationWithResult:(BOOL)result hostBundle:(NSBundle *)hostBundle error:(NSError *)error delegate:delegate;
|
||||
@end
|
||||
|
||||
@interface NSObject (SUInstallerDelegateInformalProtocol)
|
||||
- (void)installerFinishedForHostBundle:(NSBundle *)hostBundle;
|
||||
- (void)installerForHostBundle:(NSBundle *)hostBundle failedWithError:(NSError *)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
//
|
||||
// SUInstaller.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUInstaller.h"
|
||||
#import "SUPlainInstaller.h"
|
||||
#import "SUPackageInstaller.h"
|
||||
|
||||
NSString *SUInstallerPathKey = @"SUInstallerPath";
|
||||
NSString *SUInstallerHostBundleKey = @"SUInstallerHostBundle";
|
||||
NSString *SUInstallerDelegateKey = @"SUInstallerDelegate";
|
||||
|
||||
@implementation SUInstaller
|
||||
|
||||
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHostBundle:(NSBundle *)hostBundle delegate:delegate synchronously:(BOOL)synchronously
|
||||
{
|
||||
// Search subdirectories for the application
|
||||
NSString *currentFile, *newAppDownloadPath = nil, *bundleFileName = [[hostBundle bundlePath] lastPathComponent], *alternateBundleFileName = [[hostBundle name] stringByAppendingPathExtension:[[hostBundle bundlePath] pathExtension]];
|
||||
BOOL isPackage = NO;
|
||||
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:updateFolder];
|
||||
while ((currentFile = [dirEnum nextObject]))
|
||||
{
|
||||
NSString *currentPath = [updateFolder stringByAppendingPathComponent:currentFile];
|
||||
if ([[currentFile lastPathComponent] isEqualToString:bundleFileName] ||
|
||||
[[currentFile lastPathComponent] isEqualToString:alternateBundleFileName]) // We found one!
|
||||
{
|
||||
isPackage = NO;
|
||||
newAppDownloadPath = currentPath;
|
||||
break;
|
||||
}
|
||||
else if (([[currentFile pathExtension] isEqualToString:@"pkg"] || [[currentFile pathExtension] isEqualToString:@"mpkg"]) &&
|
||||
[[[currentFile lastPathComponent] stringByDeletingPathExtension] isEqualToString:[bundleFileName stringByDeletingPathExtension]])
|
||||
{
|
||||
isPackage = YES;
|
||||
newAppDownloadPath = currentPath;
|
||||
break;
|
||||
}
|
||||
|
||||
// Some DMGs have symlinks into /Applications! That's no good! And there's no point in looking in bundles.
|
||||
if ([[NSFileManager defaultManager] isAliasFolderAtPath:currentPath] ||
|
||||
[[currentFile pathExtension] isEqualToString:[[hostBundle bundlePath] pathExtension]] ||
|
||||
[[currentFile pathExtension] isEqualToString:@"pkg"] ||
|
||||
[[currentFile pathExtension] isEqualToString:@"mpkg"])
|
||||
{
|
||||
[dirEnum skipDescendents];
|
||||
}
|
||||
}
|
||||
|
||||
if (newAppDownloadPath == nil)
|
||||
{
|
||||
[self _finishInstallationWithResult:NO hostBundle:hostBundle error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class]) performInstallationWithPath:newAppDownloadPath hostBundle:hostBundle delegate:delegate synchronously:synchronously];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)_mdimportBundle:(NSBundle *)bundle
|
||||
{
|
||||
NSTask *mdimport = [[[NSTask alloc] init] autorelease];
|
||||
[mdimport setLaunchPath:@"/usr/bin/mdimport"];
|
||||
[mdimport setArguments:[NSArray arrayWithObject:[bundle bundlePath]]];
|
||||
[mdimport launch];
|
||||
}
|
||||
|
||||
+ (void)_finishInstallationWithResult:(BOOL)result hostBundle:(NSBundle *)hostBundle error:(NSError *)error delegate:delegate
|
||||
{
|
||||
if (result == YES)
|
||||
{
|
||||
[self _mdimportBundle:hostBundle];
|
||||
if ([delegate respondsToSelector:@selector(installerFinishedForHostBundle:)])
|
||||
[delegate installerFinishedForHostBundle:hostBundle];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(installerForHostBundle:failedWithError:)])
|
||||
[delegate installerForHostBundle:hostBundle failedWithError:error];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// SUPackageInstaller.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUPackageInstaller.h"
|
||||
|
||||
|
||||
@implementation SUPackageInstaller
|
||||
|
||||
+ (void)installPath:(NSString *)path overHostBundle:(NSBundle *)bundle delegate:delegate
|
||||
{
|
||||
NSError *error = nil;
|
||||
BOOL result = YES;
|
||||
|
||||
NSString *installerPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.installer"];
|
||||
installerPath = [installerPath stringByAppendingString:@"/Contents/MacOS/Installer"];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:installerPath])
|
||||
{
|
||||
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find Apple's installer tool!" forKey:NSLocalizedDescriptionKey]];
|
||||
result = NO;
|
||||
}
|
||||
NSTask *installer = [NSTask launchedTaskWithLaunchPath:installerPath arguments:[NSArray arrayWithObjects:path, nil]];
|
||||
[installer waitUntilExit];
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
[self _finishInstallationWithResult:result hostBundle:bundle error:error delegate:delegate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,106 +0,0 @@
|
||||
//
|
||||
// SUPipedUnarchiver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 6/16/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUPipedUnarchiver.h"
|
||||
#import "SUUnarchiver_Private.h"
|
||||
|
||||
@implementation SUPipedUnarchiver
|
||||
|
||||
+ (SEL)_selectorConformingToTypeOfURL:(NSURL *)URL
|
||||
{
|
||||
static NSDictionary *typeSelectorDictionary;
|
||||
if (!typeSelectorDictionary)
|
||||
typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"_extractZIP", @"public.zip-archive", @"_extractTGZ", @"org.gnu.gnu-zip-tar-archive", @"_extractTBZ", @"org.bzip.bzip2-tar-archive", @"_extractTAR", @"public.tar-archive", nil] retain];
|
||||
|
||||
NSEnumerator *typeEnumerator = [typeSelectorDictionary keyEnumerator];
|
||||
id currentType;
|
||||
while ((currentType = [typeEnumerator nextObject]))
|
||||
{
|
||||
if ([URL conformsToType:currentType])
|
||||
return NSSelectorFromString([typeSelectorDictionary objectForKey:currentType]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:[[self class] _selectorConformingToTypeOfURL:archiveURL] toTarget:self withObject:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)_canUnarchiveURL:(NSURL *)URL
|
||||
{
|
||||
return ([self _selectorConformingToTypeOfURL:URL] != nil);
|
||||
}
|
||||
|
||||
// This method abstracts the types that use a command line tool piping data from stdin.
|
||||
- (void)_extractArchivePipingDataToCommand:(NSString *)command
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *archivePath = [archiveURL path];
|
||||
FILE *fp = NULL, *cmdFP = NULL;
|
||||
|
||||
// Get the file size.
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
|
||||
if (fs == nil) goto reportError;
|
||||
|
||||
// Thank you, Allan Odgaard!
|
||||
// (who wrote the following extraction alg.)
|
||||
fp = fopen([archivePath fileSystemRepresentation], "r");
|
||||
if (!fp) goto reportError;
|
||||
|
||||
setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1);
|
||||
cmdFP = popen([command fileSystemRepresentation], "w");
|
||||
if (!cmdFP) goto reportError;
|
||||
|
||||
char buf[32*1024];
|
||||
long len;
|
||||
while((len = fread(buf, 1, 32*1024, fp)))
|
||||
{
|
||||
fwrite(buf, 1, len, cmdFP);
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithLong:len] waitUntilDone:NO];
|
||||
}
|
||||
pclose(cmdFP);
|
||||
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)_extractTAR
|
||||
{
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractTGZ
|
||||
{
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractTBZ
|
||||
{
|
||||
return [self _extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
- (void)_extractZIP
|
||||
{
|
||||
return [self _extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self _registerImplementation:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// SUPlainInstaller.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUPLAININSTALLER_H
|
||||
#define SUPLAININSTALLER_H
|
||||
|
||||
#import "Sparkle.h"
|
||||
|
||||
@interface SUPlainInstaller : SUInstaller { }
|
||||
+ (void)performInstallationWithPath:(NSString *)path hostBundle:(NSBundle *)hostBundle delegate:delegate synchronously:(BOOL)synchronously;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
//
|
||||
// SUPlainInstaller.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/10/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUPlainInstaller.h"
|
||||
|
||||
extern NSString *SUInstallerPathKey;
|
||||
extern NSString *SUInstallerHostBundleKey;
|
||||
extern NSString *SUInstallerDelegateKey;
|
||||
|
||||
@implementation SUPlainInstaller
|
||||
|
||||
+ (void)installPath:(NSString *)path overHostBundle:(NSBundle *)bundle delegate:delegate
|
||||
{
|
||||
NSError *error;
|
||||
BOOL result = [[NSFileManager defaultManager] copyPathWithAuthentication:path overPath:[bundle bundlePath] error:&error];
|
||||
[self _finishInstallationWithResult:result hostBundle:bundle error:error delegate:delegate];
|
||||
}
|
||||
|
||||
+ (void)_performInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[self installPath:[info objectForKey:SUInstallerPathKey] overHostBundle:[info objectForKey:SUInstallerHostBundleKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
+ (void)performInstallationWithPath:(NSString *)path hostBundle:(NSBundle *)hostBundle delegate:delegate synchronously:(BOOL)synchronously;
|
||||
{
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, hostBundle, SUInstallerHostBundleKey, delegate, SUInstallerDelegateKey, nil];
|
||||
if (synchronously)
|
||||
[self _performInstallationWithInfo:info];
|
||||
else
|
||||
[NSThread detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// SUProbingUpdateDriver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/7/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUProbingUpdateDriver.h"
|
||||
|
||||
|
||||
@implementation SUProbingUpdateDriver
|
||||
|
||||
// Stop as soon as we have an answer! The superclasses will already have taken care of notifying the delegate.
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBClasses</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSApplication</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSResponder</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>FirstResponder</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSObject</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>SUStatusController</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>actionButton</key>
|
||||
<string>NSButton</string>
|
||||
<key>progressBar</key>
|
||||
<string>NSProgressIndicator</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSWindowController</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>IBVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>629</string>
|
||||
<key>IBLastKnownRelativeProjectPath</key>
|
||||
<string>../Sparkle.xcodeproj</string>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>5</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>6</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9C31</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// SUStatusController.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/14/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUSTATUSCONTROLLER_H
|
||||
#define SUSTATUSCONTROLLER_H
|
||||
|
||||
#import "SUWindowController.h"
|
||||
|
||||
@interface SUStatusController : SUWindowController {
|
||||
double progressValue, maxProgressValue;
|
||||
NSString *title, *statusText, *buttonTitle;
|
||||
IBOutlet NSButton *actionButton;
|
||||
IBOutlet NSProgressIndicator* progressBar;
|
||||
NSBundle *hostBundle;
|
||||
}
|
||||
|
||||
- (id)initWithHostBundle:(NSBundle *)hostBundle;
|
||||
|
||||
// Pass 0 for the max progress value to get an indeterminate progress bar.
|
||||
// Pass nil for the status text to not show it.
|
||||
- (void)beginActionWithTitle:(NSString *)title maxProgressValue:(double)maxProgressValue statusText:(NSString *)statusText;
|
||||
|
||||
// If isDefault is YES, the button's key equivalent will be \r.
|
||||
- (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault;
|
||||
- (void)setButtonEnabled:(BOOL)enabled;
|
||||
|
||||
- (double)progressValue;
|
||||
- (void)setProgressValue:(double)value;
|
||||
- (double)maxProgressValue;
|
||||
- (void)setMaxProgressValue:(double)value;
|
||||
|
||||
- (void)setStatusText:(NSString *)statusText;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,121 +0,0 @@
|
||||
//
|
||||
// SUStatusController.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/14/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUStatusController.h"
|
||||
|
||||
@implementation SUStatusController
|
||||
|
||||
- (id)initWithHostBundle:(NSBundle *)hb
|
||||
{
|
||||
self = [super initWithHostBundle:hb windowNibName:@"SUStatus"];
|
||||
if (self)
|
||||
{
|
||||
hostBundle = [hb retain];
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[hostBundle release];
|
||||
[title release];
|
||||
[statusText release];
|
||||
[buttonTitle release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[[self window] center];
|
||||
[[self window] setFrameAutosaveName:@"SUStatusFrame"];
|
||||
[progressBar setUsesThreadedAnimation:YES];
|
||||
}
|
||||
|
||||
- (NSString *)windowTitle
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"Updating %@", nil), [hostBundle name]];
|
||||
}
|
||||
|
||||
- (NSImage *)applicationIcon
|
||||
{
|
||||
return [hostBundle icon];
|
||||
}
|
||||
|
||||
- (void)beginActionWithTitle:(NSString *)aTitle maxProgressValue:(double)aMaxProgressValue statusText:(NSString *)aStatusText
|
||||
{
|
||||
[self willChangeValueForKey:@"title"];
|
||||
title = [aTitle copy];
|
||||
[self didChangeValueForKey:@"title"];
|
||||
|
||||
[self setMaxProgressValue:aMaxProgressValue];
|
||||
[self setStatusText:aStatusText];
|
||||
}
|
||||
|
||||
- (void)setButtonTitle:(NSString *)aButtonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault
|
||||
{
|
||||
[self willChangeValueForKey:@"buttonTitle"];
|
||||
if (buttonTitle != aButtonTitle)
|
||||
{
|
||||
[buttonTitle release];
|
||||
buttonTitle = [aButtonTitle copy];
|
||||
}
|
||||
[self didChangeValueForKey:@"buttonTitle"];
|
||||
|
||||
[self window];
|
||||
[actionButton sizeToFit];
|
||||
// Except we're going to add 15 px for padding.
|
||||
[actionButton setFrameSize:NSMakeSize([actionButton frame].size.width + 15, [actionButton frame].size.height)];
|
||||
// Now we have to move it over so that it's always 15px from the side of the window.
|
||||
[actionButton setFrameOrigin:NSMakePoint([[self window] frame].size.width - 15 - [actionButton frame].size.width, [actionButton frame].origin.y)];
|
||||
// Redisplay superview to clean up artifacts
|
||||
[[actionButton superview] display];
|
||||
|
||||
[actionButton setTarget:target];
|
||||
[actionButton setAction:action];
|
||||
[actionButton setKeyEquivalent:isDefault ? @"\r" : @""];
|
||||
}
|
||||
|
||||
- (void)setButtonEnabled:(BOOL)enabled
|
||||
{
|
||||
[actionButton setEnabled:enabled];
|
||||
}
|
||||
|
||||
- (double)progressValue
|
||||
{
|
||||
return progressValue;
|
||||
}
|
||||
|
||||
- (void)setProgressValue:(double)value
|
||||
{
|
||||
progressValue = value;
|
||||
}
|
||||
|
||||
- (double)maxProgressValue
|
||||
{
|
||||
return maxProgressValue;
|
||||
}
|
||||
|
||||
- (void)setMaxProgressValue:(double)value
|
||||
{
|
||||
maxProgressValue = value;
|
||||
[self setProgressValue:0];
|
||||
[progressBar setIndeterminate:(value == 0)];
|
||||
}
|
||||
|
||||
- (void)setStatusText:(NSString *)aStatusText
|
||||
{
|
||||
if (statusText != aStatusText)
|
||||
{
|
||||
[statusText release];
|
||||
statusText = [aStatusText copy];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,129 +0,0 @@
|
||||
//
|
||||
// SUSystemProfiler.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 12/22/07.
|
||||
// Copyright 2007 Andy Matuschak. All rights reserved.
|
||||
// Adapted from Sparkle+, by Tom Harrington.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUSystemProfiler.h"
|
||||
|
||||
#import <sys/sysctl.h>
|
||||
|
||||
@implementation SUSystemProfiler
|
||||
+ (SUSystemProfiler *)sharedSystemProfiler
|
||||
{
|
||||
static SUSystemProfiler *sharedSystemProfiler = nil;
|
||||
if (!sharedSystemProfiler)
|
||||
sharedSystemProfiler = [[self alloc] init];
|
||||
return sharedSystemProfiler;
|
||||
}
|
||||
|
||||
- (NSDictionary *)modelTranslationTable
|
||||
{
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"SUModelTranslation" ofType:@"plist"];
|
||||
return [[[NSDictionary alloc] initWithContentsOfFile:path] autorelease];
|
||||
}
|
||||
|
||||
- (NSMutableArray *)systemProfileArrayForHostBundle:(NSBundle *)hostBundle
|
||||
{
|
||||
NSDictionary *modelTranslation = [self modelTranslationTable];
|
||||
|
||||
// Gather profile information and append it to the URL.
|
||||
NSMutableArray *profileArray = [NSMutableArray array];
|
||||
NSArray *profileDictKeys = [NSArray arrayWithObjects:@"key", @"visibleKey", @"value", @"visibleValue", nil];
|
||||
int error = 0 ;
|
||||
int value = 0 ;
|
||||
unsigned long length = sizeof(value) ;
|
||||
|
||||
// OS version
|
||||
NSString *currentSystemVersion = [NSWorkspace systemVersionString];
|
||||
if (currentSystemVersion != nil)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"osVersion",@"OS Version",currentSystemVersion,currentSystemVersion,nil] forKeys:profileDictKeys]];
|
||||
|
||||
// CPU type (decoder info for values found here is in mach/machine.h)
|
||||
error = sysctlbyname("hw.cputype", &value, &length, NULL, 0);
|
||||
int cpuType = -1;
|
||||
if (error == 0) {
|
||||
cpuType = value;
|
||||
NSString *visibleCPUType;
|
||||
switch(value) {
|
||||
case 7: visibleCPUType=@"Intel"; break;
|
||||
case 18: visibleCPUType=@"PowerPC"; break;
|
||||
default: visibleCPUType=@"Unknown"; break;
|
||||
}
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cputype",@"CPU Type", [NSNumber numberWithInt:value], visibleCPUType,nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
error = sysctlbyname("hw.cpusubtype", &value, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *visibleCPUSubType;
|
||||
if (cpuType == 7) {
|
||||
// Intel
|
||||
visibleCPUSubType = @"Intel"; // If anyone knows how to tell a Core Duo from a Core Solo, please email tph@atomicbird.com
|
||||
} else if (cpuType == 18) {
|
||||
// PowerPC
|
||||
switch(value) {
|
||||
case 9: visibleCPUSubType=@"G3"; break;
|
||||
case 10: case 11: visibleCPUSubType=@"G4"; break;
|
||||
case 100: visibleCPUSubType=@"G5"; break;
|
||||
default: visibleCPUSubType=@"Other"; break;
|
||||
}
|
||||
} else {
|
||||
visibleCPUSubType = @"Other";
|
||||
}
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpusubtype",@"CPU Subtype", [NSNumber numberWithInt:value], visibleCPUSubType,nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
error = sysctlbyname("hw.model", NULL, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
char *cpuModel;
|
||||
cpuModel = (char *)malloc(sizeof(char) * length);
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = [NSString stringWithUTF8String:cpuModel];
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil)
|
||||
visibleModelName = rawModelName;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"model",@"Mac Model", rawModelName, visibleModelName, nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
if (cpuModel != NULL)
|
||||
free(cpuModel);
|
||||
}
|
||||
|
||||
// Number of CPUs
|
||||
error = sysctlbyname("hw.ncpu", &value, &length, NULL, 0);
|
||||
if (error == 0)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"ncpu",@"Number of CPUs", [NSNumber numberWithInt:value], [NSNumber numberWithInt:value],nil] forKeys:profileDictKeys]];
|
||||
|
||||
// User preferred language
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
|
||||
if (languages && ([languages count] > 0))
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"lang",@"Preferred Language", [languages objectAtIndex:0], [languages objectAtIndex:0],nil] forKeys:profileDictKeys]];
|
||||
|
||||
// Application sending the request
|
||||
NSString *appName = [hostBundle name];
|
||||
if (appName)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"appName",@"Application Name", appName, appName,nil] forKeys:profileDictKeys]];
|
||||
NSString *appVersion = [hostBundle version];
|
||||
if (appVersion)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"appVersion",@"Application Version", appVersion, appVersion,nil] forKeys:profileDictKeys]];
|
||||
|
||||
// Number of displays?
|
||||
// CPU speed
|
||||
OSErr err;
|
||||
SInt32 gestaltInfo;
|
||||
err = Gestalt(gestaltProcClkSpeedMHz,&gestaltInfo);
|
||||
if (err == noErr)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpuFreqMHz",@"CPU Speed (MHz)", [NSNumber numberWithInt:gestaltInfo], [NSNumber numberWithInt:gestaltInfo],nil] forKeys:profileDictKeys]];
|
||||
|
||||
// amount of RAM
|
||||
err = Gestalt(gestaltPhysicalRAMSizeInMegabytes,&gestaltInfo);
|
||||
if (err == noErr)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"ramMB",@"Memory (MB)", [NSNumber numberWithInt:gestaltInfo], [NSNumber numberWithInt:gestaltInfo],nil] forKeys:profileDictKeys]];
|
||||
|
||||
return profileArray;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,140 +0,0 @@
|
||||
//
|
||||
// SUUIBasedUpdateDriver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/5/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUUIBasedUpdateDriver.h"
|
||||
#import "Sparkle.h"
|
||||
#import "NSNumber+Units.h"
|
||||
|
||||
@implementation SUUIBasedUpdateDriver
|
||||
|
||||
- (void)didFindValidUpdate
|
||||
{
|
||||
updateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:updateItem hostBundle:hostBundle];
|
||||
[updateAlert setDelegate:self];
|
||||
|
||||
// If the app is a menubar app or the like, we need to focus it first:
|
||||
if ([[hostBundle objectForInfoDictionaryKey:@"LSUIElement"] doubleValue]) { [NSApp activateIgnoringOtherApps:YES]; }
|
||||
|
||||
// Only show the update alert if the app is active; otherwise, we'll wait until it is.
|
||||
if ([NSApp isActive])
|
||||
[[updateAlert window] makeKeyAndOrderFront:self];
|
||||
else
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(didNotFindUpdateToHostBundle:)])
|
||||
[delegate didNotFindUpdateToHostBundle:hostBundle];
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"You're up to date!", nil) defaultButton:SULocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [hostBundle name], [hostBundle displayVersion]];
|
||||
[alert setIcon:[hostBundle icon]];
|
||||
[alert runModal];
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||
{
|
||||
[[updateAlert window] makeKeyAndOrderFront:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSApplicationDidBecomeActiveNotification" object:NSApp];
|
||||
}
|
||||
|
||||
- (void)updateAlert:(SUUpdateAlert *)alert finishedWithChoice:(SUUpdateAlertChoice)choice
|
||||
{
|
||||
[updateAlert release]; updateAlert = nil;
|
||||
if ([delegate respondsToSelector:@selector(userChoseAction:forUpdate:toHostBundle:)])
|
||||
[delegate userChoseAction:choice forUpdate:updateItem toHostBundle:hostBundle];
|
||||
[[SUUserDefaults standardUserDefaults] setObject:nil forKey:SUSkippedVersionKey];
|
||||
switch (choice)
|
||||
{
|
||||
case SUInstallUpdateChoice:
|
||||
statusController = [[SUStatusController alloc] initWithHostBundle:hostBundle];
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Downloading update\u2026", nil) maxProgressValue:0 statusText:nil];
|
||||
[statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO];
|
||||
[statusController showWindow:self];
|
||||
[self downloadUpdate];
|
||||
break;
|
||||
|
||||
case SUSkipThisVersionChoice:
|
||||
[[SUUserDefaults standardUserDefaults] setObject:[updateItem versionString] forKey:SUSkippedVersionKey];
|
||||
case SURemindMeLaterChoice:
|
||||
[self abortUpdate];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
|
||||
{
|
||||
[statusController setMaxProgressValue:[response expectedContentLength]];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length
|
||||
{
|
||||
[statusController setProgressValue:[statusController progressValue] + length];
|
||||
[statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [NSNumber humanReadableSizeFromDouble:[statusController progressValue]], [NSNumber humanReadableSizeFromDouble:[statusController maxProgressValue]]]];
|
||||
}
|
||||
|
||||
- (IBAction)cancelDownload:sender
|
||||
{
|
||||
if (download)
|
||||
[download cancel];
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
- (void)extractUpdate
|
||||
{
|
||||
// Now we have to extract the downloaded archive.
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Extracting update\u2026", nil) maxProgressValue:0 statusText:nil];
|
||||
[statusController setButtonEnabled:NO];
|
||||
[super extractUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiver:(SUUnarchiver *)ua extractedLength:(long)length
|
||||
{
|
||||
// We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
|
||||
if ([statusController maxProgressValue] == 0)
|
||||
[statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]];
|
||||
[statusController setProgressValue:[statusController progressValue] + length];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Ready to Install", nil) maxProgressValue:1 statusText:nil];
|
||||
[statusController setProgressValue:1]; // Fill the bar.
|
||||
[statusController setButtonEnabled:YES];
|
||||
[statusController setButtonTitle:SULocalizedString(@"Install and Relaunch", nil) target:self action:@selector(installAndRestart:) isDefault:YES];
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
}
|
||||
|
||||
- (void)installAndRestart:sender { [self installUpdate]; }
|
||||
|
||||
- (void)installUpdate
|
||||
{
|
||||
[statusController beginActionWithTitle:SULocalizedString(@"Installing update\u2026", nil) maxProgressValue:0 statusText:nil];
|
||||
[statusController setButtonEnabled:NO];
|
||||
[super installUpdate];
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:[error localizedDescription]];
|
||||
[alert setIcon:[hostBundle icon]];
|
||||
[alert runModal];
|
||||
[super abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
if (statusController)
|
||||
{
|
||||
[statusController close];
|
||||
[statusController autorelease];
|
||||
}
|
||||
[super abortUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// SUUnarchiver.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUUNARCHIVER_H
|
||||
#define SUUNARCHIVER_H
|
||||
|
||||
@interface SUUnarchiver : NSObject {
|
||||
id delegate;
|
||||
NSURL *archiveURL;
|
||||
}
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForURL:(NSURL *)URL;
|
||||
- (void)setDelegate:delegate;
|
||||
|
||||
- (void)start;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUnarchiverDelegate)
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(long)length;
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// SUUnarchiver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/16/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUUnarchiver.h"
|
||||
#import "SUUnarchiver_Private.h"
|
||||
|
||||
@implementation SUUnarchiver
|
||||
|
||||
extern NSMutableArray *__unarchiverImplementations;
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForURL:(NSURL *)URL
|
||||
{
|
||||
NSEnumerator *implementationEnumerator = [[self _unarchiverImplementations] objectEnumerator];
|
||||
id current;
|
||||
while ((current = [implementationEnumerator nextObject]))
|
||||
{
|
||||
if ([current _canUnarchiveURL:URL])
|
||||
return [[[current alloc] _initWithURL:URL] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// SUUnarchiver_Private.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 6/17/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUUNARCHIVER_PRIVATE_H
|
||||
#define SUUNARCHIVER_PRIVATE_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUUnarchiver (Private)
|
||||
+ (void)_registerImplementation:(Class)implementation;
|
||||
+ (NSArray *)_unarchiverImplementations;
|
||||
+ (BOOL)_canUnarchiveURL:(NSURL *)URL;
|
||||
- _initWithURL:(NSURL *)URL;
|
||||
|
||||
- (void)_notifyDelegateOfExtractedLength:(long)length;
|
||||
- (void)_notifyDelegateOfSuccess;
|
||||
- (void)_notifyDelegateOfFailure;
|
||||
@end
|
||||
|
||||
@interface NSURL (SUTypeDetection)
|
||||
- (BOOL)conformsToType:(NSString *)type;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
//
|
||||
// SUUnarchiver_Private.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 6/17/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUUnarchiver_Private.h"
|
||||
|
||||
@implementation SUUnarchiver (Private)
|
||||
|
||||
- _initWithURL:(NSURL *)URL
|
||||
{
|
||||
if ((self = [super init]))
|
||||
archiveURL = [URL copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[archiveURL release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (BOOL)_canUnarchiveURL:(NSURL *)URL
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfExtractedLength:(long)length
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)])
|
||||
[delegate unarchiver:self extractedLength:length];
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfSuccess
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFinish:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFinish:) withObject:self];
|
||||
}
|
||||
|
||||
- (void)_notifyDelegateOfFailure
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFail:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFail:) withObject:self];
|
||||
}
|
||||
|
||||
static NSMutableArray *__unarchiverImplementations;
|
||||
|
||||
+ (void)_registerImplementation:(Class)implementation
|
||||
{
|
||||
if (!__unarchiverImplementations)
|
||||
__unarchiverImplementations = [[NSMutableArray alloc] init];
|
||||
[__unarchiverImplementations addObject:implementation];
|
||||
}
|
||||
|
||||
+ (NSArray *)_unarchiverImplementations
|
||||
{
|
||||
return [NSArray arrayWithArray:__unarchiverImplementations];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSURL (SUTypeDetection)
|
||||
- (NSString *)__UTI
|
||||
{
|
||||
FSRef fsRefToItem;
|
||||
FSPathMakeRef((UInt8 *)[[self path] fileSystemRepresentation], &fsRefToItem, NULL );
|
||||
|
||||
NSString *UTI = nil;
|
||||
LSCopyItemAttribute(&fsRefToItem, kLSRolesAll, kLSItemContentType, (CFTypeRef *)(&UTI));
|
||||
return [UTI autorelease];
|
||||
}
|
||||
|
||||
- (BOOL)conformsToType:(NSString *)type
|
||||
{
|
||||
return UTTypeConformsTo((CFStringRef)[self __UTI], (CFStringRef)type);
|
||||
}
|
||||
@end
|
||||
@@ -1,182 +0,0 @@
|
||||
//
|
||||
// SUUpdateAlert.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 3/12/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUUpdateAlert.h"
|
||||
|
||||
#import <WebKit/WebKit.h>
|
||||
|
||||
@implementation SUUpdateAlert
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item hostBundle:(NSBundle *)hb
|
||||
{
|
||||
self = [super initWithHostBundle:hb windowNibName:@"SUUpdateAlert"];
|
||||
if (self)
|
||||
{
|
||||
hostBundle = [hb retain];
|
||||
updateItem = [item retain];
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[updateItem release];
|
||||
[hostBundle release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)endWithSelection:(SUUpdateAlertChoice)choice
|
||||
{
|
||||
[releaseNotesView stopLoading:self];
|
||||
[releaseNotesView setFrameLoadDelegate:nil];
|
||||
[releaseNotesView setPolicyDelegate:nil];
|
||||
[self close];
|
||||
if ([delegate respondsToSelector:@selector(updateAlert:finishedWithChoice:)])
|
||||
[delegate updateAlert:self finishedWithChoice:choice];
|
||||
}
|
||||
|
||||
- (IBAction)installUpdate:sender
|
||||
{
|
||||
[self endWithSelection:SUInstallUpdateChoice];
|
||||
}
|
||||
|
||||
- (IBAction)skipThisVersion:sender
|
||||
{
|
||||
[self endWithSelection:SUSkipThisVersionChoice];
|
||||
}
|
||||
|
||||
- (IBAction)remindMeLater:sender
|
||||
{
|
||||
[self endWithSelection:SURemindMeLaterChoice];
|
||||
}
|
||||
|
||||
- (void)displayReleaseNotes
|
||||
{
|
||||
[[WebPreferences standardPreferences] setStandardFontFamily:[[NSFont systemFontOfSize:8] familyName]];
|
||||
[releaseNotesView setPreferences:[WebPreferences standardPreferences]];
|
||||
[releaseNotesView setFrameLoadDelegate:self];
|
||||
[releaseNotesView setPolicyDelegate:self];
|
||||
|
||||
// Stick a nice big spinner in the middle of the web view until the page is loaded.
|
||||
NSRect frame = [[releaseNotesView superview] frame];
|
||||
releaseNotesSpinner = [[[NSProgressIndicator alloc] initWithFrame:NSMakeRect(NSMidX(frame)-16, NSMidY(frame)-16, 32, 32)] autorelease];
|
||||
[releaseNotesSpinner setStyle:NSProgressIndicatorSpinningStyle];
|
||||
[releaseNotesSpinner startAnimation:self];
|
||||
webViewFinishedLoading = NO;
|
||||
[[releaseNotesView superview] addSubview:releaseNotesSpinner];
|
||||
|
||||
// If there's a release notes URL, load it; otherwise, just stick the contents of the description into the web view.
|
||||
if ([updateItem releaseNotesURL])
|
||||
{
|
||||
[[releaseNotesView mainFrame] loadRequest:[NSURLRequest requestWithURL:[updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[releaseNotesView mainFrame] loadHTMLString:[updateItem description] baseURL:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)showsReleaseNotes
|
||||
{
|
||||
NSNumber *shouldShowReleaseNotes = [hostBundle objectForInfoDictionaryKey:SUShowReleaseNotesKey];
|
||||
if (shouldShowReleaseNotes == nil)
|
||||
return YES; // defaults to YES
|
||||
else
|
||||
return [shouldShowReleaseNotes boolValue];
|
||||
}
|
||||
|
||||
- (BOOL)allowsAutomaticUpdates
|
||||
{
|
||||
if (![[hostBundle objectForInfoDictionaryKey:SUExpectsDSASignatureKey] boolValue])
|
||||
return NO; // Automatic updating requires DSA-signed updates
|
||||
if (![hostBundle objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey])
|
||||
return YES; // defaults to YES
|
||||
return [[hostBundle objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] boolValue];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[[self window] setLevel:NSFloatingWindowLevel];
|
||||
|
||||
// We're gonna do some frame magic to match the window's size to the description field and the presence of the release notes view.
|
||||
NSRect frame = [[self window] frame];
|
||||
|
||||
if (![self showsReleaseNotes])
|
||||
{
|
||||
// Resize the window to be appropriate for not having a huge release notes view.
|
||||
frame.size.height -= [releaseNotesView frame].size.height + 40; // Extra 40 is for the release notes label and margin.
|
||||
[[self window] setShowsResizeIndicator:NO];
|
||||
}
|
||||
|
||||
if (![self allowsAutomaticUpdates])
|
||||
{
|
||||
NSRect boxFrame = [[[releaseNotesView superview] superview] frame];
|
||||
boxFrame.origin.y -= 20;
|
||||
boxFrame.size.height += 20;
|
||||
[[[releaseNotesView superview] superview] setFrame:boxFrame];
|
||||
}
|
||||
|
||||
[[self window] setFrame:frame display:NO];
|
||||
[[self window] center];
|
||||
|
||||
if ([self showsReleaseNotes])
|
||||
{
|
||||
[self displayReleaseNotes];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldClose:note
|
||||
{
|
||||
[self endWithSelection:SURemindMeLaterChoice];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSImage *)applicationIcon
|
||||
{
|
||||
return [hostBundle icon];
|
||||
}
|
||||
|
||||
- (NSString *)titleText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is available!", nil), [hostBundle name]];
|
||||
}
|
||||
|
||||
- (NSString *)descriptionText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available\u2014you have %@. Would you like to download it now?", nil), [hostBundle name], [updateItem displayVersionString], [hostBundle displayVersion]];
|
||||
}
|
||||
|
||||
- (void)webView:(WebView *)sender didFinishLoadForFrame:frame
|
||||
{
|
||||
if ([frame parentFrame] == nil) {
|
||||
webViewFinishedLoading = YES;
|
||||
[releaseNotesSpinner setHidden:YES];
|
||||
[sender display]; // necessary to prevent weird scroll bar artifacting
|
||||
}
|
||||
}
|
||||
|
||||
- (void)webView:sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:frame decisionListener:listener
|
||||
{
|
||||
if (webViewFinishedLoading == YES) {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
|
||||
[listener ignore];
|
||||
}
|
||||
else {
|
||||
[listener use];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// SUUpdateDriver.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/7/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUUPDATEDRIVER_H
|
||||
#define SUUPDATEDRIVER_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SUUpdateDriver : NSObject
|
||||
{
|
||||
BOOL finished;
|
||||
id delegate;
|
||||
}
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hb;
|
||||
- (void)abortUpdate;
|
||||
- (BOOL)finished;
|
||||
|
||||
- delegate;
|
||||
- (void)setDelegate:delegate;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// SUUpdateDriver.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 5/7/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUUpdateDriver.h"
|
||||
|
||||
|
||||
@implementation SUUpdateDriver
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hb
|
||||
{
|
||||
[NSException raise:@"SUAbstractDriverError" format:@"Don't use SUUpdateDriver directly; use a subclass."];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
[self setValue:[NSNumber numberWithBool:YES] forKey:@"finished"];
|
||||
}
|
||||
|
||||
- (BOOL)finished { return finished; }
|
||||
- delegate { return delegate; }
|
||||
- (void)setDelegate:del { delegate = del; }
|
||||
@end
|
||||
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// SUUpdater.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 1/4/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUUPDATER_H
|
||||
#define SUUPDATER_H
|
||||
|
||||
#import "SUUpdateAlert.h"
|
||||
|
||||
@class SUUpdateDriver, SUAppcastItem, SUAppcast;
|
||||
@interface SUUpdater : NSObject {
|
||||
NSTimer *checkTimer;
|
||||
SUUpdateDriver *driver;
|
||||
|
||||
NSBundle *hostBundle;
|
||||
IBOutlet id delegate;
|
||||
}
|
||||
|
||||
+ (SUUpdater *)sharedUpdater;
|
||||
|
||||
- (void)setDelegate:(id)delegate;
|
||||
|
||||
// This IBAction is meant for a main menu item. Hook up any menu item to this action,
|
||||
// and Sparkle will check for updates and report back its findings verbosely.
|
||||
- (IBAction)checkForUpdates:sender;
|
||||
|
||||
// This forces an update to begin with a particular driver (see SU*UpdateDriver.h)
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)driver;
|
||||
|
||||
// For non-.app updates:
|
||||
// Call this when your bundle is loaded to tell Sparkle what to update.
|
||||
- (void)setHostBundle:(NSBundle *)hostBundle;
|
||||
|
||||
// Call this to appropriately reschedule or cancel the update checking timer if preferences for time interval or automatic checks change.
|
||||
// If you're using a .app, this'll be picked up automatically via NSUserDefaultsController, but for non-.apps, there's no way to observe changes.
|
||||
- (void)updatePreferencesChanged;
|
||||
|
||||
- (BOOL)updateInProgress;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUpdaterDelegateInformalProtocol)
|
||||
// This method allows you to add extra parameters to the appcast URL, potentially based on whether or not
|
||||
// Sparkle will also be sending along the system profile. This method should return an array of dictionaries with the following keys:
|
||||
- (NSArray *)feedParametersForHostBundle:(NSBundle *)bundle sendingSystemProfile:(BOOL)sendingProfile;
|
||||
|
||||
// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
|
||||
- (BOOL)shouldPromptForPermissionToCheckForUpdatesToHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// Implement this if you want to do some special handling with the appcast once it finishes loading.
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)appcast forHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
|
||||
// a valid update, if any, in the given appcast.
|
||||
- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// Sent when a valid update is found by the update driver.
|
||||
- (void)didFindValidUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// Sent when a valid update is not found.
|
||||
- (void)didNotFindUpdateToHostBundle:(NSBundle *)hb;
|
||||
|
||||
// Sent when the user makes a choice in the update alert dialog (install now / remind me later / skip this version).
|
||||
- (void)userChoseAction:(SUUpdateAlertChoice)action forUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// Sent immediately before installing the specified update.
|
||||
- (void)updateWillInstall:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
|
||||
|
||||
// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
|
||||
- (BOOL)shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)hostBundle untilInvoking:(NSInvocation *)invocation;
|
||||
|
||||
// Called immediately before relaunching.
|
||||
- (void)updaterWillRelaunchApplication;
|
||||
|
||||
@end
|
||||
|
||||
// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
|
||||
#ifdef DEBUG
|
||||
#define SU_MIN_CHECK_INTERVAL 60
|
||||
#else
|
||||
#define SU_MIN_CHECK_INTERVAL 60*60
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SU_DEFAULT_CHECK_INTERVAL 60
|
||||
#else
|
||||
#define SU_DEFAULT_CHECK_INTERVAL 60*60*24
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,259 +0,0 @@
|
||||
//
|
||||
// SUUpdater.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 1/4/06.
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUUpdater.h"
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
- (NSArray *)feedParameters;
|
||||
- (BOOL)automaticallyUpdates;
|
||||
- (BOOL)shouldScheduleUpdateCheck;
|
||||
- (void)scheduleNextUpdateCheck;
|
||||
- (NSTimeInterval)checkInterval;
|
||||
@end
|
||||
|
||||
@implementation SUUpdater
|
||||
|
||||
#pragma mark Initialization
|
||||
|
||||
static SUUpdater *sharedUpdater = nil;
|
||||
|
||||
// SUUpdater's a singleton now! And I'm enforcing it!
|
||||
// This will probably break the world if you try to write a Sparkle-enabled plugin for a Sparkle-enabled app.
|
||||
+ (SUUpdater *)sharedUpdater
|
||||
{
|
||||
if (sharedUpdater == nil)
|
||||
sharedUpdater = [[[self class] alloc] init];
|
||||
return sharedUpdater;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (sharedUpdater)
|
||||
{
|
||||
[self release];
|
||||
self = sharedUpdater;
|
||||
}
|
||||
else if (self != nil)
|
||||
{
|
||||
sharedUpdater = self;
|
||||
[self setHostBundle:[NSBundle mainBundle]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:NSApp];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:[@"values." stringByAppendingString:SUScheduledCheckIntervalKey] options:0 context:NULL];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:[@"values." stringByAppendingString:SUEnableAutomaticChecksKey] options:0 context:NULL];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
||||
{
|
||||
// If the user has been asked about automatic checks and said no, get out of here.
|
||||
if ([[SUUserDefaults standardUserDefaults] objectForKey:SUEnableAutomaticChecksKey] &&
|
||||
[[SUUserDefaults standardUserDefaults] boolForKey:SUEnableAutomaticChecksKey] == NO) { return; }
|
||||
|
||||
// Does the delegate want to take care of the logic for when we should ask permission to update?
|
||||
if ([delegate respondsToSelector:@selector(shouldPromptForPermissionToCheckForUpdatesToHostBundle)])
|
||||
{
|
||||
if ([delegate shouldPromptForPermissionToCheckForUpdatesToHostBundle:hostBundle])
|
||||
[SUUpdatePermissionPrompt promptWithHostBundle:hostBundle delegate:self];
|
||||
}
|
||||
// Has he been asked already? And don't ask if the host has a default value set in its Info.plist.
|
||||
else if ([[SUUserDefaults standardUserDefaults] objectForKey:SUEnableAutomaticChecksKey] == nil &&
|
||||
[hostBundle objectForInfoDictionaryKey:SUEnableAutomaticChecksKey] == nil)
|
||||
{
|
||||
if ([[SUUserDefaults standardUserDefaults] objectForKey:SUEnableAutomaticChecksKeyOld])
|
||||
[[SUUserDefaults standardUserDefaults] setBool:[[SUUserDefaults standardUserDefaults] boolForKey:SUEnableAutomaticChecksKeyOld] forKey:SUEnableAutomaticChecksKey];
|
||||
// Now, we don't want to ask the user for permission to do a weird thing on the first launch.
|
||||
// We wait until the second launch.
|
||||
else if ([[SUUserDefaults standardUserDefaults] boolForKey:SUHasLaunchedBeforeKey] == NO)
|
||||
[[SUUserDefaults standardUserDefaults] setBool:YES forKey:SUHasLaunchedBeforeKey];
|
||||
else
|
||||
[SUUpdatePermissionPrompt promptWithHostBundle:hostBundle delegate:self];
|
||||
}
|
||||
|
||||
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
|
||||
- (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result
|
||||
{
|
||||
BOOL automaticallyCheck = (result == SUAutomaticallyCheck);
|
||||
[[SUUserDefaults standardUserDefaults] setBool:automaticallyCheck forKey:SUEnableAutomaticChecksKey];
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
|
||||
- (void)scheduleNextUpdateCheck
|
||||
{
|
||||
@synchronized (checkTimer)
|
||||
{
|
||||
if (checkTimer)
|
||||
{
|
||||
[checkTimer invalidate];
|
||||
checkTimer = nil;
|
||||
}
|
||||
}
|
||||
if (![self shouldScheduleUpdateCheck]) return;
|
||||
|
||||
// How long has it been since last we checked for an update?
|
||||
NSDate *lastCheckDate = [[SUUserDefaults standardUserDefaults] objectForKey:SULastCheckTimeKey];
|
||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||
NSTimeInterval intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
||||
|
||||
// Now we want to figure out how long until we check again.
|
||||
NSTimeInterval delayUntilCheck;
|
||||
if (intervalSinceCheck < [self checkInterval])
|
||||
delayUntilCheck = ([self checkInterval] - intervalSinceCheck); // It hasn't been long enough.
|
||||
else
|
||||
delayUntilCheck = 0; // We're overdue! Run one now.
|
||||
checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesInBackground
|
||||
{
|
||||
[self checkForUpdatesWithDriver:[[[([self automaticallyUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] init] autorelease]];
|
||||
}
|
||||
|
||||
- (IBAction)checkForUpdates:sender
|
||||
{
|
||||
[self checkForUpdatesWithDriver:[[[SUUserInitiatedUpdateDriver alloc] init] autorelease]];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)d
|
||||
{
|
||||
if ([self updateInProgress]) { return; }
|
||||
@synchronized (checkTimer) { if (checkTimer) { [checkTimer invalidate]; checkTimer = nil; } }
|
||||
|
||||
// A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds).
|
||||
NSString *appcastString = [[SUUserDefaults standardUserDefaults] objectForKey:SUFeedURLKey];
|
||||
if (!appcastString)
|
||||
appcastString = [hostBundle objectForInfoDictionaryKey:SUFeedURLKey];
|
||||
if (!appcastString)
|
||||
[NSException raise:@"SUNoFeedURL" format:@"You must specify the URL of the appcast as the SUFeedURLKey in either the Info.plist or the user defaults!"];
|
||||
NSCharacterSet* quoteSet = [NSCharacterSet characterSetWithCharactersInString: @"\"\'"]; // Some feed publishers add quotes; strip 'em.
|
||||
NSURL *feedURL = [[NSURL URLWithString:[appcastString stringByTrimmingCharactersInSet:quoteSet]] URLWithParameters:[self feedParameters]];
|
||||
|
||||
driver = [d retain];
|
||||
if ([driver delegate] == nil) { [driver setDelegate:delegate]; }
|
||||
[driver addObserver:self forKeyPath:@"finished" options:0 context:NULL];
|
||||
[driver checkForUpdatesAtURL:feedURL hostBundle:hostBundle];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if (object == driver && [keyPath isEqualToString:@"finished"])
|
||||
{
|
||||
[driver removeObserver:self forKeyPath:@"finished"];
|
||||
[driver release]; driver = nil;
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
else if (object == [NSUserDefaultsController sharedUserDefaultsController] && ([keyPath hasSuffix:SUScheduledCheckIntervalKey] || [keyPath hasSuffix:SUEnableAutomaticChecksKey]))
|
||||
{
|
||||
[self updatePreferencesChanged];
|
||||
}
|
||||
else
|
||||
{
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updatePreferencesChanged
|
||||
{
|
||||
[self scheduleNextUpdateCheck];
|
||||
}
|
||||
|
||||
- (BOOL)shouldScheduleUpdateCheck
|
||||
{
|
||||
// Breaking this down for readability:
|
||||
// If the user says he wants automatic update checks, let's do it.
|
||||
if ([[SUUserDefaults standardUserDefaults] boolForKey:SUEnableAutomaticChecksKey] == YES)
|
||||
return YES;
|
||||
// If the user hasn't said anything, but the developer says we should do it, let's do it.
|
||||
if ([[SUUserDefaults standardUserDefaults] objectForKey:SUEnableAutomaticChecksKey] == nil &&
|
||||
[[hostBundle objectForInfoDictionaryKey:SUEnableAutomaticChecksKey] boolValue] == YES)
|
||||
return YES;
|
||||
return NO; // Otherwise, don't bother.
|
||||
}
|
||||
|
||||
- (BOOL)automaticallyUpdates
|
||||
{
|
||||
// If the SUAllowsAutomaticUpdatesKey exists and is set to NO, return NO.
|
||||
if ([hostBundle objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] &&
|
||||
[[hostBundle objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] boolValue] == NO)
|
||||
return NO;
|
||||
|
||||
// If we're not using DSA signatures, we aren't going to trust any updates automatically.
|
||||
if ([[hostBundle objectForInfoDictionaryKey:SUExpectsDSASignatureKey] boolValue] != YES)
|
||||
return NO;
|
||||
|
||||
// If there's no setting, or it's set to no, we're not automatically updating.
|
||||
if ([[SUUserDefaults standardUserDefaults] boolForKey:SUAutomaticallyUpdateKey] != YES)
|
||||
return NO;
|
||||
|
||||
return YES; // Otherwise, we're good to go.
|
||||
}
|
||||
|
||||
- (NSArray *)feedParameters
|
||||
{
|
||||
BOOL sendingSystemProfile = ([[SUUserDefaults standardUserDefaults] boolForKey:SUSendProfileInfoKey] == YES);
|
||||
NSArray *parameters = [NSArray array];
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForHostBundle:sendingSystemProfile:)])
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForHostBundle:hostBundle sendingSystemProfile:sendingSystemProfile]];
|
||||
if (sendingSystemProfile)
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[hostBundle systemProfile]];
|
||||
return parameters;
|
||||
}
|
||||
|
||||
- (NSTimeInterval)checkInterval
|
||||
{
|
||||
NSTimeInterval checkInterval = 0;
|
||||
// Find the stored check interval. User defaults override Info.plist.
|
||||
if ([[SUUserDefaults standardUserDefaults] objectForKey:SUScheduledCheckIntervalKey])
|
||||
checkInterval = [[[SUUserDefaults standardUserDefaults] objectForKey:SUScheduledCheckIntervalKey] doubleValue];
|
||||
else if ([hostBundle objectForInfoDictionaryKey:SUScheduledCheckIntervalKey])
|
||||
checkInterval = [[hostBundle objectForInfoDictionaryKey:SUScheduledCheckIntervalKey] doubleValue];
|
||||
|
||||
if (checkInterval < SU_MIN_CHECK_INTERVAL) // This can also mean one that isn't set.
|
||||
checkInterval = SU_DEFAULT_CHECK_INTERVAL;
|
||||
return checkInterval;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[hostBundle release];
|
||||
[delegate release];
|
||||
if (checkTimer) { [checkTimer invalidate]; }
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
if ([item action] == @selector(checkForUpdates:))
|
||||
return ![self updateInProgress];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setDelegate:aDelegate
|
||||
{
|
||||
delegate = aDelegate;
|
||||
}
|
||||
|
||||
- (void)setHostBundle:(NSBundle *)hb
|
||||
{
|
||||
if (hostBundle == hb) return;
|
||||
[hostBundle release];
|
||||
hostBundle = [hb retain];
|
||||
[[SUUserDefaults standardUserDefaults] setIdentifier:[hostBundle bundleIdentifier]];
|
||||
}
|
||||
|
||||
- (BOOL)updateInProgress
|
||||
{
|
||||
return driver && ([driver finished] == NO);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// SUUserDefaults.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 12/21/07.
|
||||
// Copyright 2007 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUUSERDEFAULTS_H
|
||||
#define SUUSERDEFAULTS_H
|
||||
|
||||
/*!
|
||||
@class
|
||||
@abstract A substitute for NSUserDefaults that will work with arbitrary bundle identifiers.
|
||||
@discussion Make sure you call -setIdentifier: before using SUUserDefaults. The other methods in this class work just like those in NSUserDefaults.
|
||||
*/
|
||||
|
||||
@interface SUUserDefaults : NSObject {
|
||||
NSString *identifier;
|
||||
}
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Returns a singleton instance of the user defaults class.
|
||||
*/
|
||||
+ (SUUserDefaults *)standardUserDefaults;
|
||||
|
||||
/*!
|
||||
@method
|
||||
@abstract Sets which bundle identifier to use when setting and retrieving defaults.
|
||||
@discussion It is imperative that you set the identifier through this method before trying to set or retrieve defaults.
|
||||
*/
|
||||
- (void)setIdentifier:(NSString *)identifier;
|
||||
|
||||
- (id)objectForKey:(NSString *)defaultName;
|
||||
- (void)setObject:(id)value forKey:(NSString *)defaultName;
|
||||
- (BOOL)boolForKey:(NSString *)defaultName;
|
||||
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,97 +0,0 @@
|
||||
//
|
||||
// SUUserDefaults.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 12/21/07.
|
||||
// Copyright 2007 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Sparkle.h"
|
||||
#import "SUUserDefaults.h"
|
||||
|
||||
@implementation SUUserDefaults
|
||||
|
||||
+ (SUUserDefaults *)standardUserDefaults
|
||||
{
|
||||
static SUUserDefaults *standardUserDefaults = nil;
|
||||
if (standardUserDefaults == nil)
|
||||
standardUserDefaults = [[SUUserDefaults alloc] init];
|
||||
return standardUserDefaults;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[identifier release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setIdentifier:(NSString *)anIdentifier
|
||||
{
|
||||
if (identifier != anIdentifier)
|
||||
{
|
||||
[identifier release];
|
||||
identifier = [anIdentifier copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)verifyIdentifier
|
||||
{
|
||||
if (identifier == nil)
|
||||
[NSException raise:@"SUUserDefaultsMissingIdentifier" format:@"You must set the SUUserDefaults identifier before using it."];
|
||||
}
|
||||
|
||||
- (id)objectForKey:(NSString *)defaultName
|
||||
{
|
||||
[self verifyIdentifier];
|
||||
CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)identifier);
|
||||
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistratioDomain, so anything
|
||||
// passed into -[NSUserDefaults registerDefaults:] is ignored. The following line falls
|
||||
// back to using NSUserDefaults, but only if the host bundle is the main bundle, and no value
|
||||
// is found elsewhere.
|
||||
if (obj == NULL && [identifier isEqualToString:[[NSBundle mainBundle] bundleIdentifier]])
|
||||
obj = [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050
|
||||
return [NSMakeCollectable(obj) autorelease];
|
||||
#else
|
||||
return [(id)obj autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)setObject:(id)value forKey:(NSString *)defaultName;
|
||||
{
|
||||
[self verifyIdentifier];
|
||||
CFPreferencesSetValue((CFStringRef)defaultName, value, (CFStringRef)identifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
CFPreferencesSynchronize((CFStringRef)identifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
// If anything's bound to this through an NSUserDefaultsController, it won't know that anything's changed.
|
||||
// We can't get an NSUserDefaults object for anything other than the standard one for the app, so this won't work for bundles.
|
||||
// But it's the best we can do: this will make NSUserDefaultsControllers know about the changes that have been made.
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (BOOL)boolForKey:(NSString *)defaultName
|
||||
{
|
||||
BOOL value;
|
||||
[self verifyIdentifier];
|
||||
CFPropertyListRef plr = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)identifier);
|
||||
if (plr == NULL)
|
||||
value = NO;
|
||||
else {
|
||||
value = (BOOL)CFBooleanGetValue((CFBooleanRef)plr);
|
||||
CFRelease(plr);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)setBool:(BOOL)value forKey:(NSString *)defaultName
|
||||
{
|
||||
[self verifyIdentifier];
|
||||
CFPreferencesSetValue((CFStringRef)defaultName, (CFBooleanRef)[NSNumber numberWithBool:value], (CFStringRef)identifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
CFPreferencesSynchronize((CFStringRef)identifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
// If anything's bound to this through an NSUserDefaultsController, it won't know that anything's changed.
|
||||
// We can't get an NSUserDefaults object for anything other than the standard one for the app, so this won't work for bundles.
|
||||
// But it's the best we can do: this will make NSUserDefaultsControllers know about the changes that have been made.
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
@end
|
||||