diff options
Diffstat (limited to 'src/updater.c')
-rw-r--r-- | src/updater.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/updater.c b/src/updater.c new file mode 100644 index 00000000..706de31d --- /dev/null +++ b/src/updater.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* Copyright 2021 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
23 | #include "updater.h" | ||
24 | |||
25 | #if defined (LAGRANGE_ENABLE_WINSPARKLE) | ||
26 | #include <time.h> | ||
27 | #include <winsparkle.h> | ||
28 | |||
29 | static const char *signaturePublicKeyPem_ = | ||
30 | "-----BEGIN PUBLIC KEY-----\n" | ||
31 | "MIIGRjCCBDkGByqGSM44BAEwggQsAoICAQC0jSisyaT6q6qqjmlWFfFDOs66EfC7\n" | ||
32 | "78ATFlhl63otIed7oeyg2Q0BFB2bdGMpJbivu/jFjaZglz7YpKLhLHiUb3Fn10lz\n" | ||
33 | "V3WwaXXmbdwSuYH1zceIptho6crWgkZcSwGer+/I3twDxIe0XhGEG7quh7ukJsh/\n" | ||
34 | "hh9LgeIgNsVDdKRyJEs24ZQD44rQwb3hY19JCEzdd/S4FZwLbNeXwrPBPdzUO7JT\n" | ||
35 | "KmhMJJbQbhb1iNyqClCl5VQM0w5cI3L+k3fcBcUgsEh2kJHsH8ezATDH8Ltmvkmz\n" | ||
36 | "L8bhVLLHlGl0jvHfKHjINz9p/Ur+ifcFmwCWTmd61ZhEKcBpK0jEkE5ZwXzIZ3pJ\n" | ||
37 | "AAen0Nr0Y6x7rK5AU630wkQbD7M6W5QOys+9FPuIGW/q0nk80TKFR4ElVc0CVF0t\n" | ||
38 | "nOGa6lu6uaIkgKN+ePXUwSUFvYNOC/3ILURq9JnAPPGXwgIsOUTPtzPcBOfH24sy\n" | ||
39 | "HhImEaAZPdsx2eTiJv2zFwF0k5H/kPHQgyr+5dPaYSt+9yeObF4zQ7S/raqCRE/d\n" | ||
40 | "eT29MkwkGugXnljbSi0cjn1MCw9wQqLLwcea6KRWASzPmMMT8Ratrm1QWNvmPOaK\n" | ||
41 | "nijP+EVMPztnU4G3BAei7lnw8G3us+z0GzZ6RBR7siR4RIi4C7bngXygOYI7ekPT\n" | ||
42 | "WZui90VHORz3mQIhAJ7rakeaAPmDryZAHO9Ff2OmRibCO6WRrk16Z1m5lYU7AoIC\n" | ||
43 | "AEh0FdkF6OWNK1F44o9CKvE+vOr9SXu/gJ9JLm30Cfq/LPQ3lgOl13hYzAje/F8p\n" | ||
44 | "OATT0N0zkm3FmI7Kbw3ovUQ/Lot+UCvuv9ViIG98GZUldTyytKx3tRyuuRmXK3lS\n" | ||
45 | "7ugvt+XXo5sA9a3t6TJWMFJJCBRO+uizUs0m4uxb+rWnWv+AAUKDL/etbHxxKzo+\n" | ||
46 | "dIYRLgIaJtValVSkkik27Tw20+KEWKyy0H7EinIxn2iFVQ41j2jDwji931HJR5zI\n" | ||
47 | "fX0JG5nqcyfNj4m6o36n0yshAs13dJqyZiB4Y6pWb8TJf9GgnceBTWCIXH2nlL/C\n" | ||
48 | "UloCoVLfOTZ1hT4p1Wbou+5zlxwBS8/nZaiXecWm9srKDIwSB6zYLK9b2Eord197\n" | ||
49 | "34R0LKW9PsyHxnJvkip0oN4Fp9CltuN9VFbkc1k1nEiZh+etnh+m4eWnC5tzBGRx\n" | ||
50 | "Hh4GvKkVV43cIdIle4ht0Gt/6ex3bFAVmMmV4Z8767CnXJ9HPlksqQYRyLoolrJ0\n" | ||
51 | "X6GQ+8jZFaY36f+ViejbS7pHUl8s3OESfCAYwbipjSQZyPz+kfLjueEp0Klh7BHa\n" | ||
52 | "uRHHfM2FsxSkk+DO9fMUGNluC+5qvneccd7NvFfuPPgcD3OU9WBqKUfuKyXpkSMx\n" | ||
53 | "W1Oo5SqXi1sHirs3r6GFXqtW2LR+PD9Ve78L3Yd5rv9mA4ICBQACggIAPsdNd6rA\n" | ||
54 | "IlX1YI3OXyY+CVPJYBoAySWNa5H8JHEYC8ui4OB8gyge3S6utoF6m9lgU3evjqXy\n" | ||
55 | "dRYI/st6Eb5NESFrKPn1eH4r+2kU/34hshEA0yGjNGWzoXnhDCusGWGiZwq+Rr3v\n" | ||
56 | "Q5vI8T8lsnYuplCPGnoWJzq1niCPobVydog1lmZ396ARErGrPZxzM7ab8EY2BNSj\n" | ||
57 | "pcA1wYwuGGJIvCRLDxqaUlTbIdTP/QzIKQAHoFCtJetOmS5ovCyz9Zr+4fC/SFtq\n" | ||
58 | "G1BjTodIhQFrreGMwl3VtIOnrCUI430BxEPMsDWgZzgx5JgMwmgIVFul47MoulVE\n" | ||
59 | "gcz6sNKVuRXYhRTq8V6hZOamOT1VqZQb+dqQqDZ5p265VOgz71z1CgTF9FnRV04z\n" | ||
60 | "qhlWHHnxMEaQYZWlvw8zlXRNBqjHQyOHhOE9nsrNpTsFqnImBpO0s9UJxTRWNnf/\n" | ||
61 | "hLrzuOBQoDlOcE4yBR1mRymJQ9xHFzEI4yxP9Vg7RTEkMhhk1vlqPWvuIyv4gCCm\n" | ||
62 | "7btKMnYNL99cMAjhgyDyh7mAOfOWv5rAgzDIMViRO+U7EZ+ZRR+ovnuWMMn1OZAA\n" | ||
63 | "aXDKDVffI0NSO+Aw3EDAL4LfZsOBkDS2N/2ESR+EoBtYqoI7YJ3iu1iEHp8WxCyA\n" | ||
64 | "4YdR7KTyioKNHjvC5EG2bvHtYfw6ng6zSOY=\n" | ||
65 | "-----END PUBLIC KEY-----"; | ||
66 | |||
67 | void init_Updater(void) { | ||
68 | win_sparkle_set_appcast_url("https://etc.skyjake.fi/lagrange/appcast-windows.xml"); | ||
69 | win_sparkle_set_dsa_pub_pem(signaturePublicKeyPem_); | ||
70 | win_sparkle_init(); | ||
71 | } | ||
72 | |||
73 | void deinit_Updater(void) { | ||
74 | win_sparkle_cleanup(); | ||
75 | } | ||
76 | |||
77 | void checkNow_Updater(void) { | ||
78 | win_sparkle_check_update_with_ui(); | ||
79 | } | ||
80 | |||
81 | #else | ||
82 | /* dummy as a fallback */ | ||
83 | void init_Updater(void) {} | ||
84 | void deinit_Updater(void) {} | ||
85 | void checkNow_Updater(void) {} | ||
86 | #endif | ||