more sidebar work thanks to zzz

This commit is contained in:
Zlatin Balevsky
2019-12-07 12:18:01 +00:00
parent 5c17536683
commit f579c8754f
9 changed files with 49 additions and 17 deletions

View File

@ -47,6 +47,8 @@ task precompileJsp {
ant.javac(srcDir: 'build/tmp_jsp',
classPath : sourceSets.main.runtimeClasspath.asPath,
debug : true,
includeAntRuntime : false,
deprecation : "on",
destDir:file("$buildDir/compiledJsps"))
}

View File

@ -87,10 +87,19 @@ public class DownloadServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String infoHashB64 = req.getParameter("infoHash");
InfoHash infoHash = new InfoHash(Base64.decode(infoHashB64));
if (infoHashB64 == null) {
resp.sendError(403, "Bad param");
return;
}
byte[] h = Base64.decode(infoHashB64);
if (h == null || h.length != InfoHash.SIZE) {
resp.sendError(403, "Bad param");
return;
}
InfoHash infoHash = new InfoHash(h);
String action = req.getParameter("action");
if (action == null) {
resp.sendError(403, "Bad action param");
resp.sendError(403, "Bad param");
return;
}
if (action.equals("start")) {
@ -118,5 +127,7 @@ public class DownloadServlet extends HttpServlet {
}
downloadManager.cancel(infoHash);
}
// P-R-G
resp.sendRedirect("/MuWire/Downloads.jsp");
}
}

View File

@ -1,14 +1,16 @@
function refreshConnectionsCount() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if (this.readyState == 4) {
var connectionCountSpan = document.getElementById("connectionsCount");
if (this.status == 200) {
var connections = this.responseXML.getElementsByTagName("Connections");
var count = connections[0].childNodes[0].nodeValue
var connectionCountSpan = document.getElementById("connectionsCount");
var countString = ""+count;
connectionCountSpan.innerHTML = countString;
} else {
} else {
connectionCountSpan.innerHTML = "down";
}
}
}
xmlhttp.open("GET", "/MuWire/Search?section=connectionsCount", true);

View File

@ -20,6 +20,7 @@
<body onload="initConnectionsCount(); initDownloads();">
<%@include file="header.jsi"%>
<aside>
<%@include file="searchbox.jsi"%>
<div class="menubox">
<h2>Downloads</h2>
</div>

View File

@ -28,6 +28,7 @@
<% } %>
<%@include file="header.jsi"%>
<aside>
<%@include file="searchbox.jsi"%>
<div class="menubox">
<% if (groupBy.equals("sender")) { %>
<h2>Active Searches By Sender</h2>

View File

@ -1,4 +1,5 @@
<title>MuWire ${version}</title>
<link href="i2pbote.css?${version}" rel="stylesheet" type="text/css">
<link href="muwire.css?${version}" rel="stylesheet" type="text/css">
<link rel="icon" type="image/png" href="images/muwire.png" />
<script src="js/conncount.js?${version}" type="text/javascript"></script>

View File

@ -1,22 +1,12 @@
<header class="titlebar">
<div class="title">
<a href="Home.jsp"><img src="images/muwire.png" alt=""></a>
Welcome to MuWire
<br>Welcome to MuWire
</div>
<div class="subtitle">
<br>
${persona}
<br>
Connections: <span id="connectionsCount">0</span>
<br>
<% if ("Home".equals(pagetitle)) { %>
<form action="/MuWire/Search" method="post">
<input type="text" name="search" />
<input type="submit" value="Search" />
</form>
<a href="Downloads.jsp">Downloads</a>
<% } else { %>
<a href="Home.jsp">Search</a>
<% } %>
</div>
<div class="pagetitle">
<%=pagetitle%>

View File

@ -0,0 +1,12 @@
<div class="menubox-divider"></div>
<div class="menubox">
<div class="searchbox">
<h2>Search</h2>
<div class="menu-icon"></div>
<form action="/MuWire/Search" method="post">
<input type="text" name="search" />
<input type="submit" value="Search" />
</form>
</div>
</div>
<div class="menubox-divider"></div>

View File

@ -1,4 +1,16 @@
<div class="menubox-divider"></div>
<div class="menubox">
<h2>Status</h2>
<div class="menu-icon"></div>
<div class="menu-text">Connections: <span id="connectionsCount">0</span></div>
</div>
<div class="menubox-divider"></div>
<div class="menubox">
<h2>Pages</h2>
<a class="menuitem" href="Downloads.jsp">Downloads</a>
<a class="menuitem" href="Home.jsp">Search</a>
</div>
<div class="menubox-divider"></div>
<div class="menubox">
<h2>Configuration</h2>
<a class="menuitem settings" href="settings.jsp">