Skip to content

Commit 190f0df

Browse files
author
jantje
committed
OTA AUTH password always comes from file
Note this means you can not remove the pwd from the esp using OTA
1 parent b37b353 commit 190f0df

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

io.sloeber.core/src/io/sloeber/core/tools/uploaders/arduinoUploader.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
import org.eclipse.core.runtime.Status;
1818
import org.eclipse.ui.console.MessageConsole;
1919

20-
import io.sloeber.core.api.PasswordManager;
2120
import io.sloeber.core.common.Common;
2221
import io.sloeber.core.common.Const;
2322
import io.sloeber.core.common.IndexHelper;
2423
import io.sloeber.core.communication.ArduinoSerial;
25-
import io.sloeber.core.tools.Helpers;
2624

2725
public class arduinoUploader implements IRealUpload {
2826

@@ -93,11 +91,6 @@ public boolean uploadUsingPreferences(IFile hexFile, boolean usingProgrammer, IP
9391
if (boardName.startsWith("Arduino Due ")) { //$NON-NLS-1$
9492
ArduinoSerial.reset_Arduino_by_baud_rate(MComPort, 115200, 100);
9593
}
96-
// for web authorized upload
97-
if (needsPassword) {
98-
String passWord = getPasswordFromCode();
99-
PasswordManager.setPwd(MComPort, myLogin, passWord);
100-
}
10194

10295
return true;
10396
}
@@ -111,20 +104,16 @@ public boolean uploadUsingPreferences(IFile hexFile, boolean usingProgrammer, IP
111104
*/
112105
@SuppressWarnings("nls")
113106
private String getPasswordFromCode() {
114-
return IndexHelper.findParameterInFunction(this.myProject, "setup", "ArduinoOTA.setPassword",
107+
String parameter = IndexHelper.findParameterInFunction(this.myProject, "setup", "ArduinoOTA.setPassword",
115108
"no_pwd_found_in_code");
109+
return parameter.replaceAll("\\(.*\\)", "").trim();
116110

117111
}
118112

119113
private void setEnvironmentvarsForAutorizedUpload(IContributedEnvironment contribEnv,
120114
ICConfigurationDescription configurationDescription, String host) {
121-
String passWord;
122-
PasswordManager pwdManager = new PasswordManager();
123-
if (!pwdManager.setHost(Helpers.getHostFromComPort(host))) {
124-
passWord = getPasswordFromCode();
125-
} else {
126-
passWord = pwdManager.getPassword();
127-
}
115+
String passWord = null;
116+
passWord = getPasswordFromCode();
128117
IEnvironmentVariable var = new EnvironmentVariable(Const.ENV_KEY_NETWORK_AUTH, passWord);
129118
contribEnv.addVariable(var, configurationDescription);
130119

0 commit comments

Comments
 (0)