timburgess / brackets-ftp-sync

FTP/SFTP for Adobe Brackets
105 stars 19 forks source link

Port number is reset, even if last connection succeeded #37

Open mitchhentges opened 9 years ago

mitchhentges commented 9 years ago

Even though I'm successfully connecting to my server, the next time I open up ftp-sync, I need to re-enter my port.

The below reproduction instructions are not the minimal reproduction case. It's just the list of steps that will reproduce the problem.

To reproduce:

  1. Clear .ftpsync_settings
  2. Start up ftp-sync
  3. Choose SFTP
  4. Set some secure server
  5. Set port to something other than 22
  6. Enter username, password, check "Save Password"
  7. Upload
  8. Open ftp-sync again
hcancelik commented 9 years ago

Here is a fix. This is my first post so I'm not sure how to send the updated main.js file.

1) Click Help -> Show Extensions Folder 2) Select user and then ftp-sync 3) Open main.js file and replace the function on line 93 (handleSelect()) with the one below.

This should fix the problem as it did to mine :) I also edited the css file under styles folder to make the port input box bigger as my sftp port is 8888.

function handleSelect() {

    $(this).parent().find('.active').removeClass('active');
    $(this).addClass('active');
    ftpSettings.connect = $(this).text();

    var currentPort = $("#port").val();  //newline

    var keyfileDisabled;
    if (ftpSettings.connect === 'FTP') {
      keyfileDisabled = true;
      if(!currentPort || currentPort == 22) $("#port").val('21'); //new if-check
    } else {
      keyfileDisabled = false;
      if(!currentPort || currentPort == 21) $("#port").val('22'); //new if-check
    }
    $("#keyfile").prop('disabled', keyfileDisabled);
    $(".dialog-button[data-button-id='browse']").prop('disabled', keyfileDisabled);
}