Skip to content

armgit / haven

Public Imported from GitHub
0

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

require a password for the web server

n8fr852f962750502
diff --git a/src/main/java/org/havenapp/main/service/WebServer.java b/src/main/java/org/havenapp/main/service/WebServer.java
index 870edcf..f04fd79 100644
--- a/src/main/java/org/havenapp/main/service/WebServer.java
+++ b/src/main/java/org/havenapp/main/service/WebServer.java
@@ -40,7 +40,9 @@ public class WebServer extends NanoHTTPD {
public WebServer(Context context) throws IOException {
super(LOCAL_HOST, LOCAL_PORT);
mContext = context;
- start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
+
+ if (!TextUtils.isEmpty(mPassword)) //require a password to start the server
+ start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
}
public void setPassword (String password)