<modelVersion>4.0.0</modelVersion>
<groupId>net.pterodactylus</groupId>
<artifactId>sone</artifactId>
- <version>0.5.1</version>
+ <version>0.5.2</version>
<dependencies>
<dependency>
<groupId>net.pterodactylus</groupId>
@SuppressWarnings("synthetic-access")
public void run() {
if (!preferences.isSoneRescueMode()) {
- soneDownloader.fetchSone(sone);
return;
}
logger.log(Level.INFO, "Trying to restore Sone from Freenet…");
private static final Logger logger = Logging.getLogger(WebOfTrustConnector.class);
/** The name of the WoT plugin. */
- private static final String WOT_PLUGIN_NAME = "plugins.WoT.WoT";
+ private static final String WOT_PLUGIN_NAME = "plugins.WebOfTrust.WebOfTrust";
/** A random connection identifier. */
private static final String PLUGIN_CONNECTION_IDENTIFIER = "Sone-WoT-Connector-" + Math.abs(Math.random());
}
/** The version. */
- public static final Version VERSION = new Version(0, 5, 1);
+ public static final Version VERSION = new Version(0, 5, 2);
/** The logger. */
private static final Logger logger = Logging.getLogger(SonePlugin.class);
Sone selectedSone = webInterface.getCore().getLocalSone(soneId, false);
if (selectedSone != null) {
setCurrentSone(request.getToadletContext(), selectedSone);
- throw new RedirectException("index.html");
+ String target = request.getHttpRequest().getParam("target");
+ if ((target == null) || (target.length() == 0)) {
+ target = "index.html";
+ }
+ throw new RedirectException(target);
}
}
List<OwnIdentity> ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.getCore());
package net.pterodactylus.sone.web;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Collection;
import net.pterodactylus.util.template.TemplateContext;
import freenet.clients.http.SessionManager.Session;
import freenet.clients.http.ToadletContext;
+import freenet.support.api.HTTPRequest;
/**
* Base page for the Freetalk web interface.
@Override
protected String getRedirectTarget(Page.Request request) {
if (requiresLogin() && (getCurrentSone(request.getToadletContext(), false) == null)) {
- return "login.html";
+ HTTPRequest httpRequest = request.getHttpRequest();
+ String originalUrl = httpRequest.getPath();
+ if (httpRequest.hasParameters()) {
+ StringBuilder requestParameters = new StringBuilder();
+ for (String parameterName : httpRequest.getParameterNames()) {
+ if (requestParameters.length() > 0) {
+ requestParameters.append("%26");
+ }
+ String[] parameterValues = httpRequest.getMultipleParam(parameterName);
+ for (String parameterValue : parameterValues) {
+ try {
+ requestParameters.append(URLEncoder.encode(parameterName, "UTF-8")).append("%3d").append(URLEncoder.encode(parameterValue, "UTF-8"));
+ } catch (UnsupportedEncodingException uee1) {
+ /* A JVM without UTF-8? I don’t think so. */
+ }
+ }
+ }
+ originalUrl += "?" + requestParameters.toString();
+ }
+ return "login.html?target=" + originalUrl;
}
return null;
}
<%if !identitiesWithoutSone.empty>
<h1><%= Page.Login.CreateSone.Title|l10n|html></h1>
- <p><%= View.CreateSone.Text.WotIdentityRequired|l10n|html|replace needle="{link}" replacement='<a href="/WoT/">'|replace needle="{/link}" replacement='</a>'></p>
+ <p><%= View.CreateSone.Text.WotIdentityRequired|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/">'|replace needle="{/link}" replacement='</a>'></p>
<form id="create-sone" action="createSone.html" method="post">
<input type="hidden" name="formPassword" value="<% formPassword|html>" />
</form>
<%else>
<%if !sones.empty>
- <p><%= View.CreateSone.Text.NoNonSoneIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WoT/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
+ <p><%= View.CreateSone.Text.NoNonSoneIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
<%else>
- <p><%= View.CreateSone.Text.NoIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WoT/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
+ <p><%= View.CreateSone.Text.NoIdentities|l10n|html|replace needle="{link}" replacement='<a href="/WebOfTrust/OwnIdentities">'|replace needle="{/link}" replacement="</a>"></p>
<%/if>
<%/if>
<div id="profile" class="<%ifnull currentSone>offline<%else>online<%/if>">
<a class="picture" href="index.html">
<%ifnull !currentSone>
- <img src="/WoT/GetIdenticon?identity=<% currentSone.id|html>&width=80&height=80" width="80" height="80" alt="Profile Avatar" />
+ <img src="/WebOfTrust/GetIdenticon?identity=<% currentSone.id|html>&width=80&height=80" width="80" height="80" alt="Profile Avatar" />
<%else>
<img src="images/sone.png" width="80" height="80" alt="Sone is offline" />
<%/if>
<div class="post-time hidden"><% post.time|html></div>
<div class="post-author hidden"><% post.sone.id|html></div>
<div class="avatar">
- <img src="/WoT/GetIdenticon?identity=<% post.sone.id|html>&width=48&height=48" width="48" height="48" alt="Avatar Image" />
+ <img src="/WebOfTrust/GetIdenticon?identity=<% post.sone.id|html>&width=48&height=48" width="48" height="48" alt="Avatar Image" />
</div>
<div class="inner-part">
<div>
<div class="reply-time hidden"><% reply.time|html></div>
<div class="reply-author hidden"><% reply.sone.id|html></div>
<div class="avatar">
- <img src="/WoT/GetIdenticon?identity=<% reply.sone.id|html>&width=36&height=36" width="36" height="36" alt="Avatar Image" />
+ <img src="/WebOfTrust/GetIdenticon?identity=<% reply.sone.id|html>&width=36&height=36" width="36" height="36" alt="Avatar Image" />
</div>
<div class="inner-part">
<div>
<div class="profile-field">
<div class="name"><%= Page.ViewSone.Profile.Label.Name|l10n|html></div>
- <div class="value"><a href="/WoT/ShowIdentity?id=<% sone.id|html>"><% sone.niceName|html></a></div>
+ <div class="value"><a href="/WebOfTrust/ShowIdentity?id=<% sone.id|html>"><% sone.niceName|html></a></div>
</div>
<%foreach sone.profile.fields field>