sidebar, servlet and styling improvements from zzz

This commit is contained in:
Zlatin Balevsky
2019-12-06 18:26:44 +00:00
parent c852d7474e
commit 8224dda3fd
9 changed files with 81 additions and 14 deletions

View File

@ -78,8 +78,9 @@ public class DownloadServlet extends HttpServlet {
resp.setDateHeader("Expires", 0);
resp.setHeader("Pragma", "no-cache");
resp.setHeader("Cache-Control", "no-store, max-age=0, no-cache, must-revalidate");
resp.getWriter().write(sb.toString());
resp.getWriter().flush();
byte[] out = sb.toString().getBytes("UTF-8");
resp.setContentLength(out.length);
resp.getOutputStream().write(out);
}

View File

@ -22,6 +22,10 @@ public class FilesServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String section = req.getParameter("section");
if (section == null) {
resp.sendError(403, "Bad section param");
return;
}
StringBuilder sb = new StringBuilder();
sb.append("<?xml version='1.0' encoding='UTF-8'?>");
if (section.equals("status")) {
@ -37,9 +41,13 @@ public class FilesServlet extends HttpServlet {
String encodedPath = req.getParameter("path");
File current = null;
if (encodedPath != null) {
String[] split = encodedPath.split(",");
String[] split = DataHelper.split(encodedPath, ",");
for (String element : split) {
element = Base64.decodeToString(element);
if (element == null) {
resp.sendError(403, "bad path");
return;
}
if (current == null) {
current = new File(element);
continue;
@ -55,8 +63,9 @@ public class FilesServlet extends HttpServlet {
resp.setDateHeader("Expires", 0);
resp.setHeader("Pragma", "no-cache");
resp.setHeader("Cache-Control", "no-store, max-age=0, no-cache, must-revalidate");
resp.getWriter().write(sb.toString());
resp.flushBuffer();
byte[] out = sb.toString().getBytes("UTF-8");
resp.setContentLength(out.length);
resp.getOutputStream().write(out);
}
@Override

View File

@ -57,7 +57,16 @@ public class MuWireServlet extends HttpServlet {
"<link href=\"i2pbote.css?" + version + "\" rel=\"stylesheet\" type=\"text/css\">\n" +
"<link href=\"muwire.css?" + version + "\" rel=\"stylesheet\" type=\"text/css\">\n" +
"</head><body>\n" +
"<p>MuWire is initializing, please wait</p>\n" +
"<header class=\"titlebar\">" +
"<div class=\"title\">" +
"<img src=\"images/muwire.png\" alt=\"\">" +
"Welcome to MuWire" +
"</div>" +
"<div class=\"subtitle\"><br><br><br><br></div>" +
"<div class=\"pagetitle\">" +
"MuWire is initializing, please wait" +
"</div>" +
"</header>" +
"</body></html>");
resp.setIntHeader("Refresh", 5);
} else

View File

@ -134,8 +134,9 @@ public class SearchServlet extends HttpServlet {
resp.setDateHeader("Expires", 0);
resp.setHeader("Pragma", "no-cache");
resp.setHeader("Cache-Control", "no-store, max-age=0, no-cache, must-revalidate");
resp.getWriter().write(sb.toString());
resp.flushBuffer();
byte[] out = sb.toString().getBytes("UTF-8");
resp.setContentLength(out.length);
resp.getOutputStream().write(out);
}

View File

@ -7,6 +7,8 @@ function refreshConnectionsCount() {
var connectionCountSpan = document.getElementById("connectionsCount");
var countString = ""+count;
connectionCountSpan.innerHTML = countString;
} else {
connectionCountSpan.innerHTML = "down";
}
}
xmlhttp.open("GET", "/MuWire/Search?section=connectionsCount", true);

View File

@ -166,4 +166,28 @@ function refreshStatus() {
}
xmlhttp.open("GET", "/MuWire/Files?section=status", true)
xmlhttp.send();
}
}
var root = new Node("sharedTree",null,false)
var nodesById = new Map()
class Node {
constructor(nodeId, parent, leaf, path) {
this.nodeId = nodeId
this.parent = parent
this.leaf = leaf
this.children = []
this.path = path
}
function updateDiv() {
var div = document.getElementById(this.nodeId)
if (this.leaf) {
div.innerHTML = "<li>"+this.path+</li>
} else {
if (children.length == 0) {
div.innerHTML = "<li><span class='caret'>" + this.path + "</span></li>"
}
}
}
}

View File

@ -20,7 +20,10 @@
<body onload="initConnectionsCount(); initDownloads();">
<%@include file="header.jsi"%>
<aside>
<h3>Downloads</h3>
<div class="menubox">
<h2>Downloads</h2>
</div>
<%@include file="sidebar.jsi"%>
</aside>
<section class="main foldermain">
<div id="table-wrapper">

View File

@ -28,19 +28,22 @@
<% } %>
<%@include file="header.jsi"%>
<aside>
<div class="menubox">
<% if (groupBy.equals("sender")) { %>
<h3>Active Searches By Sender</h3>
<a href="Home.jsp?groupBy=file">Group By File</a>
<h2>Active Searches By Sender</h2>
<a class="menuitem" href="Home.jsp?groupBy=file">Group By File</a>
<% } else { %>
<h3>Active Searches By File</h3>
<a href="Home.jsp?groupBy=sender">Group By Sender</a>
<h2>Active Searches By File</h2>
<a class="menuitem" href="Home.jsp?groupBy=sender">Group By Sender</a>
<% } %>
</div>
<div id="table-wrapper">
<div id="table-scroll">
<div id="activeSearches"></div>
</div>
</div>
<%@include file="sidebar.jsi"%>
</aside>
<section class="main foldermain">
<h3><span id="currentSearch">Results</span></h3>

View File

@ -0,0 +1,15 @@
<div class="menubox-divider"></div>
<div class="menubox">
<h2>Configuration</h2>
<a class="menuitem settings" href="settings.jsp">
<div class="menu-icon"></div>
<div class="menu-text">Settings</div>
</a>
</div>
<div class="menubox-divider"></div>
<div class="menubox">
<h2>Help</h2>
<a class="menuitem" href="userGuide.jsp">User Guide</a>
<a class="menuitem" href="faq.jsp">FAQ</a>
<a class="menuitem" href="about.jsp">About</a>
</div>