forked from I2P_Developers/i2p.i2p
Added /i2ptunnelmanager which wraps /i2ptunnel/ in an IFrame
/i2ptunnelmanager redirects to /i2ptunnel/ if the browser doesn't support IFrames.
This commit is contained in:
@ -214,7 +214,7 @@ public class SummaryBarRenderer {
|
|||||||
.append(_("Stats"))
|
.append(_("Stats"))
|
||||||
.append("</a>\n" +
|
.append("</a>\n" +
|
||||||
|
|
||||||
"<a href=\"/i2ptunnel/\" target=\"_blank\" title=\"")
|
"<a href=\"/i2ptunnelmanager\" target=\"_top\" title=\"")
|
||||||
.append(_("Local Destinations"))
|
.append(_("Local Destinations"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
.append(_("I2PTunnel"))
|
.append(_("I2PTunnel"))
|
||||||
|
@ -404,7 +404,7 @@ public class SummaryHelper extends HelperBase {
|
|||||||
List<Destination> clients = new ArrayList(_context.clientManager().listClients());
|
List<Destination> clients = new ArrayList(_context.clientManager().listClients());
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder(512);
|
StringBuilder buf = new StringBuilder(512);
|
||||||
buf.append("<h3><a href=\"/i2ptunnel/\" target=\"_blank\" title=\"").append(_("Add/remove/edit & control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
buf.append("<h3><a href=\"/i2ptunnelmanager\" target=\"_top\" title=\"").append(_("Add/remove/edit & control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
||||||
if (!clients.isEmpty()) {
|
if (!clients.isEmpty()) {
|
||||||
Collections.sort(clients, new AlphaComparator());
|
Collections.sort(clients, new AlphaComparator());
|
||||||
buf.append("<table>");
|
buf.append("<table>");
|
||||||
|
41
apps/routerconsole/jsp/i2ptunnelmanager.jsp
Normal file
41
apps/routerconsole/jsp/i2ptunnelmanager.jsp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<%@page contentType="text/html"%>
|
||||||
|
<%@page trimDirectiveWhitespaces="true"%>
|
||||||
|
<%@page pageEncoding="UTF-8"%>
|
||||||
|
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="tester" scope="request" />
|
||||||
|
<jsp:setProperty name="tester" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||||
|
<%
|
||||||
|
// CSSHelper is also pulled in by css.jsi below...
|
||||||
|
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
|
||||||
|
if (!testIFrame) {
|
||||||
|
response.setStatus(302, "Moved");
|
||||||
|
response.setHeader("Location", "/i2ptunnel/");
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
|
||||||
|
<html><head>
|
||||||
|
<%@include file="css.jsi" %>
|
||||||
|
<%=intl.title("home")%>
|
||||||
|
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var failMessage = "<hr><b><%=intl._("Router is down")%><\/b>";
|
||||||
|
function requestAjax1() { ajax("/xhr1.jsp", "xhr", <%=intl.getRefresh()%>000); }
|
||||||
|
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
|
||||||
|
function resizeFrame(f) { f.style.height = f.contentWindow.document.body.scrollHeight + "px"; }
|
||||||
|
function init() {
|
||||||
|
resizeFrame(document.getElementById("i2ptunnelframe"));
|
||||||
|
initAjax();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head><body onload="init()">
|
||||||
|
|
||||||
|
<%@include file="summary.jsi" %>
|
||||||
|
|
||||||
|
<h1><%=intl._("I2P Tunnel Manager")%></h1>
|
||||||
|
<div class="main" id="main">
|
||||||
|
<iframe src="/i2ptunnel/" width="100%" frameborder="0" border="0" name="i2ptunnelframe" id="i2ptunnelframe" onload="resizeFrame(document.getElementById('i2ptunnelframe'))">
|
||||||
|
</iframe>
|
||||||
|
</div></body></html>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
Reference in New Issue
Block a user