|
31 | 31 |
|
32 | 32 | import cc.arduino.Constants; |
33 | 33 | import cc.arduino.contributions.DownloadableContribution; |
34 | | -import cc.arduino.contributions.SignatureVerificationFailedException; |
35 | 34 | import cc.arduino.contributions.SignatureVerifier; |
36 | 35 | import com.fasterxml.jackson.core.JsonProcessingException; |
37 | 36 | import com.fasterxml.jackson.databind.DeserializationFeature; |
38 | 37 | import com.fasterxml.jackson.databind.ObjectMapper; |
39 | 38 | import com.fasterxml.jackson.module.mrbean.MrBeanModule; |
40 | 39 | import org.apache.commons.compress.utils.IOUtils; |
| 40 | + |
| 41 | +import processing.app.BaseNoGui; |
41 | 42 | import processing.app.Platform; |
42 | 43 | import processing.app.PreferencesData; |
43 | 44 | import processing.app.debug.TargetPackage; |
@@ -86,15 +87,21 @@ public void parseIndex() throws Exception { |
86 | 87 | File defaultIndexFile = getIndexFile(Constants.DEFAULT_INDEX_FILE_NAME); |
87 | 88 | if (defaultIndexFile.exists()) { |
88 | 89 | // Check main index signature |
89 | | - if (!signatureVerifier.isSigned(defaultIndexFile)) { |
90 | | - if (PreferencesData.areInsecurePackagesAllowed()) { |
91 | | - System.err.println(format(tr("Warning: forced trusting untrusted contributions"))); |
92 | | - } else { |
93 | | - throw new SignatureVerificationFailedException(Constants.DEFAULT_INDEX_FILE_NAME); |
94 | | - } |
| 90 | + if (signatureVerifier.isSigned(defaultIndexFile)) { |
| 91 | + mergeContributions(defaultIndexFile); |
| 92 | + } else if (PreferencesData.areInsecurePackagesAllowed()) { |
| 93 | + System.err.println(format(tr("Warning: forced trusting untrusted contributions"))); |
| 94 | + mergeContributions(defaultIndexFile); |
| 95 | + } else { |
| 96 | + BaseNoGui |
| 97 | + .showWarning(Constants.DEFAULT_INDEX_FILE_NAME, |
| 98 | + tr("A package index has an invalid signature and needs to be updated.\n" |
| 99 | + + "Please open the Board Manager from the menu\n" |
| 100 | + + "\n" // |
| 101 | + + " Tools -> Board -> Board Manager\n" |
| 102 | + + "\nto update it"), |
| 103 | + null); |
95 | 104 | } |
96 | | - |
97 | | - mergeContributions(defaultIndexFile); |
98 | 105 | } |
99 | 106 |
|
100 | 107 | // Set main and bundled indexes as trusted |
|
0 commit comments