mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-11-03 19:30:54 +00:00 
			
		
		
		
	feat(rsync-backup-ui): Add a Copy button to put public key on clipboard
This commit is contained in:
		
							parent
							
								
									5e3e4a2161
								
							
						
					
					
						commit
						f5e4cb91ca
					
				@ -73,6 +73,9 @@
 | 
			
		||||
        passwordless authentication from your mail-in-a-box server and your backup server.
 | 
			
		||||
      </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>
 | 
			
		||||
  <!-- S3 BACKUP -->
 | 
			
		||||
  <div class="form-group backup-target-s3">
 | 
			
		||||
@ -374,4 +377,14 @@ const url_split = url => {
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
  
 | 
			
		||||
// hide Copy button if not in a modern clipboard-supporting environment
 | 
			
		||||
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>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user