add in a basic limit on the attachment size (trivially circumvented, but for now it'll do)
fixed some links
This commit is contained in:
@ -479,6 +479,8 @@ public class BlogManager {
|
|||||||
*/
|
*/
|
||||||
private static final String DEFAULT_SINGLE_USER_ARCHIVES[] = new String[] {
|
private static final String DEFAULT_SINGLE_USER_ARCHIVES[] = new String[] {
|
||||||
"http://syndiemedia.i2p/archive/archive.txt"
|
"http://syndiemedia.i2p/archive/archive.txt"
|
||||||
|
, "http://gloinsblog.i2p/archive/archive.txt"
|
||||||
|
, "http://glog.i2p/archive/archive.txt"
|
||||||
};
|
};
|
||||||
|
|
||||||
public User getDefaultUser() {
|
public User getDefaultUser() {
|
||||||
|
@ -69,7 +69,7 @@ public class Updater {
|
|||||||
|
|
||||||
// wait
|
// wait
|
||||||
try {
|
try {
|
||||||
Thread.currentThread().sleep(1*60*1000);
|
Thread.currentThread().sleep(5*60*1000);
|
||||||
} catch (InterruptedException ie) {}
|
} catch (InterruptedException ie) {}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -518,7 +518,10 @@ public class HTMLRenderer extends EventReceiverImpl {
|
|||||||
_bodyBuffer.append(getSpan("attachmentSummary")).append(" (");
|
_bodyBuffer.append(getSpan("attachmentSummary")).append(" (");
|
||||||
_bodyBuffer.append(getSpan("attachmentSummarySize")).append(attachments[id].getDataLength()/1024).append("KB</span>, ");
|
_bodyBuffer.append(getSpan("attachmentSummarySize")).append(attachments[id].getDataLength()/1024).append("KB</span>, ");
|
||||||
_bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(attachments[id].getName())).append("\"</span>, ");
|
_bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(attachments[id].getName())).append("\"</span>, ");
|
||||||
_bodyBuffer.append(getSpan("attachmentSummaryDesc")).append(" \"").append(sanitizeString(attachments[id].getDescription())).append("\"</span>, ");
|
String descr = attachments[id].getDescription();
|
||||||
|
if ( (descr != null) && (descr.trim().length() > 0) ) {
|
||||||
|
_bodyBuffer.append(getSpan("attachmentSummaryDesc")).append(" \"").append(sanitizeString(descr.trim())).append("\"</span>, ");
|
||||||
|
}
|
||||||
_bodyBuffer.append(getSpan("attachmentSummaryType")).append(sanitizeString(attachments[id].getMimeType())).append("</span>)</span>");
|
_bodyBuffer.append(getSpan("attachmentSummaryType")).append(sanitizeString(attachments[id].getMimeType())).append("</span>)</span>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,6 +510,7 @@ public abstract class BaseServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
//out.write("</td><td class=\"topNav_admin\">\n");
|
//out.write("</td><td class=\"topNav_admin\">\n");
|
||||||
out.write("</span><span class=\"topNav_admin\">\n");
|
out.write("</span><span class=\"topNav_admin\">\n");
|
||||||
|
out.write("<a href=\"about.html\" title=\"Basic Syndie info\">About</a> ");
|
||||||
if (BlogManager.instance().authorizeRemote(user)) {
|
if (BlogManager.instance().authorizeRemote(user)) {
|
||||||
out.write("<a href=\"" + getSyndicateLink(user, null) + "\" title=\"Syndicate data between other Syndie nodes\">Syndicate</a>\n");
|
out.write("<a href=\"" + getSyndicateLink(user, null) + "\" title=\"Syndicate data between other Syndie nodes\">Syndicate</a>\n");
|
||||||
out.write("<a href=\"importfeed.jsp\" title=\"Import RSS/Atom data\">Import RSS/Atom</a>\n");
|
out.write("<a href=\"importfeed.jsp\" title=\"Import RSS/Atom data\">Import RSS/Atom</a>\n");
|
||||||
|
@ -163,6 +163,9 @@ public class PostBean {
|
|||||||
return raw.toString();
|
return raw.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** until we have a good filtering/preferences system, lets try to keep the content small */
|
||||||
|
private static final int MAX_SIZE = 256*1024;
|
||||||
|
|
||||||
private void cacheAttachments() throws IOException {
|
private void cacheAttachments() throws IOException {
|
||||||
File postCacheDir = new File(BlogManager.instance().getTempDir(), _user.getBlog().toBase64());
|
File postCacheDir = new File(BlogManager.instance().getTempDir(), _user.getBlog().toBase64());
|
||||||
if (!postCacheDir.exists())
|
if (!postCacheDir.exists())
|
||||||
@ -177,10 +180,14 @@ public class PostBean {
|
|||||||
o.write(buf, 0, read);
|
o.write(buf, 0, read);
|
||||||
o.close();
|
o.close();
|
||||||
in.close();
|
in.close();
|
||||||
_localFiles.add(f);
|
if (f.length() > MAX_SIZE) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
_log.error("Refusing to post the attachment, because it is too big: " + f.length());
|
||||||
_log.debug("Caching attachment " + i + " temporarily in "
|
} else {
|
||||||
+ f.getAbsolutePath() + " w/ " + f.length() + "bytes");
|
_localFiles.add(f);
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Caching attachment " + i + " temporarily in "
|
||||||
|
+ f.getAbsolutePath() + " w/ " + f.length() + "bytes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_fileStreams.clear();
|
_fileStreams.clear();
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,11 @@ public class PostServlet extends BaseServlet {
|
|||||||
if ( (replyTo != null) && (replyTo.trim().length() > 0) ) {
|
if ( (replyTo != null) && (replyTo.trim().length() > 0) ) {
|
||||||
byte r[] = Base64.decode(replyTo);
|
byte r[] = Base64.decode(replyTo);
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
if (entryHeaders == null) entryHeaders = HTMLRenderer.HEADER_IN_REPLY_TO + ": entry://" + new String(r, "UTF-8");
|
replyTo = new String(r, "UTF-8");
|
||||||
else entryHeaders = entryHeaders + '\n' + HTMLRenderer.HEADER_IN_REPLY_TO + ": entry://" + new String(r, "UTF-8");
|
if (!replyTo.startsWith("entry://") && !replyTo.startsWith("blog://"))
|
||||||
|
replyTo = "entry://" + replyTo;
|
||||||
|
if (entryHeaders == null) entryHeaders = HTMLRenderer.HEADER_IN_REPLY_TO + ": " + replyTo;
|
||||||
|
else entryHeaders = entryHeaders + '\n' + HTMLRenderer.HEADER_IN_REPLY_TO + ": " + replyTo;
|
||||||
} else {
|
} else {
|
||||||
replyTo = null;
|
replyTo = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user