feat(rsync-backup-ui): Add a Copy button to put public key on clipboard in rsync UI (#2227)
This commit is contained in:
parent
88260bb610
commit
f72be0be7c
|
@ -73,6 +73,9 @@
|
||||||
passwordless authentication from your mail-in-a-box server and your backup server.
|
passwordless authentication from your mail-in-a-box server and your backup server.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="copy_pub_key_div" class="col-sm">
|
||||||
|
<button type="button" class="btn btn-small" onclick="copy_pub_key_to_clipboard()">Copy</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- S3 BACKUP -->
|
<!-- S3 BACKUP -->
|
||||||
<div class="form-group backup-target-s3">
|
<div class="form-group backup-target-s3">
|
||||||
|
@ -374,4 +377,15 @@ const url_split = url => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hide Copy button if not in a modern clipboard-supporting environment.
|
||||||
|
// Using document API because jQuery is not necessarily available in this script scope.
|
||||||
|
if (!(navigator && navigator.clipboard && navigator.clipboard.writeText)) {
|
||||||
|
document.getElementById('copy_pub_key_div').hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy_pub_key_to_clipboard() {
|
||||||
|
const ssh_pub_key = $("#ssh-pub-key").val();
|
||||||
|
navigator.clipboard.writeText(ssh_pub_key);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue