@@ -23,10 +23,10 @@ const SettingsEditor = (() => {
23
23
let beforeEditingPreferences ;
24
24
const scratchPath = `${ app . getPath ( 'userData' ) } /scratch-settings.json` ;
25
25
26
- let dontNeedStore = ( preferences ) => {
26
+ const dontNeedStoreFile = ( preferences ) => {
27
27
if ( ! preferences . networking . trustStoreType )
28
28
return true ;
29
- if ( ! preferences . networking . trustStoreType === '' )
29
+ if ( preferences . networking . trustStoreType === '' )
30
30
return true ;
31
31
if ( / ^ W i n d o w s - [ A - Z ] + $ / . test ( preferences . networking . trustStoreType ) )
32
32
return true ;
@@ -35,6 +35,13 @@ const SettingsEditor = (() => {
35
35
return false ;
36
36
} ;
37
37
38
+ function trustStoreTypeRequiresStore ( ) {
39
+ // This looks a little weird, but this is how the "hide function" is
40
+ // invoked in electron-preferences and this is a quick way of sharing
41
+ // the code.
42
+ return ! dontNeedStoreFile ( preferences . _preferences ) ;
43
+ }
44
+
38
45
function load ( ) {
39
46
const path = ConfigJSON . getPath ( ) ;
40
47
let data = { } ;
@@ -58,8 +65,8 @@ const SettingsEditor = (() => {
58
65
else if ( key === 'javax.net.ssl.trustStore' ) {
59
66
preferences . value ( 'networking.trustStore' , data [ key ] ) ;
60
67
}
61
- else if ( key === 'javax.net.ssl.trustStoreKey ' ) {
62
- preferences . value ( 'networking.trustStoreKey ' , data [ key ] ) ;
68
+ else if ( key === 'javax.net.ssl.trustStorePassword ' ) {
69
+ preferences . value ( 'networking.trustStorePassword ' , data [ key ] ) ;
63
70
}
64
71
else if ( key === 'console.connectTimeoutMillis' ) {
65
72
preferences . value ( 'networking.connectTimeoutMillis' , data [ key ] ) ;
@@ -90,10 +97,10 @@ const SettingsEditor = (() => {
90
97
const path = ConfigJSON . getPath ( ) ;
91
98
let data = { } ;
92
99
addValue ( data , 'proxy' , preferences . value ( 'networking.proxy' ) ) ;
93
- if ( ! dontNeedStore ) {
94
- addValue ( data , 'javax.net.ssl.trustStoreType' , preferences . value ( 'networking.trustStoreType' ) ) ;
100
+ addValue ( data , 'javax.net.ssl.trustStoreType' , preferences . value ( 'networking.trustStoreType' ) ) ;
101
+ if ( trustStoreTypeRequiresStore ( ) ) {
95
102
addValue ( data , 'javax.net.ssl.trustStore' , preferences . value ( 'networking.trustStore' ) ) ;
96
- addValue ( data , 'javax.net.ssl.trustStoreKey ' , preferences . value ( 'networking.trustStoreKey ' ) ) ;
103
+ addValue ( data , 'javax.net.ssl.trustStorePassword ' , preferences . value ( 'networking.trustStorePassword ' ) ) ;
97
104
}
98
105
addValue ( data , 'console.connectTimeoutMillis' , preferences . value ( 'networking.connectTimeoutMillis' ) ) ;
99
106
addValue ( data , 'console.readTimeoutMillis' , preferences . value ( 'networking.readTimeoutMillis' ) ) ;
@@ -207,13 +214,13 @@ const SettingsEditor = (() => {
207
214
key : 'trustStore' ,
208
215
buttonLabel : `${ I18NUtils . get ( 'wrc-electron.menus.settings.trust-store.path.button.label' ) } ` ,
209
216
type : 'file' ,
210
- hideFunction : dontNeedStore
217
+ hideFunction : dontNeedStoreFile
211
218
} ,
212
219
{
213
220
label : `${ I18NUtils . get ( 'wrc-electron.menus.settings.trust-store.key.label' ) } ` ,
214
- key : 'trustStoreKey ' ,
221
+ key : 'trustStorePassword ' ,
215
222
type : 'text' ,
216
- hideFunction : dontNeedStore
223
+ hideFunction : dontNeedStoreFile
217
224
} ,
218
225
{
219
226
label : `${ I18NUtils . get ( 'wrc-electron.menus.settings.connect-timeout.label' ) } ` ,
0 commit comments