Files
i2p.i2p/apps/routerconsole/jsp/css.jsi

71 lines
3.4 KiB
Plaintext
Raw Normal View History

<%
/*
* This should be included inside <head>...</head>,
* as it sets the stylesheet.
*
* This is included almost 30 times, so keep whitespace etc. to a minimum.
*/
// http://www.crazysquirrel.com/computing/general/form-encoding.jspx
if (request.getCharacterEncoding() == null)
request.setCharacterEncoding("UTF-8");
2011-03-19 18:34:39 +00:00
// Now that we use POST for most forms, these prevent the back button from working after a form submit
// Just let the browser do its thing
//response.setHeader("Pragma", "no-cache");
//response.setHeader("Cache-Control","no-cache");
//response.setDateHeader("Expires", 0);
// the above will b0rk if the servlet engine has already flushed
2009-08-15 16:08:33 +00:00
// the response prior to including this file, so it should be
// near the top
2009-08-15 16:08:33 +00:00
String i2pcontextId = request.getParameter("i2p.contextId");
try {
if (i2pcontextId != null) {
session.setAttribute("i2p.contextId", i2pcontextId);
} else {
i2pcontextId = (String) session.getAttribute("i2p.contextId");
}
} catch (IllegalStateException ise) {}
2018-11-13 17:48:58 +00:00
%><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="intl" scope="request" />
<jsp:setProperty name="intl" property="contextId" value="<%=i2pcontextId%>" />
2018-11-13 17:48:58 +00:00
<link rel="icon" href="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/favicon.ico"><%
2018-03-09 16:02:00 +00:00
response.setHeader("Accept-Ranges", "none");
2012-05-13 13:05:17 +00:00
// clickjacking
if (intl.shouldSendXFrame()) {
2012-05-13 13:05:17 +00:00
response.setHeader("X-Frame-Options", "SAMEORIGIN");
response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'");
response.setHeader("X-XSS-Protection", "1; mode=block");
response.setHeader("X-Content-Type-Options", "nosniff");
}
2016-12-23 12:35:41 +00:00
// https://www.w3.org/TR/referrer-policy/
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
// As of Chrome 56, Firefox 50, Opera 43. "same-origin" not widely supported.
response.setHeader("Referrer-Policy", "no-referrer");
2012-05-13 13:05:17 +00:00
String conNonceParam = request.getParameter("consoleNonce");
2015-10-17 17:38:57 +00:00
if (net.i2p.router.web.CSSHelper.getNonce().equals(conNonceParam)) {
intl.setLang(request.getParameter("lang"));
2011-11-09 18:38:39 +00:00
intl.setNews(request.getParameter("news"));
}
2018-11-13 17:48:58 +00:00
%><link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>console.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css">
<%
if (intl.getLang().equals("zh")) {
// make the fonts bigger for chinese
2018-11-13 17:48:58 +00:00
%><link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>console_big.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css">
<%
} else if (intl.getLang().equals("ar")) {
// Use RTL theme for Arabic
2018-11-13 17:48:58 +00:00
%><link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>console_ar.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css">
<%
}
if (!intl.allowIFrame(request.getHeader("User-Agent"))) {
2018-11-13 17:48:58 +00:00
%><meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
2016-12-02 17:23:02 +00:00
<link href="<%=intl.getTheme(request.getHeader("User-Agent"))%>mobile.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css">
<%
}
2018-11-13 17:48:58 +00:00
%><!--[if IE]><link href="/themes/console/classic/ieshim.css?<%=net.i2p.CoreVersion.VERSION%>" rel="stylesheet" type="text/css" /><![endif]-->