Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use same password dialog as in Arduino IDE to authenticate for FS data upload #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/ESP8266FS.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
import java.lang.reflect.InvocationTargetException;
import javax.swing.JOptionPane;


import processing.app.PreferencesData;
import processing.app.Editor;
import processing.app.Base;
import processing.app.BaseNoGui;
import processing.app.Platform;
import processing.app.Sketch;
import processing.app.forms.PasswordAuthorizationDialog;
import processing.app.tools.Tool;
import processing.app.helpers.ProcessUtils;
import processing.app.debug.TargetPlatform;
Expand Down Expand Up @@ -307,7 +309,23 @@ private void createAndUpload(){

System.out.println("[SPIFFS] IP : "+serialPort);
System.out.println();
sysExec(new String[]{pythonCmd, espota.getAbsolutePath(), "-i", serialPort, "-s", "-f", imagePath});

PasswordAuthorizationDialog dialog = new PasswordAuthorizationDialog(
editor, "Type board password to upload new data");
dialog.setLocationRelativeTo(editor);
dialog.setVisible(true);
if (dialog.isCancelled()) {
editor.statusNotice("Upload cancelled");
return;
}
String pass = dialog.getPassword();
if (pass.isEmpty()) {
sysExec(new String[]{pythonCmd, espota.getAbsolutePath(),
"-i", serialPort, "-s", "-f", imagePath});
} else {
sysExec(new String[]{pythonCmd, espota.getAbsolutePath(),
"-i", serialPort, "-a", pass, "-s", "-f", imagePath});
}
} else {
System.out.println("[SPIFFS] address: "+uploadAddress);
System.out.println("[SPIFFS] reset : "+resetMethod);
Expand Down