From e94ed4eafa50ab625db02ee5bbdf3cc712433d0c Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 30 Nov 2019 10:22:19 +0000 Subject: [PATCH] init nickname and download locations --- .../java/com/muwire/webui/MuWireBean.java | 1 - .../java/com/muwire/webui/MuWireClient.java | 4 ++++ webui/src/main/webapp/index.jsp | 21 ++++++++++++++++- webui/src/main/webapp/init.jsp | 23 +++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 webui/src/main/webapp/init.jsp diff --git a/webui/src/main/java/com/muwire/webui/MuWireBean.java b/webui/src/main/java/com/muwire/webui/MuWireBean.java index a0c8a1ff..d7474977 100644 --- a/webui/src/main/java/com/muwire/webui/MuWireBean.java +++ b/webui/src/main/java/com/muwire/webui/MuWireBean.java @@ -11,7 +11,6 @@ public class MuWireBean implements Serializable { public MuWireBean() { mwClient = ((RouterContext)I2PAppContext.getGlobalContext()).clientAppManager().getRegisteredApp("MuWire"); - System.out.println("mwClient is "+mwClient); } public Object getMwClient() { diff --git a/webui/src/main/java/com/muwire/webui/MuWireClient.java b/webui/src/main/java/com/muwire/webui/MuWireClient.java index 2eaf7d1a..6c34ef53 100644 --- a/webui/src/main/java/com/muwire/webui/MuWireClient.java +++ b/webui/src/main/java/com/muwire/webui/MuWireClient.java @@ -133,4 +133,8 @@ public class MuWireClient implements RouterApp { public Core getCore() { return core; } + + public String getHome() { + return home; + } } diff --git a/webui/src/main/webapp/index.jsp b/webui/src/main/webapp/index.jsp index 28619f9d..b9d0d7d2 100644 --- a/webui/src/main/webapp/index.jsp +++ b/webui/src/main/webapp/index.jsp @@ -1,6 +1,9 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ page import="java.io.File" %> + <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> @@ -9,8 +12,24 @@ + + <% + String defaultDownloadLocation = System.getProperty("user.home")+File.separator+"Downloads"; + String defaultIncompletesLocation = System.getProperty("user.home") + File.separator+"MuWire Incompletes"; + session.setAttribute("defaultDownloadLocation",defaultDownloadLocation); + session.setAttribute("defaultIncompletesLocation",defaultIncompletesLocation); + %> + -

MW needs initializing

+

Welcome to MuWire! Please select a nickname and download locations

+
+ Nickname: +
+ Directory for saving downloaded files: +
+ Directory for storing incomplete files: +
+

MW doesn't need initing

diff --git a/webui/src/main/webapp/init.jsp b/webui/src/main/webapp/init.jsp new file mode 100644 index 00000000..731240ce --- /dev/null +++ b/webui/src/main/webapp/init.jsp @@ -0,0 +1,23 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ page import="java.io.File" %> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + <% + String nickname = request.getParameter("nickname"); + String downloadLocation = request.getParameter("download_location"); + String incompleteLocation = request.getParameter("incomplete_location"); + + session.setAttribute("downloadLocation", new File(downloadLocation)); + session.setAttribute("incompleteLocation", new File("incompleteLocation")); + session.setAttribute("nickname",nickname); + %> + + + +