Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
for #230, re-enables web server with password requirement
n8fr8cd6ec1360524
diff --git a/src/main/java/org/havenapp/main/HavenApp.java b/src/main/java/org/havenapp/main/HavenApp.javaindex c9ff861..d40d3a9 100644--- a/src/main/java/org/havenapp/main/HavenApp.java+++ b/src/main/java/org/havenapp/main/HavenApp.java@@ -60,10 +60,7 @@ public class HavenApp extends MultiDexApplication {if (mOnionServer == null || (!mOnionServer.isAlive())){try {- mOnionServer = new WebServer(this);-- if (!TextUtils.isEmpty(mPrefs.getRemoteAccessCredential()))- mOnionServer.setPassword(mPrefs.getRemoteAccessCredential());+ mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());} catch (IOException ioe) {Log.e("OnioNServer", "unable to start onion server", ioe);}diff --git a/src/main/java/org/havenapp/main/service/WebServer.java b/src/main/java/org/havenapp/main/service/WebServer.javaindex a4dc6da..6057581 100644--- a/src/main/java/org/havenapp/main/service/WebServer.java+++ b/src/main/java/org/havenapp/main/service/WebServer.java@@ -38,17 +38,15 @@ public class WebServer extends NanoHTTPD {private Context mContext;- public WebServer(Context context) throws IOException {+ public WebServer(Context context, String password) throws IOException {super(LOCAL_HOST, LOCAL_PORT);mContext = context;+ mPassword = password;if (!TextUtils.isEmpty(mPassword)) //require a password to start the serverstart(NanoHTTPD.SOCKET_READ_TIMEOUT, false);- }-- public void setPassword (String password)- {- mPassword = password;+ else+ throw new IOException ("Web password must not be null");}@Override