}
emptyLines = 0;
boolean lineComplete = true;
-
- /* filter http(s) links to own node. */
- String hostHeader = (context.getRequest() != null) ? context.getRequest().getHttpRequest().getHeader("host") : null;
- logger.log(Level.FINEST, "hostHeader: %s", hostHeader);
- if (hostHeader != null) {
- for (String toRemove : new String[] { "http://" + hostHeader + "/", "https://" + hostHeader + "/", "http://" + hostHeader, "https://" + hostHeader }) {
- while (line.indexOf(toRemove) != -1) {
- line = line.replace(toRemove, "");
- }
- }
- }
-
while (line.length() > 0) {
int nextKsk = line.indexOf("KSK@");
int nextChk = line.indexOf("CHK@");
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.text.TextFilter;
import net.pterodactylus.sone.web.page.Page.Request.Method;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
sender = currentSone;
}
Sone recipient = webInterface.getCore().getSone(recipientId, false);
+ text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
webInterface.getCore().createPost(sender, recipient, System.currentTimeMillis(), text);
throw new RedirectException(returnPage);
}
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.text.TextFilter;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.json.JsonObject;
if ((text == null) || (text.trim().length() == 0)) {
return createErrorJsonObject("text-required");
}
+ text = TextFilter.filter(request.getHttpRequest().getHeader("host"), text);
Post newPost = webInterface.getCore().createPost(sender, recipient, text);
return createSuccessJsonObject().put("postId", newPost.getId()).put("sone", sender.getId()).put("recipient", (newPost.getRecipient() != null) ? newPost.getRecipient().getId() : null);
}