@@ -18,6 +18,7 @@ <h3>Configuration</h3>
18
18
< option value ="local "> {{hostname}}</ option >
19
19
< option value ="rsync "> rsync</ option >
20
20
< option value ="s3 "> Amazon S3</ option >
21
+ < option value ="b2 "> Backblaze B2</ option >
21
22
</ select >
22
23
</ div >
23
24
</ div >
@@ -111,6 +112,31 @@ <h3>Configuration</h3>
111
112
< input type ="text " class ="form-control " rows ="1 " id ="backup-target-pass ">
112
113
</ div >
113
114
</ div >
115
+ <!-- Backblaze -->
116
+ < div class ="form-group backup-target-b2 ">
117
+ < div class ="col-sm-10 col-sm-offset-2 ">
118
+ < p > Backups are stored in a < a href ="https://www.backblaze.com/ " target ="_blank " rel ="noreferrer "> Backblaze</ a > B2 bucket. You must have a Backblaze account already.</ p >
119
+ < p > You MUST manually copy the encryption password from < tt class ="backup-encpassword-file "> </ tt > to a safe and secure location. You will need this file to decrypt backup files. It is NOT stored in your Backblaze B2 bucket.</ p >
120
+ </ div >
121
+ </ div >
122
+ < div class ="form-group backup-target-b2 ">
123
+ < label for ="backup-target-b2-user " class ="col-sm-2 control-label "> B2 Application KeyID</ label >
124
+ < div class ="col-sm-8 ">
125
+ < input type ="text " class ="form-control " rows ="1 " id ="backup-target-b2-user ">
126
+ </ div >
127
+ </ div >
128
+ < div class ="form-group backup-target-b2 ">
129
+ < label for ="backup-target-b2-pass " class ="col-sm-2 control-label "> B2 Application Key</ label >
130
+ < div class ="col-sm-8 ">
131
+ < input type ="text " class ="form-control " rows ="1 " id ="backup-target-b2-pass ">
132
+ </ div >
133
+ </ div >
134
+ < div class ="form-group backup-target-b2 ">
135
+ < label for ="backup-target-b2-bucket " class ="col-sm-2 control-label "> B2 Bucket</ label >
136
+ < div class ="col-sm-8 ">
137
+ < input type ="text " class ="form-control " rows ="1 " id ="backup-target-b2-bucket ">
138
+ </ div >
139
+ </ div >
114
140
<!-- Common -->
115
141
< div class ="form-group backup-target-local backup-target-rsync backup-target-s3 ">
116
142
< label for ="min-age " class ="col-sm-2 control-label "> Retention Days:</ label >
@@ -144,7 +170,7 @@ <h3>Available backups</h3>
144
170
145
171
function toggle_form ( ) {
146
172
var target_type = $ ( "#backup-target-type" ) . val ( ) ;
147
- $ ( ".backup-target-local, .backup-target-rsync, .backup-target-s3" ) . hide ( ) ;
173
+ $ ( ".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2 " ) . hide ( ) ;
148
174
$ ( ".backup-target-" + target_type ) . show ( ) ;
149
175
150
176
init_inputs ( target_type ) ;
@@ -215,7 +241,7 @@ <h3>Available backups</h3>
215
241
}
216
242
217
243
function show_custom_backup ( ) {
218
- $ ( ".backup-target-local, .backup-target-rsync, .backup-target-s3" ) . hide ( ) ;
244
+ $ ( ".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2 " ) . hide ( ) ;
219
245
api (
220
246
"/system/backup/config" ,
221
247
"GET" ,
@@ -245,6 +271,15 @@ <h3>Available backups</h3>
245
271
var host = hostpath . shift ( ) ;
246
272
$ ( "#backup-target-s3-host" ) . val ( host ) ;
247
273
$ ( "#backup-target-s3-path" ) . val ( hostpath . join ( '/' ) ) ;
274
+ } else if ( r . target . substring ( 0 , 5 ) == "b2://" ) {
275
+ $ ( "#backup-target-type" ) . val ( "b2" ) ;
276
+ var targetPath = r . target . substring ( 5 ) ;
277
+ var b2_application_keyid = targetPath . split ( ':' ) [ 0 ] ;
278
+ var b2_applicationkey = targetPath . split ( ':' ) [ 1 ] . split ( '@' ) [ 0 ] ;
279
+ var b2_bucket = targetPath . split ( '@' ) [ 1 ] ;
280
+ $ ( "#backup-target-b2-user" ) . val ( b2_application_keyid ) ;
281
+ $ ( "#backup-target-b2-pass" ) . val ( b2_applicationkey ) ;
282
+ $ ( "#backup-target-b2-bucket" ) . val ( b2_bucket ) ;
248
283
}
249
284
toggle_form ( )
250
285
} )
@@ -264,6 +299,11 @@ <h3>Available backups</h3>
264
299
target = "rsync://" + $ ( "#backup-target-rsync-user" ) . val ( ) + "@" + $ ( "#backup-target-rsync-host" ) . val ( )
265
300
+ "/" + $ ( "#backup-target-rsync-path" ) . val ( ) ;
266
301
target_user = '' ;
302
+ } else if ( target_type == "b2" ) {
303
+ target = 'b2://' + $ ( '#backup-target-b2-user' ) . val ( ) + ':' + $ ( '#backup-target-b2-pass' ) . val ( )
304
+ + '@' + $ ( '#backup-target-b2-bucket' ) . val ( )
305
+ target_user = '' ;
306
+ target_pass = '' ;
267
307
}
268
308
269
309
@@ -303,4 +343,4 @@ <h3>Available backups</h3>
303
343
set_host ( $ ( '#backup-target-s3-host-select' ) . val ( ) ) ;
304
344
}
305
345
}
306
- </ script >
346
+ </ script >
0 commit comments