X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FCreatePostAjaxPage.java;h=53a5a51d40aeaead03cea95d45629ef913c6d327;hp=eff7c4133f69b2fb857baf5b992ceb9f40189875;hb=a47643aed43d118ca68044f95451bb5374cdb332;hpb=33f333b35a73d3d4a4e79f41e9dd7b342db87b1a diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java index eff7c41..53a5a51 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java @@ -1,5 +1,5 @@ /* - * Sone - CreatePostAjaxPage.java - Copyright © 2010 David Roden + * Sone - CreatePostAjaxPage.java - Copyright © 2010–2012 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,9 @@ package net.pterodactylus.sone.web.ajax; 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.sone.web.page.FreenetRequest; import net.pterodactylus.util.json.JsonObject; /** @@ -43,7 +45,7 @@ public class CreatePostAjaxPage extends JsonPage { * {@inheritDoc} */ @Override - protected JsonObject createJsonObject(Request request) { + protected JsonObject createJsonObject(FreenetRequest request) { Sone sone = getCurrentSone(request.getToadletContext()); if (sone == null) { return createErrorJsonObject("auth-required"); @@ -59,6 +61,7 @@ public class CreatePostAjaxPage extends JsonPage { 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); }