diff --git a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java index 3e696c0633..bbc0423119 100644 --- a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java +++ b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java @@ -185,7 +185,7 @@ public class BlogManager { } public String login(User user, String login, String pass) { - if ( (login == null) || (pass == null) ) return "Login not specified"; + if ( (login == null) || (pass == null) ) return "Login not specified"; Hash userHash = _context.sha().calculateHash(DataHelper.getUTF8(login)); Hash passHash = _context.sha().calculateHash(DataHelper.getUTF8(pass)); File userFile = new File(_userDir, Base64.encode(userHash.getData())); @@ -208,10 +208,10 @@ public class BlogManager { return user.login(login, pass, props); } catch (IOException ioe) { ioe.printStackTrace(); - return "Error logging in - corrupt userfile"; + return "Error logging in - corrupt userfile"; } } else { - return "User does not exist"; + return "User does not exist"; } } @@ -294,17 +294,18 @@ public class BlogManager { } public String authorizeRemoteAccess(User user, String password) { - if (!user.getAuthenticated()) return "Not logged in"; + if (!user.getAuthenticated()) return "Not logged in"; String remPass = getRemotePasswordHash(); if (remPass == null) - return "Remote access password not configured - please specify a remote archive password in your syndie.config or on /admin.jsp"; + return "Remote access password not configured - please specify a remote " + + "archive password"; if (authorizeRemote(password)) { user.setAllowAccessRemote(true); saveUser(user); - return "Remote access authorized"; + return "Remote access authorized"; } else { - return "Remote access denied"; + return "Remote access denied"; } } @@ -329,15 +330,15 @@ public class BlogManager { if (hashedRegistrationPassword != null) { try { if (!hashedRegistrationPassword.equals(Base64.encode(_context.sha().calculateHash(registrationPassword.getBytes("UTF-8")).getData()))) - return "Invalid registration password"; + return "Invalid registration password"; } catch (UnsupportedEncodingException uee) { - return "Error registering"; + return "Error registering"; } } String userHash = Base64.encode(_context.sha().calculateHash(DataHelper.getUTF8(login)).getData()); File userFile = new File(_userDir, userHash); if (userFile.exists()) { - return "Cannot register the login " + login + ": it already exists"; + return "Cannot register the login " + login + ": it already exists"; } else { BlogInfo info = createBlog(blogName, blogDescription, contactURL, null); String hashedPassword = Base64.encode(_context.sha().calculateHash(DataHelper.getUTF8(password)).getData()); @@ -355,7 +356,7 @@ public class BlogManager { bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); - return "Internal error registering - " + ioe.getMessage(); + return "Internal error registering - " + ioe.getMessage() + ""; } finally { if (out != null) try { out.close(); } catch (IOException ioe) {} } @@ -367,7 +368,7 @@ public class BlogManager { public String exportHosts(User user) { if (!user.getAuthenticated() || !user.getAllowAccessRemote()) - return "Not authorized to export the hosts"; + return "Not authorized to export the hosts"; Map newNames = new HashMap(); PetNameDB db = user.getPetNameDB(); for (Iterator names = db.getNames().iterator(); names.hasNext(); ) { @@ -395,11 +396,11 @@ public class BlogManager { osw.close(); } catch (IOException ioe) { ioe.printStackTrace(); - return "Error exporting the hosts: " + ioe.getMessage(); + return "Error exporting the hosts: " + ioe.getMessage() + ""; } } } - return "Hosts exported"; + return "Hosts exported"; } public BlogURI createBlogEntry(User user, String subject, String tags, String entryHeaders, String sml) { @@ -527,25 +528,25 @@ public class BlogManager { } public String addAddress(User user, String name, String protocol, String location, String schema) { - if (!user.getAuthenticated()) return "Not logged in"; + if (!user.getAuthenticated()) return "Not logged in"; boolean ok = validateAddressName(name); - if (!ok) return "Invalid name: " + HTMLRenderer.sanitizeString(name); + if (!ok) return "Invalid name: " + HTMLRenderer.sanitizeString(name) + ""; ok = validateAddressLocation(location); - if (!ok) return "Invalid location: " + HTMLRenderer.sanitizeString(location); - if (!validateAddressSchema(schema)) return "Unsupported schema: " + HTMLRenderer.sanitizeString(schema); + if (!ok) return "Invalid location: " + HTMLRenderer.sanitizeString(location) + ""; + if (!validateAddressSchema(schema)) return "Unsupported schema: " + HTMLRenderer.sanitizeString(schema) + ""; // no need to quote user/location further, as they've been sanitized PetNameDB names = user.getPetNameDB(); if (names.exists(name)) - return "Name is already in use"; + return "Name is already in use"; PetName pn = new PetName(name, schema, protocol, location); names.set(name, pn); try { names.store(user.getAddressbookLocation()); - return "Address " + name + " written to your addressbook"; + return "Address " + name + " written to your addressbook"; } catch (IOException ioe) { - return "Error writing out the name: " + ioe.getMessage(); + return "Error writing out the name: " + ioe.getMessage() + ""; } } diff --git a/apps/syndie/java/src/net/i2p/syndie/User.java b/apps/syndie/java/src/net/i2p/syndie/User.java index 9bb1279e1a..0fe1a6c5c0 100644 --- a/apps/syndie/java/src/net/i2p/syndie/User.java +++ b/apps/syndie/java/src/net/i2p/syndie/User.java @@ -108,7 +108,7 @@ public class User { String hpass = Base64.encode(_context.sha().calculateHash(DataHelper.getUTF8(pass)).getData()); if (!hpass.equals(expectedPass)) { _authenticated = false; - return "Incorrect password"; + return "Incorrect password"; } _username = login; @@ -194,7 +194,7 @@ public class User { try { return Integer.parseInt(val); } catch (NumberFormatException nfe) { return -1; } } - public static final String LOGIN_OK = "Logged in"; + public static final String LOGIN_OK = "Logged in"; public String export() { StringBuffer buf = new StringBuffer(512); diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java index b12db6b690..b1ecec61a3 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java @@ -37,23 +37,24 @@ public class HTMLPreviewRenderer extends HTMLRenderer { File f = (File)_files.get(id); String name = (String)_filenames.get(id); String type = (String)_fileTypes.get(id); - _bodyBuffer.append(""); + _bodyBuffer.append(""); _bodyBuffer.append(sanitizeString(anchorText)).append(""); - _bodyBuffer.append(" (").append(f.length()/1024).append("KB, "); - _bodyBuffer.append(" \"").append(sanitizeString(name)).append("\", "); - _bodyBuffer.append(sanitizeString(type)).append(")"); + _bodyBuffer.append(getSpan("attachmentSummary")).append(" ("); + _bodyBuffer.append(getSpan("attachmentSummarySize")).append(f.length()/1024).append("KB, "); + _bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(name)).append("\", "); + _bodyBuffer.append(getSpan("attachmentSummaryType")).append(sanitizeString(type)).append(")"); } } public void receiveEnd() { _postBodyBuffer.append("\n"); - _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); _postBodyBuffer.append("
\n"); - _postBodyBuffer.append(" \n"); if (_files.size() > 0) { - _postBodyBuffer.append("Attachments: "); - _postBodyBuffer.append("\n"); for (int i = 0; i < _files.size(); i++) { _postBodyBuffer.append("\n"); } _postBodyBuffer.append("\n"); - _postBodyBuffer.append("
\n"); + _postBodyBuffer.append("
\n"); } if (_blogs.size() > 0) { - _postBodyBuffer.append("Blog references: "); + _postBodyBuffer.append(getSpan("summDetailBlog")).append("Blog references: "); for (int i = 0; i < _blogs.size(); i++) { Blog b = (Blog)_blogs.get(i); - _postBodyBuffer.append("").append(sanitizeString(b.name)).append(" "); } _postBodyBuffer.append("
\n"); } if (_links.size() > 0) { - _postBodyBuffer.append("External links: "); + _postBodyBuffer.append(getSpan("summDetailExternal")).append("External links: "); for (int i = 0; i < _links.size(); i++) { Link l = (Link)_links.get(i); - _postBodyBuffer.append("").append(sanitizeString(l.location)); - _postBodyBuffer.append(" (").append(sanitizeString(l.schema)).append(") "); + _postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(") "); } _postBodyBuffer.append("
\n"); } if (_addresses.size() > 0) { - _postBodyBuffer.append("Addresses: "); + _postBodyBuffer.append(getSpan("summDetailAddr")).append("Addresses:"); for (int i = 0; i < _addresses.size(); i++) { Address a = (Address)_addresses.get(i); - + String knownName = null; if (_user != null) knownName = _user.getPetNameDB().getNameByLocation(a.location); if (knownName != null) { - _postBodyBuffer.append(' ').append(sanitizeString(knownName)); + _postBodyBuffer.append(' ').append(getSpan("summDetailAddrKnown")); + _postBodyBuffer.append(sanitizeString(knownName)).append(""); } else { - _postBodyBuffer.append(" ").append(sanitizeString(a.name)).append(""); } } @@ -113,13 +124,18 @@ public class HTMLPreviewRenderer extends HTMLRenderer { } if (_archives.size() > 0) { - _postBodyBuffer.append("Archives:"); + _postBodyBuffer.append(getSpan("summDetailArchive")).append("Archives:"); for (int i = 0; i < _archives.size(); i++) { ArchiveRef a = (ArchiveRef)_archives.get(i); - _postBodyBuffer.append(" ").append(sanitizeString(a.name)).append(""); if (a.description != null) - _postBodyBuffer.append(": ").append(sanitizeString(a.description)); + _postBodyBuffer.append(": ").append(getSpan("summDetailArchiveDesc")).append(sanitizeString(a.description)).append(""); + if (null == _user.getPetNameDB().getNameByLocation(a.location)) { + _postBodyBuffer.append(" bookmark"); + } } _postBodyBuffer.append("
\n"); } diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java index d6066a7d1c..d1c5b8253d 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java @@ -61,20 +61,49 @@ public class HTMLRenderer extends EventReceiverImpl { } } + /** + * Retrieve: class="s_summary_$element" or class="s_detail_$element ss_$style_detail_$element" + */ + protected String getClass(String element) { + StringBuffer rv = new StringBuffer(64); + rv.append(" class=\"s_"); + if (_cutBody) + rv.append("summary_"); + else + rv.append("detail_"); + rv.append(element); + if (_entry != null) { + String style = sanitizeStyle(_entry.getHeader(HEADER_STYLE)); + if (style != null) { + rv.append(" ss_").append(style); + if (_cutBody) + rv.append("summary_"); + else + rv.append("detail_"); + rv.append(element); + } + } + rv.append("\" "); + return rv.toString(); + } + protected String getSpan(String element) { + return ""; + } + public void renderUnknownEntry(User user, Archive archive, BlogURI uri, Writer out) throws IOException { BlogInfo info = archive.getBlogInfo(uri); if (info == null) - out.write("
The blog " + uri.getKeyHash().toBase64() + " is not known locally. " - + "Please get it from an archive and The blog " + uri.getKeyHash().toBase64() + " is not known locally. " + + "Please get it from an archive and try again"); + + "\">try again
"); else - out.write("
The blog The blog " + info.getProperty(BlogInfo.NAME) + " is known, but the entry " + uri.getEntryId() + " is not. " - + "Please get it from an archive and try again"); + + "\">try again"); } public void render(User user, Archive archive, EntryContainer entry, Writer out, boolean cutBody, boolean showImages) throws IOException { @@ -118,64 +147,64 @@ public class HTMLRenderer extends EventReceiverImpl { public void receiveBold(String text) { if (!continueBody()) { return; } - _bodyBuffer.append("").append(sanitizeString(text)).append(""); + _bodyBuffer.append("").append(sanitizeString(text)).append(""); } public void receiveItalic(String text) { if (!continueBody()) { return; } - _bodyBuffer.append("").append(sanitizeString(text)).append(""); + _bodyBuffer.append("").append(sanitizeString(text)).append(""); } public void receiveUnderline(String text) { if (!continueBody()) { return; } - _bodyBuffer.append("").append(sanitizeString(text)).append(""); + _bodyBuffer.append("").append(sanitizeString(text)).append(""); } public void receiveHR() { if (!continueBody()) { return; } - _bodyBuffer.append("
"); + _bodyBuffer.append(getSpan("hr")).append("
"); } public void receiveH1(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); + _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); } public void receiveH2(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); + _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); } public void receiveH3(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); + _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); } public void receiveH4(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); + _bodyBuffer.append("

").append(sanitizeString(body)).append("

"); } public void receiveH5(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("
").append(sanitizeString(body)).append("
"); + _bodyBuffer.append("
").append(sanitizeString(body)).append("
"); } public void receivePre(String body) { if (!continueBody()) { return; } - _bodyBuffer.append("
").append(sanitizeString(body)).append("
"); + _bodyBuffer.append("
").append(sanitizeString(body)).append("
"); } public void receiveQuote(String text, String whoQuoted, String quoteLocationSchema, String quoteLocation) { if (!continueBody()) { return; } - _bodyBuffer.append("").append(sanitizeString(text)).append(""); + _bodyBuffer.append("").append(sanitizeString(text)).append(""); } public void receiveCode(String text, String codeLocationSchema, String codeLocation) { if (!continueBody()) { return; } - _bodyBuffer.append("").append(sanitizeString(text)).append(""); + _bodyBuffer.append("").append(sanitizeString(text)).append(""); } public void receiveImage(String alternateText, int attachmentId) { if (!continueBody()) { return; } if (_showImages) { - _bodyBuffer.append("\"").append(sanitizeTagParam(alternateText)).append("\"");"); } else { - _bodyBuffer.append("[image: attachment ").append(attachmentId); - _bodyBuffer.append(": ").append(sanitizeString(alternateText)); - _bodyBuffer.append(" view images]"); + _bodyBuffer.append(getSpan("imgSummary")).append("[image: ").append(getSpan("imgSummaryAttachment")).append(" attachment ").append(attachmentId); + _bodyBuffer.append(": ").append(getSpan("imgSummaryAlt")).append(sanitizeString(alternateText)); + _bodyBuffer.append(" view images]"); } } @@ -183,7 +212,7 @@ public class HTMLRenderer extends EventReceiverImpl { if (!continueBody()) { return; } _cutReached = true; if (_cutBody) { - _bodyBuffer.append(""); + _bodyBuffer.append(""); if ( (summaryText != null) && (summaryText.length() > 0) ) _bodyBuffer.append(sanitizeString(summaryText)); else @@ -191,7 +220,7 @@ public class HTMLRenderer extends EventReceiverImpl { _bodyBuffer.append("\n"); } else { if (summaryText != null) - _bodyBuffer.append(sanitizeString(summaryText)); + _bodyBuffer.append(getSpan("cutIgnore")).append(sanitizeString(summaryText)).append("\n"); } } @@ -202,7 +231,7 @@ public class HTMLRenderer extends EventReceiverImpl { // System.out.println("rv: " + rv + " Cut reached: " + _cutReached + " bodyBufferSize: " + _bodyBuffer.length() + " cutBody? " + _cutBody); if (!rv && !_cutReached) { // exceeded the allowed size - _bodyBuffer.append("more inside..."); + _bodyBuffer.append("more inside...\n"); _cutReached = true; } return rv; @@ -211,26 +240,26 @@ public class HTMLRenderer extends EventReceiverImpl { public void receiveNewline() { if (!continueBody()) { return; } if (true || (_lastNewlineAt >= _bodyBuffer.length())) - _bodyBuffer.append("
\n"); + _bodyBuffer.append(getSpan("nl")).append("
\n"); else _lastNewlineAt = _bodyBuffer.length(); } public void receiveLT() { if (!continueBody()) { return; } - _bodyBuffer.append("<"); + _bodyBuffer.append(getSpan("lt")).append("<"); } public void receiveGT() { if (!continueBody()) { return; } - _bodyBuffer.append(">"); + _bodyBuffer.append(getSpan("gt")).append(">"); } public void receiveBegin() {} public void receiveLeftBracket() { if (!continueBody()) { return; } - _bodyBuffer.append('['); + _bodyBuffer.append(getSpan("lb")).append("["); } public void receiveRightBracket() { if (!continueBody()) { return; } - _bodyBuffer.append(']'); + _bodyBuffer.append(getSpan("rb")).append("]"); } protected static class Blog { @@ -287,7 +316,7 @@ public class HTMLRenderer extends EventReceiverImpl { Hash blog = new Hash(blogData); if (entryId > 0) { String pageURL = getPageURL(blog, tag, entryId, -1, -1, true, (_user != null ? _user.getShowImages() : false)); - _bodyBuffer.append(""); + _bodyBuffer.append(""); if ( (description != null) && (description.trim().length() > 0) ) { _bodyBuffer.append(sanitizeString(description)); } else if ( (name != null) && (name.trim().length() > 0) ) { @@ -300,29 +329,30 @@ public class HTMLRenderer extends EventReceiverImpl { String url = getPageURL(blog, null, -1, -1, -1, (_user != null ? _user.getShowExpanded() : false), (_user != null ? _user.getShowImages() : false)); - _bodyBuffer.append(" ["); if ( (name != null) && (name.trim().length() > 0) ) _bodyBuffer.append(sanitizeString(name)); else _bodyBuffer.append("view"); - _bodyBuffer.append(" (meta)"); + _bodyBuffer.append(" (meta)"); if ( (tag != null) && (tag.trim().length() > 0) ) { url = getPageURL(blog, tag, -1, -1, -1, false, false); - _bodyBuffer.append(" Tag: ").append(sanitizeString(tag)).append(""); } if ( (locations != null) && (locations.size() > 0) ) { - _bodyBuffer.append(" Archives: "); + _bodyBuffer.append(getSpan("blogArchive")).append(" Archives: "); for (int i = 0; i < locations.size(); i++) { SafeURL surl = (SafeURL)locations.get(i); if (_user.getAuthenticated() && _user.getAllowAccessRemote()) - _bodyBuffer.append("").append(sanitizeString(surl.toString())).append(" "); + _bodyBuffer.append("").append(sanitizeString(surl.toString())).append(" "); else - _bodyBuffer.append(sanitizeString(surl.toString())).append(' '); + _bodyBuffer.append(getSpan("blogArchiveURL")).append(sanitizeString(surl.toString())).append(" "); } + _bodyBuffer.append(""); } - _bodyBuffer.append("] "); + _bodyBuffer.append("] "); } protected static class ArchiveRef { @@ -350,18 +380,19 @@ public class HTMLRenderer extends EventReceiverImpl { if (!continueBody()) { return; } - _bodyBuffer.append(sanitizeString(anchorText)).append(" [Archive "); + _bodyBuffer.append(getSpan("archive")).append(sanitizeString(anchorText)).append(""); + _bodyBuffer.append(getSpan("archiveSummary")).append(" [Archive "); if (name != null) - _bodyBuffer.append(sanitizeString(name)); + _bodyBuffer.append(getSpan("archiveSummaryName")).append(sanitizeString(name)).append(""); if (location != null) { _bodyBuffer.append(" at "); SafeURL surl = new SafeURL(locationSchema + "://" + location); - _bodyBuffer.append("").append(sanitizeString(surl.toString())).append(""); } if (description != null) - _bodyBuffer.append(": ").append(sanitizeString(description)); - _bodyBuffer.append("]"); + _bodyBuffer.append(": ").append(getSpan("archiveSummaryDesc")).append(sanitizeString(description)).append(""); + _bodyBuffer.append("]"); } protected static class Link { @@ -381,7 +412,7 @@ public class HTMLRenderer extends EventReceiverImpl { _links.add(l); if (!continueBody()) { return; } if ( (schema == null) || (location == null) ) return; - _bodyBuffer.append("").append(sanitizeString(text)).append(""); @@ -412,15 +443,20 @@ public class HTMLRenderer extends EventReceiverImpl { if (_user != null) knownName = _user.getPetNameDB().getNameByLocation(location); if (knownName != null) { - _bodyBuffer.append(sanitizeString(anchorText)); - _bodyBuffer.append(" (").append(sanitizeString(knownName)).append(")"); + _bodyBuffer.append(getSpan("addr")).append(sanitizeString(anchorText)).append(""); + _bodyBuffer.append(getSpan("addrKnownName")).append("(").append(sanitizeString(knownName)).append(")"); } else { System.err.println("Receiving address [" + location + "]"); - _bodyBuffer.append("").append(sanitizeString(anchorText)).append(""); + _bodyBuffer.append("").append(sanitizeString(anchorText)).append(""); } } @@ -428,23 +464,26 @@ public class HTMLRenderer extends EventReceiverImpl { if (!continueBody()) { return; } Attachment attachments[] = _entry.getAttachments(); if ( (id < 0) || (id >= attachments.length)) { - _bodyBuffer.append(sanitizeString(anchorText)); + _bodyBuffer.append(getSpan("attachmentUnknown")).append(sanitizeString(anchorText)).append(""); } else { - _bodyBuffer.append(""); + _bodyBuffer.append(""); _bodyBuffer.append(sanitizeString(anchorText)).append(""); - _bodyBuffer.append(" (").append(attachments[id].getDataLength()/1024).append("KB, "); - _bodyBuffer.append(" \"").append(sanitizeString(attachments[id].getName())).append("\", "); - _bodyBuffer.append(sanitizeString(attachments[id].getMimeType())).append(")"); + _bodyBuffer.append(getSpan("attachmentSummary")).append(" ("); + _bodyBuffer.append(getSpan("attachmentSummarySize")).append(attachments[id].getDataLength()/1024).append("KB, "); + _bodyBuffer.append(getSpan("attachmentSummaryName")).append(" \"").append(sanitizeString(attachments[id].getName())).append("\", "); + _bodyBuffer.append(getSpan("attachmentSummaryDesc")).append(" \"").append(sanitizeString(attachments[id].getDescription())).append("\", "); + _bodyBuffer.append(getSpan("attachmentSummaryType")).append(sanitizeString(attachments[id].getMimeType())).append(")"); } } public void receiveEnd() { - _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); if (_cutBody) { - _postBodyBuffer.append("\n"); - _postBodyBuffer.append(""); - _postBodyBuffer.append("View details... "); - + _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); + _postBodyBuffer.append(""); + _postBodyBuffer.append("View details... "); + _postBodyBuffer.append(getSpan("summ")); if ( (_entry != null) && (_entry.getAttachments() != null) && (_entry.getAttachments().length > 0) ) { int num = _entry.getAttachments().length; if (num == 1) @@ -489,11 +528,13 @@ public class HTMLRenderer extends EventReceiverImpl { String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO); if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) ) - _postBodyBuffer.append(" (view parent)\n"); + _postBodyBuffer.append(" (view parent)\n"); - _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); } else { - _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); _postBodyBuffer.append("\n"); _postBodyBuffer.append("\n"); - _postBodyBuffer.append("\n"); + _postBodyBuffer.append("\n"); if ( (_entry != null) && (_entry.getAttachments() != null) && (_entry.getAttachments().length > 0) ) { - _postBodyBuffer.append("Attachments: "); - _postBodyBuffer.append("\n"); for (int i = 0; i < _entry.getAttachments().length; i++) { _postBodyBuffer.append("\n"); } _postBodyBuffer.append("\n"); - _postBodyBuffer.append("
\n"); + _postBodyBuffer.append("
\n"); } if (_blogs.size() > 0) { - _postBodyBuffer.append("Blog references: "); + _postBodyBuffer.append(getSpan("summDetailBlog")).append("Blog references:"); for (int i = 0; i < _blogs.size(); i++) { Blog b = (Blog)_blogs.get(i); - _postBodyBuffer.append("").append(sanitizeString(b.name)).append(" "); } _postBodyBuffer.append("
\n"); } if (_links.size() > 0) { - _postBodyBuffer.append("External links: "); + _postBodyBuffer.append(getSpan("summDetailExternal")).append("External links: "); for (int i = 0; i < _links.size(); i++) { Link l = (Link)_links.get(i); - _postBodyBuffer.append("").append(sanitizeString(l.location)); - _postBodyBuffer.append(" (").append(sanitizeString(l.schema)).append(") "); + _postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(") "); } _postBodyBuffer.append("
\n"); } if (_addresses.size() > 0) { - _postBodyBuffer.append("Addresses:"); + _postBodyBuffer.append(getSpan("summDetailAddr")).append("Addresses:"); for (int i = 0; i < _addresses.size(); i++) { Address a = (Address)_addresses.get(i); @@ -561,13 +607,18 @@ public class HTMLRenderer extends EventReceiverImpl { if (_user != null) knownName = _user.getPetNameDB().getNameByLocation(a.location); if (knownName != null) { - _postBodyBuffer.append(' ').append(sanitizeString(knownName)); + _postBodyBuffer.append(' ').append(getSpan("summDetailAddrKnown")); + _postBodyBuffer.append(sanitizeString(knownName)).append(""); } else { - _postBodyBuffer.append(" ").append(sanitizeString(a.name)).append(""); } } @@ -575,16 +626,18 @@ public class HTMLRenderer extends EventReceiverImpl { } if (_archives.size() > 0) { - _postBodyBuffer.append("Archives:"); + _postBodyBuffer.append(getSpan("summDetailArchive")).append("Archives:"); for (int i = 0; i < _archives.size(); i++) { ArchiveRef a = (ArchiveRef)_archives.get(i); - _postBodyBuffer.append(" ").append(sanitizeString(a.name)).append(""); if (a.description != null) - _postBodyBuffer.append(": ").append(sanitizeString(a.description)); - _postBodyBuffer.append(" bookmark"); + _postBodyBuffer.append(": ").append(getSpan("summDetailArchiveDesc")).append(sanitizeString(a.description)).append(""); + if (null == _user.getPetNameDB().getNameByLocation(a.location)) { + _postBodyBuffer.append(" bookmark"); + } } _postBodyBuffer.append("
\n"); } @@ -592,21 +645,23 @@ public class HTMLRenderer extends EventReceiverImpl { if (_entry != null) { List replies = _archive.getIndex().getReplies(_entry.getURI()); if ( (replies != null) && (replies.size() > 0) ) { - _postBodyBuffer.append("Replies: "); + _postBodyBuffer.append(getSpan("summDetailReplies")).append("Replies: "); for (int i = 0; i < replies.size(); i++) { BlogURI reply = (BlogURI)replies.get(i); - _postBodyBuffer.append(""); + _postBodyBuffer.append(getSpan("summDetailReplyAuthor")); BlogInfo replyAuthor = _archive.getBlogInfo(reply); if (replyAuthor != null) { _postBodyBuffer.append(sanitizeString(replyAuthor.getProperty(BlogInfo.NAME))); } else { _postBodyBuffer.append(reply.getKeyHash().toBase64().substring(0,16)); } - _postBodyBuffer.append(" on "); + _postBodyBuffer.append(" on "); + _postBodyBuffer.append(getSpan("summDetailReplyDate")); _postBodyBuffer.append(getEntryDate(reply.getEntryId())); - _postBodyBuffer.append(" "); + _postBodyBuffer.append(" "); } _postBodyBuffer.append("
"); } @@ -614,10 +669,11 @@ public class HTMLRenderer extends EventReceiverImpl { String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO); if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) ) { - _postBodyBuffer.append(" (view parent)
\n"); + _postBodyBuffer.append(" (view parent)
\n"); } _postBodyBuffer.append("\n
\n\n"); + _postBodyBuffer.append("\n"); } _postBodyBuffer.append("\n"); } @@ -644,7 +700,7 @@ public class HTMLRenderer extends EventReceiverImpl { } public void receiveHeaderEnd() { - _preBodyBuffer.append("\n"); + _preBodyBuffer.append("
\n"); renderSubjectCell(); renderMetaCell(); renderPreBodyCell(); @@ -657,27 +713,28 @@ public class HTMLRenderer extends EventReceiverImpl { public static final String HEADER_PETNAME = "PetName"; private void renderSubjectCell() { - _preBodyBuffer.append(""); + _preBodyBuffer.append("\n"); + _preBodyBuffer.append(getSpan("subjectText")).append(sanitizeString(subject)); + _preBodyBuffer.append("\n"); } private void renderPreBodyCell() { + _preBodyBuffer.append(""); String bgcolor = (String)_headers.get(HEADER_BGCOLOR); - if (_cutBody) - _preBodyBuffer.append(""); + _preBodyBuffer.append(""); - if ( (tags != null) && (tags.length > 0) ) - _preBodyBuffer.append(""); _preBodyBuffer.append("\n"); } @@ -800,8 +859,12 @@ public class HTMLRenderer extends EventReceiverImpl { return str; } - public static final String sanitizeURL(String str) { return Base64.encode(DataHelper.getUTF8(str)); } + public static final String sanitizeURL(String str) { + if (str == null) return ""; + return Base64.encode(DataHelper.getUTF8(str)); + } public static final String sanitizeTagParam(String str) { + if (str == null) return ""; str = str.replace('&', '_'); // this should be & if (str.indexOf('\"') < 0) return sanitizeString(str); @@ -810,6 +873,7 @@ public class HTMLRenderer extends EventReceiverImpl { } public static final String sanitizeXML(String orig) { + if (orig == null) return ""; if (orig.indexOf('&') < 0) return orig; StringBuffer rv = new StringBuffer(orig.length()+32); for (int i = 0; i < orig.length(); i++) { @@ -821,6 +885,7 @@ public class HTMLRenderer extends EventReceiverImpl { return rv.toString(); } public static final String sanitizeXML(StringBuffer orig) { + if (orig == null) return ""; if (orig.indexOf("&") < 0) return orig.toString(); for (int i = 0; i < orig.length(); i++) { if (orig.charAt(i) == '&') { @@ -830,7 +895,17 @@ public class HTMLRenderer extends EventReceiverImpl { } return orig.toString(); } - + + private static final String STYLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; + public static String sanitizeStyle(String style) { + if ( (style == null) || (style.trim().length() <= 0) ) return null; + char c[] = style.toCharArray(); + for (int i = 0; i < c.length; i++) + if (STYLE_CHARS.indexOf(c[i]) < 0) + c[i] = '_'; + return new String(c); + } + protected String getEntryURL() { return getEntryURL(_user != null ? _user.getShowImages() : false); } protected String getEntryURL(boolean showImages) { if (_entry == null) return "unknown"; diff --git a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java index 93a0c2b204..59b18c2948 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java @@ -20,25 +20,6 @@ public class ArchiveViewerBean { else return HTMLRenderer.sanitizeString(info.getProperty("Name")); } - public static String getEntryTitle(String keyHash, long entryId) { - String name = getBlogName(keyHash); - return getEntryTitleDate(name, entryId); - } - - private static final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.UK); - public static final String getEntryTitleDate(String blogName, long when) { - synchronized (_dateFormat) { - try { - String str = _dateFormat.format(new Date(when)); - long dayBegin = _dateFormat.parse(str).getTime(); - return blogName + ":
" + str + "-" + (when - dayBegin) + ""; - } catch (ParseException pe) { - pe.printStackTrace(); - // wtf - return "unknown"; - } - } - } /** base64 encoded hash of the blog's public key, or null for no filtering by blog */ public static final String PARAM_BLOG = "blog"; @@ -91,13 +72,12 @@ public class ArchiveViewerBean { BlogManager.instance().saveUser(user); } - out.write("
"); + _preBodyBuffer.append("
"); + _preBodyBuffer.append("
"); String subject = (String)_headers.get(HEADER_SUBJECT); if (subject == null) subject = "[no subject]"; - _preBodyBuffer.append(sanitizeString(subject)); - _preBodyBuffer.append("
"); - else - _preBodyBuffer.append("
"); + _preBodyBuffer.append("
"); } private void renderMetaCell() { String tags[] = (_entry != null ? _entry.getTags() : null); - if ( (tags != null) && (tags.length > 0) ) - _preBodyBuffer.append("
"); - _preBodyBuffer.append("
\n"); + _preBodyBuffer.append("\n"); String knownName = null; if ( (_entry != null) && (_user != null) ) @@ -689,30 +746,30 @@ public class HTMLRenderer extends EventReceiverImpl { if (_entry != null) info = _archive.getBlogInfo(_entry.getURI()); if (info != null) { - _preBodyBuffer.append(""); + _preBodyBuffer.append(""); if (knownName != null) { - _preBodyBuffer.append(sanitizeString(knownName)); + _preBodyBuffer.append(getSpan("metaKnown")).append(sanitizeString(knownName)).append(""); } else { String nameStr = info.getProperty("Name"); if (nameStr == null) - _preBodyBuffer.append("[no name]"); + _preBodyBuffer.append(getSpan("metaUnknown")).append("[no name]"); else - _preBodyBuffer.append(sanitizeString(nameStr)); + _preBodyBuffer.append(getSpan("metaUnknown")).append(sanitizeString(nameStr)).append(""); } _preBodyBuffer.append(""); } else { - _preBodyBuffer.append("[unknown blog]"); + _preBodyBuffer.append(getSpan("metaUnknown")).append("[unknown blog]"); } if ( (_user != null) && (_user.getAuthenticated()) && (_entry != null) ) { PetName pn = _user.getPetNameDB().get(knownName); if ( (pn == null) || (!pn.isMember("Favorites")) ) - _preBodyBuffer.append(" "); + _preBodyBuffer.append(" "); if ( (pn == null) || (!pn.isMember("Ignore")) ) - _preBodyBuffer.append(" "); + _preBodyBuffer.append(" "); else - _preBodyBuffer.append(" "); + _preBodyBuffer.append(" "); _preBodyBuffer.append(" "); if (info != null) _preBodyBuffer.append(" "); @@ -720,8 +777,8 @@ public class HTMLRenderer extends EventReceiverImpl { if ( (tags != null) && (tags.length > 0) ) { - _preBodyBuffer.append(" Tags: "); - _preBodyBuffer.append(""); for (int i = 0; tags != null && i < tags.length; i++) { _preBodyBuffer.append("
"); + out.write("
"); for (int i = 0; i < props.length; i++) { if (props[i].equals(BlogInfo.OWNER_KEY)) { - out.write(""); String blogURL = HTMLRenderer.getPageURL(blog, null, -1, -1, -1, false, false); - out.write("" + Base64.encode(blog.getData()) + "\n"); + out.write("\n"); } else if (props[i].equals(BlogInfo.SIGNATURE)) { continue; } else if (props[i].equals(BlogInfo.POSTERS)) { SigningPublicKey keys[] = info.getPosters(); if ( (keys != null) && (keys.length > 0) ) { - out.write(""); + out.write("\n"); } } else { - out.write("\n"); + out.write("\n"); } } List tags = BlogManager.instance().getArchive().getIndex().getBlogTags(blog); if ( (tags != null) && (tags.size() > 0) ) { - out.write(""); } out.write("
Blog:"); + out.write("
Blog:
" + Base64.encode(blog.getData()) + "
Allowed authors:"); + out.write("
Allowed authors:"); for (int j = 0; j < keys.length; j++) { - out.write(keys[j].calculateHash().toBase64()); + out.write("" + keys[j].calculateHash().toBase64() + ""); if (j + 1 < keys.length) out.write("
\n"); } out.write("
" + HTMLRenderer.sanitizeString(props[i]) + ":" + - HTMLRenderer.sanitizeString(info.getProperty(props[i])) + "
" + HTMLRenderer.sanitizeString(props[i]) + + ":" + HTMLRenderer.sanitizeString(info.getProperty(props[i])) + "
Known tags:"); + out.write("
Known tags:"); for (int i = 0; i < tags.size(); i++) { String tag = (String)tags.get(i); - out.write("" + + out.write("" + HTMLRenderer.sanitizeString(tag) + " "); } out.write("
"); } else { - out.write("Blog not specified"); + out.write("Blog not specified"); } } } diff --git a/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java b/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java index 81c97ce661..1a435a258c 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java @@ -558,7 +558,7 @@ public class RemoteArchiveBean { public void renderDeltaForm(User user, ArchiveIndex localIndex, Writer out) throws IOException { Archive archive = BlogManager.instance().getArchive(); StringBuffer buf = new StringBuffer(512); - buf.append("New blogs: \n"); Set localBlogs = archive.getIndex().getUniqueBlogs(); Set remoteBlogs = _remoteIndex.getUniqueBlogs(); int newBlogs = 0; @@ -573,12 +573,12 @@ public class RemoteArchiveBean { } if (newBlogs > 0) { out.write(buf.toString()); - out.write("
\n"); + out.write("
\n"); } int newEntries = 0; int localNew = 0; - out.write("\n"); + out.write("
\n"); List entries = new ArrayList(); for (Iterator iter = remoteBlogs.iterator(); iter.hasNext(); ) { Hash blog = (Hash)iter.next(); @@ -586,37 +586,44 @@ public class RemoteArchiveBean { continue; buf.setLength(0); int shownEntries = 0; - buf.append("\n"); - buf.append("\n"); + buf.append(""); + buf.append(""); + buf.append(""); + buf.append("\n"); entries.clear(); _remoteIndex.selectMatchesOrderByEntryId(entries, blog, null); for (int i = 0; i < entries.size(); i++) { BlogURI uri = (BlogURI)entries.get(i); - buf.append("\n"); + buf.append("\n"); if (!archive.getIndex().getEntryIsKnown(uri)) { - buf.append("\n"); + buf.append("\n"); newEntries++; shownEntries++; } else { String page = HTMLRenderer.getPageURL(blog, null, uri.getEntryId(), -1, -1, user.getShowExpanded(), user.getShowImages()); - buf.append("\n"); + buf.append("\n"); } - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); buf.append("\n"); @@ -630,22 +637,22 @@ public class RemoteArchiveBean { // now for posts in known blogs that we have and they don't entries.clear(); localIndex.selectMatchesOrderByEntryId(entries, blog, null); - buf.append("\n"); + buf.append("\n"); for (int i = 0; i < entries.size(); i++) { BlogURI uri = (BlogURI)entries.get(i); if (!_remoteIndex.getEntryIsKnown(uri)) { - buf.append("\n"); - buf.append("\n"); + buf.append("\n"); + buf.append("\n"); shownEntries++; newEntries++; localNew++; - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); buf.append("\n"); @@ -659,7 +666,7 @@ public class RemoteArchiveBean { // now for posts in blogs we have and they don't int newBefore = localNew; buf.setLength(0); - buf.append("\n"); + buf.append("\n"); for (Iterator iter = localBlogs.iterator(); iter.hasNext(); ) { Hash blog = (Hash)iter.next(); if (remoteBlogs.contains(blog)) { @@ -672,15 +679,15 @@ public class RemoteArchiveBean { for (int i = 0; i < entries.size(); i++) { BlogURI uri = (BlogURI)entries.get(i); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); - buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); + buf.append("\n"); buf.append("\n"); @@ -692,13 +699,13 @@ public class RemoteArchiveBean { out.write("
\n"); + buf.append("
\n"); BlogInfo info = archive.getBlogInfo(blog); if (info != null) { - buf.append("" + HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.NAME)) + ": " + - HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.DESCRIPTION)) + "\n"); + buf.append("").append(HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.NAME))).append(": "); + buf.append("").append(HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.DESCRIPTION))); + buf.append("\n"); } else { - buf.append("" + blog.toBase64() + "\n"); + buf.append("" + blog.toBase64() + "\n"); } buf.append("
 Posted on#SizeTags
 "); + buf.append("Posted on#SizeTags
(local)(local)" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + _remoteIndex.getBlogEntrySizeKB(uri) + "KB"); + buf.append("" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + _remoteIndex.getBlogEntrySizeKB(uri) + "KB"); for (Iterator titer = new TreeSet(_remoteIndex.getBlogEntryTags(uri)).iterator(); titer.hasNext(); ) { String tag = (String)titer.next(); - buf.append("" + tag + " \n"); + buf.append("" + tag + " \n"); } buf.append("
Entries we have, but the remote Syndie doesn't:
Entries we have, but the remote Syndie doesn't:
" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + localIndex.getBlogEntrySizeKB(uri) + "KB"); + buf.append("" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + localIndex.getBlogEntrySizeKB(uri) + "KB"); for (Iterator titer = new TreeSet(localIndex.getBlogEntryTags(uri)).iterator(); titer.hasNext(); ) { String tag = (String)titer.next(); - buf.append("" + tag + " \n"); + buf.append("" + tag + " \n"); } buf.append("
Blogs the remote Syndie doesn't have
Blogs the remote Syndie doesn't have
" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + localIndex.getBlogEntrySizeKB(uri) + "KB"); + buf.append("
" + getDate(uri.getEntryId()) + "" + getId(uri.getEntryId()) + "" + localIndex.getBlogEntrySizeKB(uri) + "KB"); for (Iterator titer = new TreeSet(localIndex.getBlogEntryTags(uri)).iterator(); titer.hasNext(); ) { String tag = (String)titer.next(); - buf.append("" + tag + " \n"); + buf.append("" + tag + " \n"); } buf.append("
\n"); if (newEntries > 0) { - out.write(" \n"); - out.write(" \n"); + out.write(" \n"); + out.write(" \n"); } else { - out.write(HTMLRenderer.sanitizeString(_remoteLocation) + " has no new posts to offer us\n"); + out.write("" + HTMLRenderer.sanitizeString(_remoteLocation) + " has no new posts to offer us\n"); } if (localNew > 0) { - out.write(" \n"); + out.write(" \n"); } out.write("
\n"); } diff --git a/apps/syndie/jsp/_bodyindex.jsp b/apps/syndie/jsp/_bodyindex.jsp index e31810486b..ebb41702bf 100644 --- a/apps/syndie/jsp/_bodyindex.jsp +++ b/apps/syndie/jsp/_bodyindex.jsp @@ -31,10 +31,9 @@ if (user.getAuthenticated() && (null != request.getParameter("action")) ) { BlogManager.instance().saveUser(user); } } -%> - -"> - \ No newline at end of file diff --git a/apps/syndie/jsp/addresses.jsp b/apps/syndie/jsp/addresses.jsp index d5e067ddf5..f420346343 100644 --- a/apps/syndie/jsp/addresses.jsp +++ b/apps/syndie/jsp/addresses.jsp @@ -1,20 +1,20 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %><% + request.setCharacterEncoding("UTF-8"); %> SyndieMedia addressbook - +
-Blogs: <%ArchiveViewerBean.renderBlogSelector(user, request.getParameterMap(), out);%> - - - +%> +
+Blogs: <%ArchiveViewerBean.renderBlogSelector(user, request.getParameterMap(), out);%> + + <%ArchiveViewerBean.renderBlogs(user, request.getParameterMap(), out, "
");%>
\ No newline at end of file diff --git a/apps/syndie/jsp/_topnav.jsp b/apps/syndie/jsp/_topnav.jsp index db26180d8e..921a1bd4cd 100644 --- a/apps/syndie/jsp/_topnav.jsp +++ b/apps/syndie/jsp/_topnav.jsp @@ -1,15 +1,18 @@ <%@page import="net.i2p.syndie.*, net.i2p.syndie.sml.*, net.i2p.syndie.web.*" %> -
Home -Syndie admin -Remote archives -Import -
<% + +Home +Syndie admin +Remote archives +Import +<% if ("true".equals(request.getParameter("logout"))) { user.invalidate(); + RemoteArchiveBean rem = (RemoteArchiveBean)session.getAttribute("remote"); + if (rem != null) rem.reinitialize(); + PostBean post = (PostBean)session.getAttribute("post"); + if (post != null) post.reinitialize(); } String login = request.getParameter("login"); String pass = request.getParameter("password"); @@ -17,28 +20,27 @@ String loginSubmit = request.getParameter("Login"); if ( (login != null) && (pass != null) && (loginSubmit != null) && (loginSubmit.equals("Login")) ) { String loginResult = BlogManager.instance().login(user, login, pass); if (!user.getAuthenticated()) - out.write("" + loginResult + ""); + out.write("" + loginResult + ""); } %> <% if (user.getAuthenticated()) { %> -Logged in as: : -<%=HTMLRenderer.sanitizeString(ArchiveViewerBean.getBlogName(user.getBlogStr()))%> -Post -Metadata -Addressbook -Logout
+Logged in as: : +<%=HTMLRenderer.sanitizeString(ArchiveViewerBean.getBlogName(user.getBlogStr()))%> +Post +Metadata +Addressbook +Logout <%} else {%> -Login: -Pass: <% +Login: +Pass: <% java.util.Enumeration params = request.getParameterNames(); while (params.hasMoreElements()) { String p = (String)params.nextElement(); String val = request.getParameter(p); %><% }%> - -Register + +Register <% } %> -
- - + + - - +
<% +
<% if (!user.getAuthenticated()) { - %>You must log in to view your addressbook<% + %>You must log in to view your addressbook<% } else { PetNameDB names = user.getPetNameDB(); String action = request.getParameter("action"); @@ -31,11 +31,11 @@ if (!user.getAuthenticated()) { names.remove(oldPetname); names.set(cur.getName(), cur); names.store(user.getAddressbookLocation()); - %>Address updated<% + %>Address updated<% } } else if ( (action != null) && ("Add".equals(action)) ) { PetName cur = names.get(request.getParameter("name")); - if (cur != null) { %>Address already exists<% } else { + if (cur != null) { %>Address already exists<% } else { cur = new PetName(); cur.setName(request.getParameter("name")); cur.setNetwork(request.getParameter("network")); @@ -45,29 +45,36 @@ if (!user.getAuthenticated()) { cur.setGroups(request.getParameter("groups")); names.set(cur.getName(), cur); names.store(user.getAddressbookLocation()); - %>Address added<% + %>Address added<% } } else if ( (action != null) && ("Delete".equals(action)) ) { PetName cur = names.get(request.getParameter("name")); if (cur != null) { names.remove(cur.getName()); names.store(user.getAddressbookLocation()); - %>Address removed<% + %>Address removed<% } } else if ( (action != null) && ("Export".equals(action)) ) { %><%=BlogManager.instance().exportHosts(user)%><% } TreeSet sorted = new TreeSet(names.getNames()); - %> - + %>
NameNetworkProtocolLocationPublic?Groups 
+ + + + + + + + <% StringBuffer buf = new StringBuffer(128); for (Iterator iter = sorted.iterator(); iter.hasNext(); ) { PetName name = names.get((String)iter.next()); - buf.append(""); + buf.append(""); buf.append(""); - buf.append(""); + buf.append(""); + + buf.append(""); - buf.append(""); + buf.append(""); + buf.append(""); out.write(buf.toString()); buf.setLength(0); @@ -156,26 +169,29 @@ if (!user.getAuthenticated()) { if (name == null || active) name = ""; if (loc == null || active) loc= ""; %> - - + + - - - - - + + + + - - + +
NameNetworkProtocolLocationPublic?Groups 
"); - buf.append(""); - if (name.getLocation() != null) - buf.append(""); - else - buf.append(""); + buf.append(""); + if (name.getLocation() != null) + buf.append(""); + else + buf.append(""); + + buf.append(""); - buf.append(" "); + buf.append("\" />"); + buf.append(" "); buf.append("
Export the eepsites to your router's userhosts.txt:
+ Export the eepsites to your router's userhosts.txt: +
<% diff --git a/apps/syndie/jsp/admin.jsp b/apps/syndie/jsp/admin.jsp index 61b3d77163..59eb76dd02 100644 --- a/apps/syndie/jsp/admin.jsp +++ b/apps/syndie/jsp/admin.jsp @@ -1,20 +1,20 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %><% +request.setCharacterEncoding("UTF-8"); +%> SyndieMedia admin - + - - + + - - + diff --git a/apps/syndie/jsp/externallink.jsp b/apps/syndie/jsp/externallink.jsp index 43c8ba0e28..f5744e8474 100644 --- a/apps/syndie/jsp/externallink.jsp +++ b/apps/syndie/jsp/externallink.jsp @@ -1,17 +1,19 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.*, net.i2p.syndie.web.*, net.i2p.syndie.sml.*" %> -<% request.setCharacterEncoding("UTF-8"); %> +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.*, net.i2p.syndie.web.*, net.i2p.syndie.sml.*" %><% +request.setCharacterEncoding("UTF-8"); +%>SyndieMedia - +
<% +
<% if (!user.getAuthenticated()) { - %>You must be logged in to configure your Syndie instance!<% + %>You must be logged in to configure your Syndie instance!<% } else { String action = request.getParameter("action"); if ( (action != null) && ("Save".equals(action)) ) { @@ -30,50 +30,51 @@ if (!user.getAuthenticated()) { int port = -1; try { port = Integer.parseInt(proxyPort); } catch (NumberFormatException nfe) { port = 4444; } BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, null); - %>Configuration updated<% + %>Configuration updated<% } else { - %>Invalid admin password. If you lost it, please update your syndie.config.<% + %>Invalid admin password. If you lost it, please update your syndie.config.<% } } else { int port = -1; try { port = Integer.parseInt(proxyPort); } catch (NumberFormatException nfe) { port = 4444; } BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, null); - %>Configuration saved<% + %>Configuration saved<% } } else { %>
-Registration password:
-Users must specify this password on the registration form to proceed. If this is -blank, anyone can register.
-Remote password:
-To access remote archives, users must first provide this password on their +Registration password:
+Users must specify this password on the registration form to proceed. If this is +blank, anyone can register.
+Remote password:
+To access remote archives, users must first provide this password on their metadata page. Remote access is 'dangerous', as it allows the user to instruct this Syndie instance to establish HTTP connections with arbitrary locations. If -this field is not specified, no one can use remote archives.
-Default remote proxy host:
-Default remote proxy port:
-This is the default HTTP proxy shown on the remote archive page.
-Default blog selector:
-The selector lets you choose what blog (or blogs) are shown on the front page for -new, unregistered users. Valid values include:
    -
  • ALL: all blogs
  • -
  • blog://$blogHash: all posts in the blog identified by $blogHash
  • -
  • blogtag://$blogHash/$tagBase64: all posts in the blog identified by $blogHash +this field is not specified, no one can use remote archives.
    +Default remote proxy host:
    +Default remote proxy port:
    +This is the default HTTP proxy shown on the remote archive page.
    +Default blog selector:
    +The selector lets you choose what blog (or blogs) are shown on the front page for +new, unregistered users. Valid values include:
      +
    • ALL: all blogs
    • +
    • blog://$blogHash: all posts in the blog identified by $blogHash
    • +
    • blogtag://$blogHash/$tagBase64: all posts in the blog identified by $blogHash tagged by the tag whose modified base64 encoding is $tagBase64
    • -
    • tag://$tagBase64: all posts in any blog tagged by the tag whose +
    • tag://$tagBase64: all posts in any blog tagged by the tag whose modified base64 encoding is $tagBase64
    +

    <% if (!BlogManager.instance().isConfigured()) { long passNum = new Random().nextLong(); %> -Administrative password:
    -Since this Syndie instance is not already configured, you can specify a new +Administrative password:
    +Since this Syndie instance is not already configured, you can specify a new administrative password which must be presented whenever you update this configuration. -The default value filled in there is <%=passNum%>
    +The default value filled in there is <%=passNum%>

    <% } else { %> -Administrative password:
    +Administrative password:
    <% } %> - + <% } } %>
- - + + - - + +%>
Are you sure you really want to go to +
+Are you sure you really want to go to <% String loc = request.getParameter("location"); String schema = request.getParameter("schema"); @@ -21,14 +23,14 @@ if (schema != null) schema = HTMLRenderer.sanitizeString(DataHelper.getUTF8(Base if (desc != null) desc = HTMLRenderer.sanitizeString(DataHelper.getUTF8(Base64.decode(desc))); if ( (loc != null) && (schema != null) ) { - out.write(loc + " (" + schema + ")"); + out.write("" + loc + " "); if (desc != null) - out.write(": " + desc); + out.write(": "); out.write("? "); - out.write("yes"); + out.write("yes"); } else { - out.write("(some unspecified location...)"); + out.write("(some unspecified location...)"); } -%>
\ No newline at end of file diff --git a/apps/syndie/jsp/import.jsp b/apps/syndie/jsp/import.jsp index 2827367121..652fcf0eeb 100644 --- a/apps/syndie/jsp/import.jsp +++ b/apps/syndie/jsp/import.jsp @@ -1,18 +1,19 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*, java.io.*" %><% +request.setCharacterEncoding("UTF-8"); +%> SyndieMedia import - + - - + + - - +
<% +
<% String contentType = request.getContentType(); if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { @@ -23,7 +24,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { if (meta == null) break; if (!BlogManager.instance().importBlogMetadata(meta)) { - System.err.println("blog meta " + metaId + " failed to be imported"); + %>Metadata <%=metaId%> failed to be imported
<% break; } metaId++; @@ -34,7 +35,7 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { if (entry == null) break; if (!BlogManager.instance().importBlogEntry(entry)) { - System.err.println("blog entry " + entryId + " failed to be imported"); + %>Entry <%=entryId%> failed to be imported
<% break; } entryId++; @@ -44,23 +45,23 @@ if ((contentType != null) && (contentType.indexOf("boundary=") != -1) ) { BlogManager.instance().getArchive().regenerateIndex(); session.setAttribute("index", BlogManager.instance().getArchive().getIndex()); } -%>Imported <%=entryId%> posts and <%=metaId%> blog metadata files. +%>Imported <%=entryId%> posts and <%=metaId%> blog metadata files. <% } else { %> -Blog metadata 0:
-Blog metadata 1:
-Post 0:
-Post 1:
-Post 2:
-Post 3:
-Post 4:
-Post 5:
-Post 6:
-Post 7:
-Post 8:
-Post 9:
+Blog metadata 0:
+Blog metadata 1:
+Post 0:
+Post 1:
+Post 2:
+Post 3:
+Post 4:
+Post 5:
+Post 6:
+Post 7:
+Post 8:
+Post 9:

- + <% } %>
diff --git a/apps/syndie/jsp/index.jsp b/apps/syndie/jsp/index.jsp index b7a7aa1ef1..3fbbe7dc27 100644 --- a/apps/syndie/jsp/index.jsp +++ b/apps/syndie/jsp/index.jsp @@ -1,9 +1,10 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*" %> -<% request.setCharacterEncoding("UTF-8"); %> +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*" %><% +request.setCharacterEncoding("UTF-8"); +%> SyndieMedia - + " rel="alternate" type="application/rss+xml" /> +%>" rel="alternate" type="application/rss+xml" > - - + + - - + +
\ No newline at end of file diff --git a/apps/syndie/jsp/post.jsp b/apps/syndie/jsp/post.jsp index 08020b445f..f92a7716dd 100644 --- a/apps/syndie/jsp/post.jsp +++ b/apps/syndie/jsp/post.jsp @@ -1,22 +1,23 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.data.*, net.i2p.syndie.*, org.mortbay.servlet.MultiPartRequest, java.util.*" %><% +request.setCharacterEncoding("UTF-8"); +%> -SyndieMedia - +SyndieMedia post + - - + + - - +
<% +
<% if (!user.getAuthenticated()) { - %>You must be logged in to post<% + %>You must be logged in to post<% } else { String confirm = request.getParameter("action"); if ( (confirm != null) && (confirm.equalsIgnoreCase("confirm")) ) { @@ -24,10 +25,10 @@ if (!user.getAuthenticated()) { post.setArchive(archive); BlogURI uri = post.postEntry(); if (uri != null) { - %>Blog entry posted!<% + %>Blog entry posted!<% } else { - %>There was an unknown error posting the entry...<% + %>There was an unknown error posting the entry...<% } post.reinitialize(); post.setUser(user); @@ -95,11 +96,11 @@ if (!user.getAuthenticated()) { } post.renderPreview(out); - %>
+ %>
Please confirm that the above is ok<% if (user.getAllowAccessRemote()) { %>, and select what additional archives you want the post transmitted to. Otherwise, just hit your browser's back arrow and make changes. - <% PetNameDB db = user.getPetNameDB(); @@ -115,22 +116,22 @@ for (Iterator iter = names.iterator(); iter.hasNext(); ) { out.write("\n"); } %> -
<% } %> -<% +
<% } %>
+<% } else { // logged in and not confirmed because they didn't send us anything! // give 'em a new form %> -Post subject:
-Post tags:
-Post style:
+Post tags:
+Post style:
-Include public names?
-Post content (in raw SML, no headers):
-
-SML cheatsheet:

+SML cheatsheet:

-SML post headers:
-
<% +SML post headers:
+
<% String s = request.getParameter(ArchiveViewerBean.PARAM_IN_REPLY_TO); if ( (s != null) && (s.trim().length() > 0) ) {%> <% } %> -Attachment 0:
-Attachment 1:
-Attachment 2:
-Attachment 3:
+Attachment 0:
+Attachment 1:
+Attachment 2:
+Attachment 3:

- + <% } // end of the 'logged in, not confirmed, nothing posted' section } // end of the 'logged in, not confirmed' section diff --git a/apps/syndie/jsp/register.jsp b/apps/syndie/jsp/register.jsp index 2288e98024..660735ed43 100644 --- a/apps/syndie/jsp/register.jsp +++ b/apps/syndie/jsp/register.jsp @@ -1,18 +1,19 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.data.Base64, net.i2p.syndie.web.*, net.i2p.syndie.sml.*, net.i2p.syndie.*" %><% +request.setCharacterEncoding("UTF-8"); +%> SyndieMedia - + - - + + - - + diff --git a/apps/syndie/jsp/remote.jsp b/apps/syndie/jsp/remote.jsp index b207bb7cc0..506280606a 100644 --- a/apps/syndie/jsp/remote.jsp +++ b/apps/syndie/jsp/remote.jsp @@ -1,32 +1,34 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*, net.i2p.syndie.*, net.i2p.syndie.sml.*, java.util.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - - - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*, net.i2p.syndie.*, net.i2p.syndie.sml.*, java.util.*" %><% +request.setCharacterEncoding("UTF-8"); +%> -SyndieMedia - +SyndieMedia remote +
<% +
<% String regLogin = request.getParameter("login"); boolean showForm = true; if ( (regLogin != null) && ("Register".equals(request.getParameter("Register"))) ) { @@ -23,25 +24,25 @@ if ( (regLogin != null) && ("Register".equals(request.getParameter("Register"))) String url = request.getParameter("contacturl"); String regResult = BlogManager.instance().register(user, regLogin, regUserPass, regPass, blogName, desc, url); if (User.LOGIN_OK.equals(regResult)) { - out.print("Registration successful. Continue...\n"); - showForm = false; + %>Registration successful. Continue... +<% showForm = false; } else { - out.print("" + regResult + ""); + %><%=regResult%><% } } if (showForm) {%> -

To create a new blog (and Syndie user account), please fill out the following form. +

To create a new blog (and Syndie user account), please fill out the following form. You may need to enter a registration password given to you by this Syndie instance's operator, or there may be no registration password in place (in which case you can leave that field blank).

-

-Syndie login:
-New password:
-Registration password:
-Blog name:
-Brief description:
-Contact URL: (e.g. mailto://user@mail.i2p, http://foo.i2p/, etc)
- +

+Syndie login:
+New password:
+Registration password:
+Blog name:
+Brief description:
+Contact URL: (e.g. mailto://user@mail.i2p, http://foo.i2p/, etc)
+

<% } %>
- - + + - - +
-<% +
<% if (!user.getAuthenticated() || !user.getAllowAccessRemote()) { -%>Sorry, you are not allowed to access remote archives from here. Perhaps you should install Syndie yourself?<% -} else { %>Import from: - -Proxy :
-Bookmarked archives: +
+Bookmarked archives: or -" /> -
+" /> +
+ <% String action = request.getParameter("action"); if ("Continue...".equals(action)) { @@ -58,20 +61,20 @@ for (Iterator iter = user.getPetNameDB().getNames().iterator(); iter.hasNext(); remote.postSelectedEntries(user, request.getParameterMap()); } String msgs = remote.getStatus(); - if ( (msgs != null) && (msgs.length() > 0) ) { %>
<%=msgs%>
-Refresh

<% + if ( (msgs != null) && (msgs.length() > 0) ) { %>
<%=msgs%>
+Refresh

<% } - if (remote.getFetchIndexInProgress()) { %>Please wait while the index is being fetched -from <%=remote.getRemoteLocation()%>. <% + if (remote.getFetchIndexInProgress()) { %>Please wait while the index is being fetched +from <%=remote.getRemoteLocation()%>.<% } else if (remote.getRemoteIndex() != null) { // remote index is NOT null! - %><%=remote.getRemoteLocation()%> -<%=remote.getRemoteLocation()%> +(refetch):
<%remote.renderDeltaForm(user, archive, out);%> -<% +<% } } %> diff --git a/apps/syndie/jsp/style.jsp b/apps/syndie/jsp/style.jsp index b6c8550f76..c1b37f3ee4 100644 --- a/apps/syndie/jsp/style.jsp +++ b/apps/syndie/jsp/style.jsp @@ -1,3 +1,7 @@ -<%@page contentType="text/css; charset=UTF-8" pageEncoding="UTF-8" %> +<%@page contentType="text/css; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.util.FileUtil" %> <% request.setCharacterEncoding("UTF-8"); %> -<%@include file="syndie.css" %> \ No newline at end of file +<%@include file="syndie.css" %> +<% +String content = FileUtil.readTextFile("./docs/syndie_standard.css", -1, true); +if (content != null) out.write(content); +%> \ No newline at end of file diff --git a/apps/syndie/jsp/syndie.css b/apps/syndie/jsp/syndie.css index b35a5d4a4c..e0d1f02c48 100644 --- a/apps/syndie/jsp/syndie.css +++ b/apps/syndie/jsp/syndie.css @@ -1,67 +1,92 @@ -.syndieEntrySubjectCell { - background-color: #999999; - font-size: 12px; - font-weight: bold; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieEntryMetaCell { - background-color: #888888; - font-size: 10px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieEntryAttachmentsCell { - background-color: #aaaaaa; - font-size: 12px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieEntrySummaryCell { - background-color: #eeeeee; - font-size: 12px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieEntryBodyCell { - background-color: #eeeeee; - font-size: 12px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieTopNavBlogsCell { - background-color: #888888; - font-size: 14px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieTopNavRemoteCell { - background-color: #888888; - font-size: 14px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} -.syndieTopNavManageCell { - background-color: #888888; - font-size: 14px; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; - border: 0px; -} - body { margin : 0px; padding : 0px; - text-align : center; font-family: Arial, Helvetica, sans-serif; - background-color : #FFFFFF; + background-color : #EEEEEE; color: #000000; - font-size: 12px; + font-size: 12px; +} +.b_topnavUser { + text-align: right; + background-color: #CCCCDD; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; +} +.b_topnavHome { + background-color: #CCCCDD; + color: #000000; + width: 50px; + text-align: left; +} +.b_topnav { + background-color: #CCCCDD; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; +} +.s_detail_subject { + font-size: 10px; + text-align: left; + background-color: #BBBBFF; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; + border-style: none; +} +.s_detail_meta { + font-size: 10px; + text-align: right: + background-color: #BBBBFF; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; + border-style: none; +} + +.s_summary_subject { + font-size: 10px; + text-align: left; + background-color: #BBBBFF; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; + border-style: none; +} +.s_summary_meta { + font-size: 10px; + text-align: right: + background-color: #BBBBFF; + border-spacing: 0px; + margin: 0px; + padding: 0px; + border-width: 0px; + border: 0px; + border-style: none; +} +.s_summary_summDetail { + font-size: 10px; +} +.s_detail_summDetail { +} +.s_detail_summDetailBlog { +} +.s_detail_summDetailBlogLink { +} +td.s_detail_summDetail { + background-color: #DDDDFF; +} +td.s_summary_summ { + font-size: 10px; + background-color: #DDDDFF; } diff --git a/apps/syndie/jsp/viewmetadata.jsp b/apps/syndie/jsp/viewmetadata.jsp index 750b46ff81..06005d0515 100644 --- a/apps/syndie/jsp/viewmetadata.jsp +++ b/apps/syndie/jsp/viewmetadata.jsp @@ -1,29 +1,31 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*, net.i2p.syndie.*" %> -<% request.setCharacterEncoding("UTF-8"); %> - +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*, net.i2p.syndie.*" %><% +request.setCharacterEncoding("UTF-8"); +%> -SyndieMedia - +SyndieMedia metadata + - - + + - - +
<% +
<% ArchiveViewerBean.renderMetadata(request.getParameterMap(), out); if (user.getAuthenticated()) { if ("Authorize".equals(request.getParameter("action"))) { - %><%=BlogManager.instance().authorizeRemoteAccess(user, request.getParameter("password"))%><% + %><%=BlogManager.instance().authorizeRemoteAccess(user, request.getParameter("password"))%><% } if (!user.getAllowAccessRemote()) { if (user.getBlog().toBase64().equals(request.getParameter("blog"))) { %>
" /> -To access remote instances from this instance, please supply the Syndie administration password: - +To access remote instances from this instance, please supply the Syndie administration password: + + <% } } diff --git a/core/java/src/net/i2p/crypto/SHA256Generator.java b/core/java/src/net/i2p/crypto/SHA256Generator.java index 22880a2394..acffc75695 100644 --- a/core/java/src/net/i2p/crypto/SHA256Generator.java +++ b/core/java/src/net/i2p/crypto/SHA256Generator.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.ArrayList; import java.util.List; import net.i2p.I2PAppContext; +import net.i2p.data.Base64; import net.i2p.data.Hash; import org.bouncycastle.crypto.digests.SHA256Digest; @@ -72,5 +73,7 @@ public final class SHA256Generator { byte out[] = new byte[Hash.HASH_LENGTH]; d.doFinal(out, 0); System.out.println("eq? " + net.i2p.data.DataHelper.eq(out, old.getData())); + for (int i = 0; i < args.length; i++) + System.out.println("SHA256 [" + args[i] + "] = [" + Base64.encode(ctx.sha().calculateHash(args[i].getBytes()).getData()) + "]"); } } \ No newline at end of file diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index 6cb8088526..0c54250f0e 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -131,6 +131,7 @@ public class FileUtil { * * @param startAtBeginning if true, read the first maxNumLines, otherwise read * the last maxNumLines + * @param maxNumLines max number of lines (or -1 for unlimited) * */ public static String readTextFile(String filename, int maxNumLines, boolean startAtBeginning) { @@ -140,11 +141,11 @@ public class FileUtil { try { fis = new FileInputStream(f); BufferedReader in = new BufferedReader(new InputStreamReader(fis)); - List lines = new ArrayList(maxNumLines); + List lines = new ArrayList(maxNumLines > 0 ? maxNumLines : 64); String line = null; while ( (line = in.readLine()) != null) { lines.add(line); - if (lines.size() >= maxNumLines) { + if ( (maxNumLines > 0) && (lines.size() >= maxNumLines) ) { if (startAtBeginning) break; else