Embed /i2psnark/ in an iframe like /i2ptunnel/

This commit is contained in:
str4d
2012-06-27 02:00:30 +00:00
parent 588799a2ff
commit 255894e241
3 changed files with 46 additions and 2 deletions

View File

@ -31,7 +31,7 @@ public class HomeHelper extends HelperBase {
_x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S + _x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S +
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "help.png" + S + _x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "help.png" + S +
_x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "wrench_orange.png" + S + _x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "wrench_orange.png" + S +
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/i2psnark/" + S + I + "film.png" + S + _x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/torrents" + S + I + "film.png" + S +
_x("Website") + S + _x("Local web server") + S + "http://127.0.0.1:7658/" + S + I + "server.png" + S + _x("Website") + S + _x("Local web server") + S + "http://127.0.0.1:7658/" + S + I + "server.png" + S +
""; "";

View File

@ -141,7 +141,7 @@ public class SummaryBarRenderer {
.append(_("Email")) .append(_("Email"))
.append("</a>\n" + .append("</a>\n" +
"<a href=\"/i2psnark/\" target=\"_blank\" title=\"") "<a href=\"/torrents\" target=\"_top\" title=\"")
.append(_("Built-in anonymous BitTorrent Client")) .append(_("Built-in anonymous BitTorrent Client"))
.append("\">") .append("\">")
.append(_("Torrents")) .append(_("Torrents"))

View File

@ -0,0 +1,44 @@
<%@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", "/i2psnark/");
} 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?requestURI=<%=request.getRequestURI()%>", "xhr", <%=intl.getRefresh()%>000); }
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
function resizeFrame(f) { f.style.height = f.contentWindow.document.body.scrollHeight + "px"; }
function injectClass(f) { f.contentWindow.document.getElementsByTagName('body')[0].setAttribute('class', 'iframed'); }
function init() {
f = document.getElementById("i2psnarkframe");
resizeFrame(f);
injectClass(f);
initAjax();
}
</script>
</head><body onload="init()">
<%@include file="summary.jsi" %>
<h1><%=intl._("I2P Torrent Downloader")%></h1>
<div class="main" id="main">
<iframe src="/i2psnark/" width="100%" height="100%" frameborder="0" border="0" name="i2psnarkframe" id="i2psnarkframe" onload="resizeFrame(document.getElementById('i2psnarkframe'))" allowtransparency="true">
</iframe>
</div></body></html>
<%
}
%>