13-swipe-p2p chat app/index.js
// Initiate SFTP for file sharing between peer

Initiate SFTP for file sharing between peer
Initiate SFTP for file sharing between peer
function initiateFTP(flag) {
	if(!ftp){
		document.getElementById('input').style.display = 'none';
		ftp = true;
		document.getElementById('ftp').style.display = 'block';
	}
	if(flag == null){
		document.getElementById('status').innerHTML = 'Waiting for response...';
		peer.send('{"type" : "FTP", "value" : "Request"}');
	}
	else if(flag == true){
		document.getElementById('status').innerHTML = (sender ? 'Sending' : 'Recieving') + ' file...';
		startFTP();
	}
	else if(flag == false){
		document.getElementById('status').innerHTML = 'Peer declined your request!';
		files = null, ftp = false;
	}
}
function initiateFTP ( flag ) { if ( ! ftp ) { document . getElementById ( 'input' ) . style . display = 'none' ; ftp = true ; document . getElementById ( 'ftp' ) . style . display = 'block' ; } if ( flag == null ) { document . getElementById ( 'status' ) . innerHTML = 'Waiting for response...' ; peer . send ( '{"type" : "FTP", "value" : "Request"}' ) ; } else if ( flag == true ) { document . getElementById ( 'status' ) . innerHTML = ( sender ? 'Sending' : 'Recieving' ) + ' file...' ; startFTP ( ) ; } else if ( flag == false ) { document . getElementById ( 'status' ) . innerHTML = 'Peer declined your request!' ; files = null , ftp = false ; } }
Initiate SFTP for file sharing between peer
Initiate SFTP for file sharing between peer