@@ -28,6 +28,7 @@ function string_is_plain_ascii(s) {
28
28
var stored_sites = { } ,
29
29
username = "" ,
30
30
key_id ,
31
+ alg_max_version ,
31
32
alg_min_version = 1 ;
32
33
33
34
function save_sites_to_backend ( ) {
@@ -125,10 +126,12 @@ window.addEventListener('masterpassword-configload', function(e){
125
126
stored_sites = e . detail . sites ;
126
127
username = e . detail . username ;
127
128
key_id = e . detail . key_id ;
129
+ alg_max_version = e . detail . max_alg_version ;
128
130
129
131
if ( ! string_is_plain_ascii ( username ) ) {
130
- alg_min_version = 3 ;
131
- $ ( '#ver3note' ) . show ( ) ;
132
+ alg_min_version = Math . min ( 3 , alg_max_version ) ;
133
+ if ( alg_min_version > 2 )
134
+ $ ( '#ver3note' ) . show ( ) ;
132
135
}
133
136
134
137
$ . each ( stored_sites , function ( domain , v ) {
@@ -242,7 +245,7 @@ $(document).on('drop', function(e){
242
245
} ) ;
243
246
244
247
$ ( 'body' ) . on ( 'click' , '.export_mpsites' , function ( ) {
245
- start_data_download ( make_mpsites ( stored_sites , alg_min_version ) , 'firefox.mpsites' ) ;
248
+ start_data_download ( make_mpsites ( stored_sites , alg_min_version , alg_max_version ) , 'firefox.mpsites' ) ;
246
249
} ) ;
247
250
248
251
function pad_left ( len , s , chr ) {
@@ -268,7 +271,7 @@ function pad_left(len, s, chr) {
268
271
}
269
272
}
270
273
271
- function make_mpsites ( stored_sites , alg_min_version ) {
274
+ function make_mpsites ( stored_sites , alg_min_version , alg_version ) {
272
275
var a = [ '# Master Password site export\n' ,
273
276
'# Export of site names and stored passwords (unless device-private) encrypted with the master key.\n' ,
274
277
'#\n' ,
@@ -280,7 +283,7 @@ function make_mpsites(stored_sites, alg_min_version) {
280
283
'# Avatar: 0\n' ,
281
284
'# Key ID: ' + key_id + '\n' ,
282
285
'# Version: 2.2\n' ,
283
- '# Algorithm: 3 \n' ,
286
+ '# Algorithm: ' + alg_version + ' \n',
284
287
'# Default Type: 17\n' ,
285
288
'# Passwords: PROTECTED\n' ,
286
289
'##\n' ,
0 commit comments