1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-25 19:17:22 +01:00

Finalized B2 Storage backend.

Finalized the work needed on the backup script for B2 Storage, and fixed
a couple issues with the UI.
This commit is contained in:
Carson Page
2017-10-17 11:34:35 -05:00
parent aa09a46ee0
commit 0397480f50
2 changed files with 33 additions and 17 deletions

View File

@@ -121,13 +121,13 @@
<div class="form-group backup-target-b2">
<label for="backup-target-user" class="col-sm-2 control-label">B2 Account Id</label>
<div class="col-sm-8">
<input type="text" class="form-control" rows="1" id="backup-target-user">
<input type="text" class="form-control" rows="1" id="backup-target-b2-user">
</div>
</div>
<div class="form-group backup-target-b2">
<label for="backup-target-pass" class="col-sm-2 control-label">B2 Application Key</label>
<div class="col-sm-8">
<input type="text" class="form-control" rows="1" id="backup-target-pass">
<input type="text" class="form-control" rows="1" id="backup-target-b2-pass">
</div>
</div>
<!-- Common -->
@@ -163,7 +163,7 @@
function toggle_form() {
var target_type = $("#backup-target-type").val();
$(".backup-target-local, .backup-target-rsync, .backup-target-s3").hide();
$(".backup-target-local, .backup-target-rsync, .backup-target-s3, .backup-target-b2").hide();
$(".backup-target-" + target_type).show();
}
@@ -264,7 +264,9 @@ function show_custom_backup() {
} else if (r.target.substring(0, 5) == "b2://") {
$("#backup-target-type").val("b2");
var hostpath = r.target.substring(5).split('@');
var host = hostpath.shift();
var usernamepass = hostpath.shift().split(":");
$("#backup-target-rsync-b2-user").val(usernamepass[0]);
$("#backup-target-rsync-b2-user").val(usernamepass[1]);
$("#backup-target-b2-path").val(hostpath.join('/'));
}
toggle_form()
@@ -283,7 +285,7 @@ function set_custom_backup() {
target = "s3://" + $("#backup-target-s3-host").val() + "/" + $("#backup-target-s3-path").val();
else if (target_type == "b2")
target = "b2://" + $("#backup-target-b2-user").val() + ":"
+ $("#backup-target-b2-pass").val() + "@" + $("#backup-target-b2-path");
+ $("#backup-target-b2-pass").val() + "@" + $("#backup-target-b2-path").val();
else if (target_type == "rsync") {
target = "rsync://" + $("#backup-target-rsync-user").val() + "@" + $("#backup-target-rsync-host").val()
+ "/" + $("#backup-target-rsync-path").val();