forked from I2P_Developers/i2p.i2p
remote w0rks
This commit is contained in:
@ -40,6 +40,10 @@ public class Archive {
|
||||
public boolean accept(File dir, String name) { return name.endsWith(".snd"); }
|
||||
};
|
||||
|
||||
static {
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
public Archive(I2PAppContext ctx, String rootDir, String cacheDir) {
|
||||
_context = ctx;
|
||||
_rootDir = new File(rootDir);
|
||||
@ -319,7 +323,7 @@ public class Archive {
|
||||
|
||||
public static String getEntryFilename(long entryId) { return entryId + ".snd"; }
|
||||
|
||||
private static SimpleDateFormat _dateFmt = new SimpleDateFormat("yyyyMMdd");
|
||||
private static SimpleDateFormat _dateFmt = new SimpleDateFormat("yyyyMMdd", Locale.UK);
|
||||
public static String getIndexName(long entryId, int numBytes) {
|
||||
try {
|
||||
synchronized (_dateFmt) {
|
||||
|
@ -6,6 +6,7 @@ import java.util.*;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.*;
|
||||
import net.i2p.syndie.data.*;
|
||||
import net.i2p.syndie.sml.*;
|
||||
|
||||
/**
|
||||
* Dig through the archive to build an index
|
||||
@ -53,6 +54,8 @@ class ArchiveIndexer {
|
||||
long totalSize = 0;
|
||||
int newBlogs = 0;
|
||||
|
||||
SMLParser parser = new SMLParser();
|
||||
|
||||
for (int i = 0; i < blogs.size(); i++) {
|
||||
BlogInfo cur = (BlogInfo)blogs.get(i);
|
||||
Hash key = cur.getKey().calculateHash();
|
||||
@ -86,6 +89,16 @@ class ArchiveIndexer {
|
||||
newEntries++;
|
||||
newSize += entry.getCompleteSize();
|
||||
}
|
||||
HeaderReceiver rec = new HeaderReceiver();
|
||||
parser.parse(entry.getEntry().getText(), rec);
|
||||
String reply = rec.getHeader(HTMLRenderer.HEADER_IN_REPLY_TO);
|
||||
if (reply != null) {
|
||||
BlogURI parent = new BlogURI(reply.trim());
|
||||
if ( (parent.getKeyHash() != null) && (parent.getEntryId() >= 0) )
|
||||
rv.addReply(parent, entry.getURI());
|
||||
else
|
||||
System.err.println("Parent of " + entry.getURI() + " is not valid: [" + reply.trim() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
long lowestEntryId = -1;
|
||||
@ -134,4 +147,43 @@ class ArchiveIndexer {
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static class HeaderReceiver implements SMLParser.EventReceiver {
|
||||
private Properties _headers;
|
||||
public HeaderReceiver() { _headers = null; }
|
||||
public String getHeader(String name) { return (_headers != null ? _headers.getProperty(name) : null); }
|
||||
public void receiveHeader(String header, String value) {
|
||||
if (_headers == null) _headers = new Properties();
|
||||
_headers.setProperty(header, value);
|
||||
}
|
||||
|
||||
public void receiveAddress(String name, String schema, String location, String anchorText) {}
|
||||
public void receiveArchive(String name, String description, String locationSchema, String location, String postingKey, String anchorText) {}
|
||||
public void receiveAttachment(int id, String anchorText) {}
|
||||
public void receiveBegin() {}
|
||||
public void receiveBlog(String name, String blogKeyHash, String blogPath, long blogEntryId, List blogArchiveLocations, String anchorText) {}
|
||||
public void receiveBold(String text) {}
|
||||
public void receiveCode(String text, String codeLocationSchema, String codeLocation) {}
|
||||
public void receiveCut(String summaryText) {}
|
||||
public void receiveEnd() {}
|
||||
public void receiveGT() {}
|
||||
public void receiveH1(String text) {}
|
||||
public void receiveH2(String text) {}
|
||||
public void receiveH3(String text) {}
|
||||
public void receiveH4(String text) {}
|
||||
public void receiveH5(String text) {}
|
||||
public void receiveHR() {}
|
||||
public void receiveHeaderEnd() {}
|
||||
public void receiveImage(String alternateText, int attachmentId) {}
|
||||
public void receiveItalic(String text) {}
|
||||
public void receiveLT() {}
|
||||
public void receiveLeftBracket() {}
|
||||
public void receiveLink(String schema, String location, String text) {}
|
||||
public void receiveNewline() {}
|
||||
public void receivePlain(String text) {}
|
||||
public void receivePre(String text) {}
|
||||
public void receiveQuote(String text, String whoQuoted, String quoteLocationSchema, String quoteLocation) {}
|
||||
public void receiveRightBracket() {}
|
||||
public void receiveUnderline(String text) {}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ public class ArchiveIndex {
|
||||
protected List _newestBlogs;
|
||||
/** list of BlogURI objects */
|
||||
protected List _newestEntries;
|
||||
/** parent message to a set of replies, ordered with the oldest first */
|
||||
protected Map _replies;
|
||||
protected Properties _headers;
|
||||
|
||||
public ArchiveIndex() {
|
||||
@ -36,6 +38,7 @@ public class ArchiveIndex {
|
||||
_newestBlogs = new ArrayList();
|
||||
_newestEntries = new ArrayList();
|
||||
_headers = new Properties();
|
||||
_replies = Collections.synchronizedMap(new HashMap());
|
||||
_generatedOn = -1;
|
||||
if (shouldLoad)
|
||||
setIsLocal("true");
|
||||
@ -138,7 +141,13 @@ public class ArchiveIndex {
|
||||
rv.add(getBlog(i));
|
||||
return rv;
|
||||
}
|
||||
|
||||
public List getReplies(BlogURI uri) {
|
||||
Set replies = (Set)_replies.get(uri);
|
||||
if (replies == null) return Collections.EMPTY_LIST;
|
||||
synchronized (replies) {
|
||||
return new ArrayList(replies);
|
||||
}
|
||||
}
|
||||
public void setLocation(String location) {
|
||||
try {
|
||||
File l = new File(location);
|
||||
@ -255,14 +264,16 @@ public class ArchiveIndex {
|
||||
}
|
||||
if (tag != null) {
|
||||
if (!tag.equals(summary.tag)) {
|
||||
System.out.println("Tag [" + summary.tag + "] does not match the requested [" + tag + "]");
|
||||
System.out.println("Tag [" + summary.tag + "] does not match the requested [" + tag + "] in " + summary.blog.toBase64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < summary.entries.size(); j++) {
|
||||
EntrySummary entry = (EntrySummary)summary.entries.get(j);
|
||||
ordered.put(new Long(0-entry.entry.getEntryId()), entry.entry);
|
||||
String k = (Long.MAX_VALUE-entry.entry.getEntryId()) + "-" + entry.entry.getKeyHash().toBase64();
|
||||
ordered.put(k, entry.entry);
|
||||
System.err.println("Including match: " + k);
|
||||
}
|
||||
}
|
||||
for (Iterator iter = ordered.values().iterator(); iter.hasNext(); ) {
|
||||
@ -319,7 +330,7 @@ public class ArchiveIndex {
|
||||
_blogs.add(summary);
|
||||
}
|
||||
|
||||
private SimpleDateFormat _dateFmt = new SimpleDateFormat("yyyyMMdd");
|
||||
private SimpleDateFormat _dateFmt = new SimpleDateFormat("yyyyMMdd", Locale.UK);
|
||||
private long getIndexDate(String yyyymmdd) {
|
||||
synchronized (_dateFmt) {
|
||||
try {
|
||||
|
@ -31,6 +31,19 @@ public class BlogURI {
|
||||
_entryId = -1;
|
||||
}
|
||||
}
|
||||
} else if (uri.startsWith("entry://")) {
|
||||
int off = "entry://".length();
|
||||
_blogHash = new Hash(Base64.decode(uri.substring(off, off+44))); // 44 chars == base64(32 bytes)
|
||||
int entryStart = uri.indexOf('/', off+1);
|
||||
if (entryStart < 0) {
|
||||
_entryId = -1;
|
||||
} else {
|
||||
try {
|
||||
_entryId = Long.parseLong(uri.substring(entryStart+1).trim());
|
||||
} catch (NumberFormatException nfe) {
|
||||
_entryId = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_blogHash = null;
|
||||
_entryId = -1;
|
||||
@ -61,7 +74,10 @@ public class BlogURI {
|
||||
DataHelper.eq(_blogHash, ((BlogURI)obj)._blogHash);
|
||||
}
|
||||
public int hashCode() {
|
||||
return (int)_entryId;
|
||||
int rv = (int)_entryId;
|
||||
if (_blogHash != null)
|
||||
rv += _blogHash.hashCode();
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
@ -69,6 +85,8 @@ public class BlogURI {
|
||||
test("blog://Vq~AlW-r7OM763okVUFIDvVFzxOjpNNsAx0rFb2yaE8=");
|
||||
test("blog://Vq~AlW-r7OM763okVUFIDvVFzxOjpNNsAx0rFb2yaE8=/");
|
||||
test("blog://Vq~AlW-r7OM763okVUFIDvVFzxOjpNNsAx0rFb2yaE8=/123456789");
|
||||
test("entry://Vq~AlW-r7OM763okVUFIDvVFzxOjpNNsAx0rFb2yaE8=/");
|
||||
test("entry://Vq~AlW-r7OM763okVUFIDvVFzxOjpNNsAx0rFb2yaE8=/123456789");
|
||||
}
|
||||
private static void test(String uri) {
|
||||
BlogURI u = new BlogURI(uri);
|
||||
|
@ -67,4 +67,36 @@ public class LocalArchiveIndex extends ArchiveIndex {
|
||||
if (!_newestEntries.contains(entry))
|
||||
_newestEntries.add(entry);
|
||||
}
|
||||
|
||||
public void addReply(BlogURI parent, BlogURI reply) {
|
||||
Set replies = (Set)_replies.get(parent);
|
||||
if (replies == null) {
|
||||
replies = Collections.synchronizedSet(new TreeSet(BlogURIComparator.HIGHEST_ID_FIRST));
|
||||
_replies.put(parent, replies);
|
||||
}
|
||||
replies.add(reply);
|
||||
System.err.println("Adding reply to " + parent + " from child " + reply + " (# replies: " + replies.size() + ")");
|
||||
}
|
||||
|
||||
private static class BlogURIComparator implements Comparator {
|
||||
public static final BlogURIComparator HIGHEST_ID_FIRST = new BlogURIComparator(true);
|
||||
public static final BlogURIComparator HIGHEST_ID_LAST = new BlogURIComparator(false);
|
||||
private boolean _highestFirst;
|
||||
public BlogURIComparator(boolean highestFirst) {
|
||||
_highestFirst = highestFirst;
|
||||
}
|
||||
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
if ( (lhs == null) || !(lhs instanceof BlogURI) ) return 1;
|
||||
if ( (rhs == null) || !(rhs instanceof BlogURI) ) return -1;
|
||||
BlogURI l = (BlogURI)lhs;
|
||||
BlogURI r = (BlogURI)rhs;
|
||||
if (l.getEntryId() > r.getEntryId())
|
||||
return (_highestFirst ? 1 : -1);
|
||||
else if (l.getEntryId() < r.getEntryId())
|
||||
return (_highestFirst ? -1 : 1);
|
||||
else
|
||||
return DataHelper.compareTo(l.getKeyHash().getData(), r.getKeyHash().getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
package net.i2p.syndie.data;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.*;
|
||||
import net.i2p.syndie.Archive;
|
||||
import net.i2p.syndie.BlogManager;
|
||||
|
||||
/**
|
||||
* Simple read-only summary of an archive, proxied to the BlogManager's instance
|
||||
*/
|
||||
public class TransparentArchiveIndex extends ArchiveIndex {
|
||||
public TransparentArchiveIndex() { super(false); }
|
||||
|
||||
private static ArchiveIndex index() { return BlogManager.instance().getArchive().getIndex(); }
|
||||
|
||||
public String getVersion() { return index().getVersion(); }
|
||||
public Properties getHeaders() { return index().getHeaders(); }
|
||||
public int getAllBlogs() { return index().getAllBlogs(); }
|
||||
public int getNewBlogs() { return index().getNewBlogs(); }
|
||||
public int getAllEntries() { return index().getAllEntries(); }
|
||||
public int getNewEntries() { return index().getNewEntries(); }
|
||||
public long getTotalSize() { return index().getTotalSize(); }
|
||||
public long getNewSize() { return index().getNewSize(); }
|
||||
public long getGeneratedOn() { return index().getGeneratedOn(); }
|
||||
|
||||
public String getNewSizeStr() { return index().getNewSizeStr(); }
|
||||
public String getTotalSizeStr() { return index().getTotalSizeStr(); }
|
||||
|
||||
/** how many blogs/tags are indexed */
|
||||
public int getIndexBlogs() { return index().getIndexBlogs(); }
|
||||
/** get the blog used for the given blog/tag pair */
|
||||
public Hash getBlog(int index) { return index().getBlog(index); }
|
||||
/** get the tag used for the given blog/tag pair */
|
||||
public String getBlogTag(int index) { return index().getBlogTag(index); }
|
||||
/** get the highest entry ID for the given blog/tag pair */
|
||||
public long getBlogLastUpdated(int index) { return index().getBlogLastUpdated(index); }
|
||||
/** get the entry count for the given blog/tag pair */
|
||||
public int getBlogEntryCount(int index) { return index().getBlogEntryCount(index); }
|
||||
/** get the entry from the given blog/tag pair */
|
||||
public BlogURI getBlogEntry(int index, int entryIndex) { return index().getBlogEntry(index, entryIndex); }
|
||||
/** get the raw entry size (including attachments) from the given blog/tag pair */
|
||||
public long getBlogEntrySizeKB(int index, int entryIndex) { return index().getBlogEntrySizeKB(index, entryIndex); }
|
||||
public boolean getEntryIsKnown(BlogURI uri) { return index().getEntryIsKnown(uri); }
|
||||
public long getBlogEntrySizeKB(BlogURI uri) { return index().getBlogEntrySizeKB(uri); }
|
||||
public Set getBlogEntryTags(BlogURI uri) { return index().getBlogEntryTags(uri); }
|
||||
/** how many 'new' blogs are listed */
|
||||
public int getNewestBlogCount() { return index().getNewestBlogCount(); }
|
||||
public Hash getNewestBlog(int index) { return index().getNewestBlog(index); }
|
||||
/** how many 'new' entries are listed */
|
||||
public int getNewestBlogEntryCount() { return index().getNewestBlogEntryCount(); }
|
||||
public BlogURI getNewestBlogEntry(int index) { return index().getNewestBlogEntry(index); }
|
||||
|
||||
/** list of locally known tags (String) under the given blog */
|
||||
public List getBlogTags(Hash blog) { return index().getBlogTags(blog); }
|
||||
/** list of unique blogs locally known (set of Hash) */
|
||||
public Set getUniqueBlogs() { return index().getUniqueBlogs(); }
|
||||
public void setLocation(String location) { return; }
|
||||
public void setIsLocal(String val) { return; }
|
||||
public void load(File location) throws IOException { return; }
|
||||
/** load up the index from an archive.txt */
|
||||
public void load(InputStream index) throws IOException { return; }
|
||||
|
||||
/**
|
||||
* Dig through the index for BlogURIs matching the given criteria, ordering the results by
|
||||
* their own entryIds.
|
||||
*
|
||||
* @param out where to store the matches
|
||||
* @param blog if set, what blog key must the entries be under
|
||||
* @param tag if set, what tag must the entry be in
|
||||
*
|
||||
*/
|
||||
public void selectMatchesOrderByEntryId(List out, Hash blog, String tag) {
|
||||
index().selectMatchesOrderByEntryId(out, blog, tag);
|
||||
}
|
||||
|
||||
/** export the index into an archive.txt */
|
||||
public String toString() { return index().toString(); }
|
||||
}
|
@ -412,6 +412,20 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
else if (addrs > 1)
|
||||
_postBodyBuffer.append(addrs).append(" addresses ");
|
||||
|
||||
if (_entry != null) {
|
||||
List replies = _archive.getIndex().getReplies(_entry.getURI());
|
||||
if ( (replies != null) && (replies.size() > 0) ) {
|
||||
if (replies.size() == 1)
|
||||
_postBodyBuffer.append("1 reply ");
|
||||
else
|
||||
_postBodyBuffer.append(replies.size()).append(" replies ");
|
||||
}
|
||||
}
|
||||
|
||||
String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO);
|
||||
if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) )
|
||||
_postBodyBuffer.append(" <a href=\"").append(getPageURL(sanitizeTagParam(inReplyTo))).append("\">(view parent)</a>\n");
|
||||
|
||||
_postBodyBuffer.append("</td></tr>\n");
|
||||
} else {
|
||||
_postBodyBuffer.append("<tr class=\"syndieEntryAttachmentsCell\">\n");
|
||||
@ -486,6 +500,35 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
}
|
||||
|
||||
|
||||
if (_entry != null) {
|
||||
List replies = _archive.getIndex().getReplies(_entry.getURI());
|
||||
if ( (replies != null) && (replies.size() > 0) ) {
|
||||
_postBodyBuffer.append("<b>Replies:</b> ");
|
||||
for (int i = 0; i < replies.size(); i++) {
|
||||
BlogURI reply = (BlogURI)replies.get(i);
|
||||
_postBodyBuffer.append("<a href=\"");
|
||||
_postBodyBuffer.append(getPageURL(reply.getKeyHash(), null, reply.getEntryId(), -1, -1, true, _user.getShowImages()));
|
||||
_postBodyBuffer.append("\">");
|
||||
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(getEntryDate(reply.getEntryId()));
|
||||
_postBodyBuffer.append("</a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />");
|
||||
}
|
||||
}
|
||||
|
||||
String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO);
|
||||
if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) ) {
|
||||
_postBodyBuffer.append(" <a href=\"").append(getPageURL(sanitizeTagParam(inReplyTo))).append("\">(view parent)</a><br />\n");
|
||||
}
|
||||
|
||||
_postBodyBuffer.append("</td>\n</form>\n</tr>\n");
|
||||
}
|
||||
_postBodyBuffer.append("</table>\n");
|
||||
@ -525,6 +568,9 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
}
|
||||
|
||||
private void renderMetaCell() {
|
||||
String tags[] = (_entry != null ? _entry.getTags() : null);
|
||||
if ( (tags != null) && (tags.length > 0) )
|
||||
_preBodyBuffer.append("<form action=\"index.jsp\">");
|
||||
_preBodyBuffer.append("<td nowrap=\"true\" align=\"right\" valign=\"top\" class=\"syndieEntryMetaCell\">\n");
|
||||
BlogInfo info = null;
|
||||
if (_entry != null)
|
||||
@ -540,11 +586,16 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
} else {
|
||||
_preBodyBuffer.append("[unknown blog]");
|
||||
}
|
||||
String tags[] = (_entry != null ? _entry.getTags() : null);
|
||||
if ( (tags != null) && (tags.length > 0) ) {
|
||||
_preBodyBuffer.append(" Tags: ");
|
||||
_preBodyBuffer.append("<i>");
|
||||
_preBodyBuffer.append("<select name=\"selector\">");
|
||||
for (int i = 0; tags != null && i < tags.length; i++) {
|
||||
_preBodyBuffer.append("<option value=\"blogtag://");
|
||||
_preBodyBuffer.append(_entry.getURI().getKeyHash().toBase64());
|
||||
_preBodyBuffer.append('/').append(Base64.encode(tags[i])).append("\">");
|
||||
_preBodyBuffer.append(sanitizeString(tags[i]));
|
||||
_preBodyBuffer.append("</option>\n");
|
||||
/*
|
||||
_preBodyBuffer.append("<a href=\"");
|
||||
_preBodyBuffer.append(getPageURL(_entry.getURI().getKeyHash(), tags[i], -1, -1, -1, (_user != null ? _user.getShowExpanded() : false), (_user != null ? _user.getShowImages() : false)));
|
||||
_preBodyBuffer.append("\">");
|
||||
@ -552,23 +603,32 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
_preBodyBuffer.append("</a>");
|
||||
if (i + 1 < tags.length)
|
||||
_preBodyBuffer.append(", ");
|
||||
*/
|
||||
}
|
||||
_preBodyBuffer.append("</i>");
|
||||
_preBodyBuffer.append("</select>");
|
||||
_preBodyBuffer.append("<input type=\"submit\" value=\"View\" />\n");
|
||||
//_preBodyBuffer.append("</i>");
|
||||
}
|
||||
_preBodyBuffer.append(" ");
|
||||
/*
|
||||
String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO);
|
||||
if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) )
|
||||
_preBodyBuffer.append(" <a href=\"").append(getPageURL(sanitizeTagParam(inReplyTo))).append("\">In reply to</a>\n");
|
||||
*/
|
||||
|
||||
if (_entry != null)
|
||||
_preBodyBuffer.append(getEntryDate(_entry.getURI().getEntryId()));
|
||||
else
|
||||
_preBodyBuffer.append(getEntryDate(new Date().getTime()));
|
||||
String inReplyTo = (String)_headers.get(HEADER_IN_REPLY_TO);
|
||||
if ( (inReplyTo != null) && (inReplyTo.trim().length() > 0) )
|
||||
_preBodyBuffer.append(" <a href=\"").append(getPageURL(sanitizeTagParam(inReplyTo))).append("\">In reply to</a>\n");
|
||||
if ( (_user != null) && (_user.getAuthenticated()) )
|
||||
_preBodyBuffer.append(" <a href=\"").append(getPostURL(_user.getBlog(), true)).append("\">Reply</a>\n");
|
||||
_preBodyBuffer.append("\n</td></tr>\n");
|
||||
_preBodyBuffer.append("\n</td>");
|
||||
if ( (tags != null) && (tags.length > 0) )
|
||||
_preBodyBuffer.append("</form>");
|
||||
_preBodyBuffer.append("</tr>\n");
|
||||
}
|
||||
|
||||
private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.UK);
|
||||
private final String getEntryDate(long when) {
|
||||
synchronized (_dateFormat) {
|
||||
try {
|
||||
@ -656,13 +716,19 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPageURL(String selector) {
|
||||
return getPageURL(_user, selector);
|
||||
}
|
||||
|
||||
public static String getPageURL(User user, String selector) {
|
||||
ArchiveViewerBean.Selector sel = new ArchiveViewerBean.Selector(selector);
|
||||
return getPageURL(sel.blog, sel.tag, sel.entry, sel.group, -1, -1, user.getShowExpanded(), user.getShowImages());
|
||||
public String getPageURL(String selector) { return getPageURL(_user, selector); }
|
||||
public static String getPageURL(User user, String selector) { return getPageURL(user, selector, -1, -1); }
|
||||
public static String getPageURL(User user, String selector, int numPerPage, int pageNum) {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("index.jsp?");
|
||||
buf.append("selector=").append(sanitizeTagParam(selector)).append("&");
|
||||
if ( (pageNum >= 0) && (numPerPage > 0) ) {
|
||||
buf.append(ArchiveViewerBean.PARAM_PAGE_NUMBER).append('=').append(pageNum).append('&');
|
||||
buf.append(ArchiveViewerBean.PARAM_NUM_PER_PAGE).append('=').append(numPerPage).append('&');
|
||||
}
|
||||
buf.append(ArchiveViewerBean.PARAM_EXPAND_ENTRIES).append('=').append(user.getShowExpanded()).append('&');
|
||||
buf.append(ArchiveViewerBean.PARAM_SHOW_IMAGES).append('=').append(user.getShowImages()).append('&');
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String getPageURL(Hash blog, String tag, long entryId, int numPerPage, int pageNum, boolean expandEntries, boolean showImages) {
|
||||
|
178
apps/syndie/java/src/net/i2p/syndie/web/ArchiveServlet.java
Normal file
178
apps/syndie/java/src/net/i2p/syndie/web/ArchiveServlet.java
Normal file
@ -0,0 +1,178 @@
|
||||
package net.i2p.syndie.web;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import net.i2p.data.*;
|
||||
import net.i2p.syndie.*;
|
||||
import net.i2p.syndie.data.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ArchiveServlet extends HttpServlet {
|
||||
|
||||
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String path = req.getPathInfo();
|
||||
if ( (path == null) || (path.trim().length() <= 1) ) {
|
||||
renderRootIndex(resp);
|
||||
return;
|
||||
} else if (path.endsWith(Archive.INDEX_FILE)) {
|
||||
renderSummary(resp);
|
||||
} else {
|
||||
String blog = getBlog(path);
|
||||
if (path.endsWith(Archive.METADATA_FILE)) {
|
||||
renderMetadata(blog, resp);
|
||||
} else if (path.endsWith(".snd")) {
|
||||
renderEntry(blog, getEntry(path), resp);
|
||||
} else {
|
||||
renderBlogIndex(blog, resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getBlog(String path) {
|
||||
System.err.println("Blog: [" + path + "]");
|
||||
int start = 0;
|
||||
int end = -1;
|
||||
int len = path.length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (path.charAt(i) != '/') {
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int j = start + 1; j < len; j++) {
|
||||
if (path.charAt(j) == '/') {
|
||||
end = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (end < 0) end = len;
|
||||
String rv = path.substring(start, end);
|
||||
System.err.println("Blog: [" + path + "] rv: [" + rv + "]");
|
||||
return rv;
|
||||
}
|
||||
|
||||
private long getEntry(String path) {
|
||||
int start = path.lastIndexOf('/');
|
||||
if (start < 0) return -1;
|
||||
if (!(path.endsWith(".snd"))) return -1;
|
||||
String rv = path.substring(start+1, path.length()-".snd".length());
|
||||
System.err.println("Entry: [" + path + "] rv: [" + rv + "]");
|
||||
try {
|
||||
return Long.parseLong(rv);
|
||||
} catch (NumberFormatException nfe) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderRootIndex(HttpServletResponse resp) throws ServletException, IOException {
|
||||
resp.setContentType("text/html");
|
||||
OutputStream out = resp.getOutputStream();
|
||||
out.write("<a href=\"archive.txt\">archive.txt</a><br />\n".getBytes());
|
||||
ArchiveIndex index = BlogManager.instance().getArchive().getIndex();
|
||||
Set blogs = index.getUniqueBlogs();
|
||||
for (Iterator iter = blogs.iterator(); iter.hasNext(); ) {
|
||||
Hash blog = (Hash)iter.next();
|
||||
String s = blog.toBase64();
|
||||
out.write(("<a href=\"" + s + "/\">" + s + "</a><br />\n").getBytes());
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void renderSummary(HttpServletResponse resp) throws ServletException, IOException {
|
||||
resp.setContentType("text/plain");
|
||||
OutputStream out = resp.getOutputStream();
|
||||
ArchiveIndex index = BlogManager.instance().getArchive().getIndex();
|
||||
out.write(index.toString().getBytes());
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void renderMetadata(String blog, HttpServletResponse resp) throws ServletException, IOException {
|
||||
byte b[] = Base64.decode(blog);
|
||||
if ( (b == null) || (b.length != Hash.HASH_LENGTH) ) {
|
||||
resp.sendError(404, "Invalid blog requested");
|
||||
return;
|
||||
}
|
||||
Hash h = new Hash(b);
|
||||
BlogInfo info = BlogManager.instance().getArchive().getBlogInfo(h);
|
||||
if (info == null) {
|
||||
resp.sendError(404, "Blog does not exist");
|
||||
return;
|
||||
}
|
||||
resp.setContentType("application/x-syndie-meta");
|
||||
OutputStream out = resp.getOutputStream();
|
||||
info.write(out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void renderBlogIndex(String blog, HttpServletResponse resp) throws ServletException, IOException {
|
||||
byte b[] = Base64.decode(blog);
|
||||
if ( (b == null) || (b.length != Hash.HASH_LENGTH) ) {
|
||||
resp.sendError(404, "Invalid blog requested");
|
||||
return;
|
||||
}
|
||||
Hash h = new Hash(b);
|
||||
|
||||
BlogInfo info = BlogManager.instance().getArchive().getBlogInfo(h);
|
||||
if (info == null) {
|
||||
resp.sendError(404, "Blog does not exist");
|
||||
return;
|
||||
}
|
||||
resp.setContentType("text/html");
|
||||
OutputStream out = resp.getOutputStream();
|
||||
out.write("<a href=\"..\">..</a><br />\n".getBytes());
|
||||
out.write(("<a href=\"" + Archive.METADATA_FILE + "\">" + Archive.METADATA_FILE + "</a><br />\n").getBytes());
|
||||
List entries = new ArrayList(64);
|
||||
BlogManager.instance().getArchive().getIndex().selectMatchesOrderByEntryId(entries, h, null);
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
BlogURI entry = (BlogURI)entries.get(i);
|
||||
out.write(("<a href=\"" + entry.getEntryId() + ".snd\">" + entry.getEntryId() + ".snd</a><br />\n").getBytes());
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void renderEntry(String blog, long entryId, HttpServletResponse resp) throws ServletException, IOException {
|
||||
byte b[] = Base64.decode(blog);
|
||||
if ( (b == null) || (b.length != Hash.HASH_LENGTH) ) {
|
||||
resp.sendError(404, "Invalid blog requested");
|
||||
return;
|
||||
}
|
||||
Hash h = new Hash(b);
|
||||
BlogInfo info = BlogManager.instance().getArchive().getBlogInfo(h);
|
||||
if (info == null) {
|
||||
resp.sendError(404, "Blog does not exist");
|
||||
return;
|
||||
}
|
||||
File root = BlogManager.instance().getArchive().getArchiveDir();
|
||||
File blogDir = new File(root, blog);
|
||||
if (!blogDir.exists()) {
|
||||
resp.sendError(404, "Blog does not exist");
|
||||
return;
|
||||
}
|
||||
File entry = new File(blogDir, entryId + ".snd");
|
||||
if (!entry.exists()) {
|
||||
resp.sendError(404, "Entry does not exist");
|
||||
return;
|
||||
}
|
||||
resp.setContentType("application/x-syndie-post");
|
||||
dump(entry, resp);
|
||||
}
|
||||
|
||||
private void dump(File source, HttpServletResponse resp) throws ServletException, IOException {
|
||||
FileInputStream in = new FileInputStream(source);
|
||||
OutputStream out = resp.getOutputStream();
|
||||
byte buf[] = new byte[1024];
|
||||
int read = 0;
|
||||
while ( (read = in.read(buf)) != -1)
|
||||
out.write(buf, 0, read);
|
||||
out.close();
|
||||
in.close();
|
||||
}
|
||||
}
|
@ -25,8 +25,8 @@ public class ArchiveViewerBean {
|
||||
return getEntryTitleDate(name, entryId);
|
||||
}
|
||||
|
||||
private static final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
private static final String getEntryTitleDate(String blogName, long when) {
|
||||
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));
|
||||
@ -115,6 +115,22 @@ public class ArchiveViewerBean {
|
||||
|
||||
Archive archive = BlogManager.instance().getArchive();
|
||||
ArchiveIndex index = archive.getIndex();
|
||||
|
||||
for (int i = 0; i < index.getNewestBlogCount(); i++) {
|
||||
Hash cur = index.getNewestBlog(i);
|
||||
String blog = Base64.encode(cur.getData());
|
||||
out.write("<option value=\"blog://" + blog + "\">");
|
||||
out.write("New blog: ");
|
||||
BlogInfo info = archive.getBlogInfo(cur);
|
||||
String name = info.getProperty(BlogInfo.NAME);
|
||||
if (name != null)
|
||||
name = HTMLRenderer.sanitizeString(name);
|
||||
else
|
||||
name = Base64.encode(cur.getData());
|
||||
out.write(name);
|
||||
out.write("</option>\n");
|
||||
}
|
||||
|
||||
List allTags = new ArrayList();
|
||||
// perhaps sort this by name (even though it isnt unique...)
|
||||
Set blogs = index.getUniqueBlogs();
|
||||
@ -178,7 +194,7 @@ public class ArchiveViewerBean {
|
||||
return user.getDefaultSelector();
|
||||
}
|
||||
|
||||
public static void renderBlogs(User user, Map parameters, Writer out) throws IOException {
|
||||
public static void renderBlogs(User user, Map parameters, Writer out, String afterPagination) throws IOException {
|
||||
String blogStr = getString(parameters, PARAM_BLOG);
|
||||
Hash blog = null;
|
||||
if (blogStr != null) blog = new Hash(Base64.decode(blogStr));
|
||||
@ -211,7 +227,7 @@ public class ArchiveViewerBean {
|
||||
boolean showImages = getBool(parameters, PARAM_SHOW_IMAGES, (user != null ? user.getShowImages() : false));
|
||||
boolean regenerateIndex = getBool(parameters, PARAM_REGENERATE_INDEX, false);
|
||||
try {
|
||||
renderBlogs(user, blog, tag, entryId, group, numPerPage, pageNum, expandEntries, showImages, regenerateIndex, out);
|
||||
renderBlogs(user, blog, tag, entryId, group, numPerPage, pageNum, expandEntries, showImages, regenerateIndex, sel, out, afterPagination);
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
throw ioe;
|
||||
@ -263,8 +279,8 @@ public class ArchiveViewerBean {
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderBlogs(User user, Hash blog, String tag, long entryId, String group, int numPerPage, int pageNum,
|
||||
boolean expandEntries, boolean showImages, boolean regenerateIndex, Writer out) throws IOException {
|
||||
private static void renderBlogs(User user, Hash blog, String tag, long entryId, String group, int numPerPage, int pageNum,
|
||||
boolean expandEntries, boolean showImages, boolean regenerateIndex, String selector, Writer out, String afterPagination) throws IOException {
|
||||
Archive archive = BlogManager.instance().getArchive();
|
||||
if (regenerateIndex)
|
||||
archive.regenerateIndex();
|
||||
@ -293,7 +309,11 @@ public class ArchiveViewerBean {
|
||||
pages++;
|
||||
out.write("<i>");
|
||||
if (pageNum > 0) {
|
||||
String prevURL = HTMLRenderer.getPageURL(blog, tag, entryId, group, numPerPage, pageNum-1, expandEntries, showImages);
|
||||
String prevURL = null;
|
||||
if ( (selector == null) || (selector.trim().length() <= 0) )
|
||||
prevURL = HTMLRenderer.getPageURL(blog, tag, entryId, group, numPerPage, pageNum-1, expandEntries, showImages);
|
||||
else
|
||||
prevURL = HTMLRenderer.getPageURL(user, selector, numPerPage, pageNum-1);
|
||||
System.out.println("prevURL: " + prevURL);
|
||||
out.write(" <a href=\"" + prevURL + "\"><<</a>");
|
||||
} else {
|
||||
@ -301,7 +321,11 @@ public class ArchiveViewerBean {
|
||||
}
|
||||
out.write("Page " + (pageNum+1) + " of " + pages);
|
||||
if (pageNum + 1 < pages) {
|
||||
String nextURL = HTMLRenderer.getPageURL(blog, tag, entryId, group, numPerPage, pageNum+1, expandEntries, showImages);
|
||||
String nextURL = null;
|
||||
if ( (selector == null) || (selector.trim().length() <= 0) )
|
||||
nextURL = HTMLRenderer.getPageURL(blog, tag, entryId, group, numPerPage, pageNum+1, expandEntries, showImages);
|
||||
else
|
||||
nextURL = HTMLRenderer.getPageURL(user, selector, numPerPage, pageNum+1);
|
||||
System.out.println("nextURL: " + nextURL);
|
||||
out.write(" <a href=\"" + nextURL + "\">>></a>");
|
||||
} else {
|
||||
@ -311,6 +335,7 @@ public class ArchiveViewerBean {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
out.write(" <i>");
|
||||
|
||||
if (showImages)
|
||||
@ -328,6 +353,10 @@ public class ArchiveViewerBean {
|
||||
"\">Expand details</a>");
|
||||
|
||||
out.write("</i>");
|
||||
*/
|
||||
|
||||
if (afterPagination != null)
|
||||
out.write(afterPagination);
|
||||
|
||||
if (entries.size() <= 0) end = -1;
|
||||
System.out.println("Entries.size: " + entries.size() + " start=" + start + " end=" + end);
|
||||
|
@ -7,6 +7,7 @@ import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.EepGetScheduler;
|
||||
import net.i2p.util.EepPost;
|
||||
import net.i2p.syndie.data.*;
|
||||
import net.i2p.syndie.sml.*;
|
||||
import net.i2p.syndie.*;
|
||||
@ -39,6 +40,8 @@ public class RemoteArchiveBean {
|
||||
public String getRemoteSchema() { return _remoteSchema; }
|
||||
public String getRemoteLocation() { return _remoteLocation; }
|
||||
public ArchiveIndex getRemoteIndex() { return _remoteIndex; }
|
||||
public String getProxyHost() { return _proxyHost; }
|
||||
public int getProxyPort() { return _proxyPort; }
|
||||
public boolean getFetchIndexInProgress() { return _fetchIndexInProgress; }
|
||||
public String getStatus() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
@ -46,7 +49,7 @@ public class RemoteArchiveBean {
|
||||
buf.append(_statusMessages.remove(0)).append("\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
public void fetchMetadata(User user, Map parameters) {
|
||||
String meta = ArchiveViewerBean.getString(parameters, "blog");
|
||||
if (meta == null) return;
|
||||
@ -146,33 +149,45 @@ public class RemoteArchiveBean {
|
||||
scheduler.fetch();
|
||||
}
|
||||
|
||||
public void fetchIndex(User user, String schema, String location) {
|
||||
public void fetchIndex(User user, String schema, String location, String proxyHost, String proxyPort) {
|
||||
_fetchIndexInProgress = true;
|
||||
_remoteIndex = null;
|
||||
_remoteLocation = location;
|
||||
_remoteSchema = schema;
|
||||
_proxyHost = null;
|
||||
_proxyPort = -1;
|
||||
if ("eep".equals(_remoteSchema)) {
|
||||
_proxyHost = user.getEepProxyHost();
|
||||
_proxyPort = user.getEepProxyPort();
|
||||
} else if ("web".equals(_remoteSchema)) {
|
||||
_proxyHost = user.getWebProxyHost();
|
||||
_proxyPort = user.getWebProxyPort();
|
||||
} else if ("tor".equals(_remoteSchema)) {
|
||||
_proxyHost = user.getTorProxyHost();
|
||||
_proxyPort = user.getTorProxyPort();
|
||||
|
||||
if ( (schema == null) || (schema.trim().length() <= 0) ||
|
||||
(location == null) || (location.trim().length() <= 0) ) {
|
||||
_statusMessages.add("Location must be specified");
|
||||
_fetchIndexInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if ("web".equals(schema)) {
|
||||
if ( (proxyHost != null) && (proxyHost.trim().length() > 0) &&
|
||||
(proxyPort != null) && (proxyPort.trim().length() > 0) ) {
|
||||
_proxyHost = proxyHost;
|
||||
try {
|
||||
_proxyPort = Integer.parseInt(proxyPort);
|
||||
} catch (NumberFormatException nfe) {
|
||||
_statusMessages.add("Proxy port " + HTMLRenderer.sanitizeString(proxyPort) + " is invalid");
|
||||
_fetchIndexInProgress = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_statusMessages.add(new String("Remote schema " + HTMLRenderer.sanitizeString(schema) + " currently not supported"));
|
||||
_fetchIndexInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_statusMessages.add("Fetching index from " + HTMLRenderer.sanitizeString(_remoteLocation));
|
||||
|
||||
_statusMessages.add("Fetching index from " + HTMLRenderer.sanitizeString(_remoteLocation) +
|
||||
(_proxyHost != null ? " via " + HTMLRenderer.sanitizeString(_proxyHost) + ":" + _proxyPort : ""));
|
||||
File archiveFile = new File(BlogManager.instance().getTempDir(), user.getBlog().toBase64() + "_remoteArchive.txt");
|
||||
archiveFile.delete();
|
||||
EepGet eep = new EepGet(I2PAppContext.getGlobalContext(), ((_proxyHost != null) && (_proxyPort > 0)),
|
||||
_proxyHost, _proxyPort, 0, archiveFile.getAbsolutePath(), location);
|
||||
EepGet eep = new EepGet(I2PAppContext.getGlobalContext(), ((_proxyHost != null) && (_proxyPort > 0)),
|
||||
_proxyHost, _proxyPort, 0, archiveFile.getAbsolutePath(), location);
|
||||
eep.addStatusListener(new IndexFetcherStatusListener(archiveFile));
|
||||
eep.fetch();
|
||||
}
|
||||
@ -185,7 +200,7 @@ public class RemoteArchiveBean {
|
||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||
_statusMessages.add("Attempt " + currentAttempt + " failed after " + bytesTransferred + (cause != null ? cause.getMessage() : ""));
|
||||
}
|
||||
|
||||
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {}
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile) {
|
||||
_statusMessages.add("Fetch of " + HTMLRenderer.sanitizeString(url) + " successful");
|
||||
@ -210,7 +225,7 @@ public class RemoteArchiveBean {
|
||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||
_statusMessages.add("Attempt " + currentAttempt + " failed after " + bytesTransferred + (cause != null ? cause.getMessage() : ""));
|
||||
}
|
||||
|
||||
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {}
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile) {
|
||||
_statusMessages.add("Fetch of " + HTMLRenderer.sanitizeString(url) + " successful");
|
||||
@ -244,7 +259,7 @@ public class RemoteArchiveBean {
|
||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||
_statusMessages.add("Attempt " + currentAttempt + " failed after " + bytesTransferred + (cause != null ? cause.getMessage() : ""));
|
||||
}
|
||||
|
||||
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {}
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile) {
|
||||
_statusMessages.add("Fetch of " + HTMLRenderer.sanitizeString(url) + " successful");
|
||||
@ -285,6 +300,47 @@ public class RemoteArchiveBean {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void postSelectedEntries(User user, Map parameters) {
|
||||
String entries[] = ArchiveViewerBean.getStrings(parameters, "localentry");
|
||||
if ( (entries == null) || (entries.length <= 0) ) return;
|
||||
List uris = new ArrayList(entries.length);
|
||||
for (int i = 0; i < entries.length; i++)
|
||||
uris.add(new BlogURI(entries[i]));
|
||||
|
||||
post(uris, user);
|
||||
}
|
||||
|
||||
private void post(List blogURIs, User user) {
|
||||
List files = new ArrayList(blogURIs.size()+1);
|
||||
Set meta = new HashSet(4);
|
||||
Map uploads = new HashMap(files.size());
|
||||
String importURL = getImportURL();
|
||||
_statusMessages.add("Uploading through " + HTMLRenderer.sanitizeString(importURL));
|
||||
for (int i = 0; i < blogURIs.size(); i++) {
|
||||
BlogURI uri = (BlogURI)blogURIs.get(i);
|
||||
File blogDir = new File(BlogManager.instance().getArchive().getArchiveDir(), uri.getKeyHash().toBase64());
|
||||
BlogInfo info = BlogManager.instance().getArchive().getBlogInfo(uri);
|
||||
if (!meta.contains(uri.getKeyHash())) {
|
||||
uploads.put("blogmeta" + meta.size(), new File(blogDir, Archive.METADATA_FILE));
|
||||
meta.add(uri.getKeyHash());
|
||||
_statusMessages.add("Scheduling upload of the blog metadata for " + HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.NAME)));
|
||||
}
|
||||
uploads.put("blogpost" + i, new File(blogDir, uri.getEntryId() + ".snd"));
|
||||
_statusMessages.add("Scheduling upload of " + HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.NAME))
|
||||
+ ": " + getEntryDate(uri.getEntryId()));
|
||||
}
|
||||
EepPost post = new EepPost();
|
||||
post.postFiles(importURL, _proxyHost, _proxyPort, uploads, new Runnable() { public void run() { _statusMessages.add("Upload complete"); } });
|
||||
}
|
||||
|
||||
private String getImportURL() {
|
||||
String loc = _remoteLocation.trim();
|
||||
int archiveRoot = loc.lastIndexOf('/');
|
||||
int syndieRoot = loc.lastIndexOf('/', archiveRoot-1);
|
||||
return loc.substring(0, syndieRoot + 1) + "import.jsp";
|
||||
}
|
||||
|
||||
public void renderDeltaForm(User user, ArchiveIndex localIndex, Writer out) throws IOException {
|
||||
Archive archive = BlogManager.instance().getArchive();
|
||||
StringBuffer buf = new StringBuffer(512);
|
||||
@ -305,7 +361,9 @@ public class RemoteArchiveBean {
|
||||
}
|
||||
|
||||
int newEntries = 0;
|
||||
int localNew = 0;
|
||||
out.write("<table border=\"1\" width=\"100%\">\n");
|
||||
List entries = new ArrayList();
|
||||
for (Iterator iter = remoteBlogs.iterator(); iter.hasNext(); ) {
|
||||
Hash blog = (Hash)iter.next();
|
||||
buf = new StringBuffer(1024);
|
||||
@ -314,13 +372,13 @@ public class RemoteArchiveBean {
|
||||
BlogInfo info = archive.getBlogInfo(blog);
|
||||
if (info != null) {
|
||||
buf.append("<a href=\"" + HTMLRenderer.getPageURL(blog, null, -1, -1, -1, user.getShowExpanded(), user.getShowImages()) + "\"><b>" + HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.NAME)) + "</b></a>: " +
|
||||
HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.DESCRIPTION)) + "\n");
|
||||
HTMLRenderer.sanitizeString(info.getProperty(BlogInfo.DESCRIPTION)) + "\n");
|
||||
} else {
|
||||
buf.append("<b>" + blog.toBase64() + "</b>\n");
|
||||
}
|
||||
buf.append("</td></tr>\n");
|
||||
buf.append("<tr><td> </td><td nowrap=\"true\"><b>Posted on</b></td><td nowrap=\"true\"><b>#</b></td><td nowrap=\"true\"><b>Size</b></td><td width=\"90%\" nowrap=\"true\"><b>Tags</b></td></tr>\n");
|
||||
List entries = new ArrayList();
|
||||
entries.clear();
|
||||
_remoteIndex.selectMatchesOrderByEntryId(entries, blog, null);
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
BlogURI uri = (BlogURI)entries.get(i);
|
||||
@ -330,8 +388,8 @@ public class RemoteArchiveBean {
|
||||
newEntries++;
|
||||
shownEntries++;
|
||||
} else {
|
||||
String page = HTMLRenderer.getPageURL(blog, null, uri.getEntryId(), -1, -1,
|
||||
user.getShowExpanded(), user.getShowImages());
|
||||
String page = HTMLRenderer.getPageURL(blog, null, uri.getEntryId(), -1, -1,
|
||||
user.getShowExpanded(), user.getShowImages());
|
||||
buf.append("<td><a href=\"" + page + "\">(local)</a></td>\n");
|
||||
}
|
||||
buf.append("<td>" + getDate(uri.getEntryId()) + "</td>\n");
|
||||
@ -345,9 +403,70 @@ public class RemoteArchiveBean {
|
||||
buf.append("</td>\n");
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
// now for posts in known blogs that we have and they don't
|
||||
entries.clear();
|
||||
localIndex.selectMatchesOrderByEntryId(entries, blog, null);
|
||||
buf.append("<tr><td colspan=\"5\">Entries we have, but the remote Syndie doesn't:</td></tr>\n");
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
BlogURI uri = (BlogURI)entries.get(i);
|
||||
if (!_remoteIndex.getEntryIsKnown(uri)) {
|
||||
buf.append("<tr>\n");
|
||||
buf.append("<td><input type=\"checkbox\" name=\"localentry\" value=\"" + uri.toString() + "\" /></td>\n");
|
||||
shownEntries++;
|
||||
newEntries++;
|
||||
localNew++;
|
||||
buf.append("<td>" + getDate(uri.getEntryId()) + "</td>\n");
|
||||
buf.append("<td>" + getId(uri.getEntryId()) + "</td>\n");
|
||||
buf.append("<td>" + localIndex.getBlogEntrySizeKB(uri) + "KB</td>\n");
|
||||
buf.append("<td>");
|
||||
for (Iterator titer = new TreeSet(localIndex.getBlogEntryTags(uri)).iterator(); titer.hasNext(); ) {
|
||||
String tag = (String)titer.next();
|
||||
buf.append("<a href=\"" + HTMLRenderer.getPageURL(blog, tag, -1, -1, -1, user.getShowExpanded(), user.getShowImages()) + "\">" + tag + "</a> \n");
|
||||
}
|
||||
buf.append("</td>\n");
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (shownEntries > 0) // skip blogs we have already syndicated
|
||||
out.write(buf.toString());
|
||||
}
|
||||
|
||||
// now for posts in blogs we have and they don't
|
||||
int newBefore = localNew;
|
||||
buf.setLength(0);
|
||||
buf.append("<tr><td colspan=\"5\">Blogs the remote Syndie doesn't have</td></tr>\n");
|
||||
for (Iterator iter = localBlogs.iterator(); iter.hasNext(); ) {
|
||||
Hash blog = (Hash)iter.next();
|
||||
if (remoteBlogs.contains(blog)) {
|
||||
System.err.println("Remote index has " + blog.toBase64());
|
||||
continue;
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
localIndex.selectMatchesOrderByEntryId(entries, blog, null);
|
||||
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
BlogURI uri = (BlogURI)entries.get(i);
|
||||
buf.append("<tr>\n");
|
||||
buf.append("<td><input type=\"checkbox\" name=\"localentry\" value=\"" + uri.toString() + "\" /></td>\n");
|
||||
buf.append("<td>" + getDate(uri.getEntryId()) + "</td>\n");
|
||||
buf.append("<td>" + getId(uri.getEntryId()) + "</td>\n");
|
||||
buf.append("<td>" + localIndex.getBlogEntrySizeKB(uri) + "KB</td>\n");
|
||||
buf.append("<td>");
|
||||
for (Iterator titer = new TreeSet(localIndex.getBlogEntryTags(uri)).iterator(); titer.hasNext(); ) {
|
||||
String tag = (String)titer.next();
|
||||
buf.append("<a href=\"" + HTMLRenderer.getPageURL(blog, tag, -1, -1, -1, user.getShowExpanded(), user.getShowImages()) + "\">" + tag + "</a> \n");
|
||||
}
|
||||
buf.append("</td>\n");
|
||||
buf.append("</tr>\n");
|
||||
localNew++;
|
||||
}
|
||||
}
|
||||
if (localNew > newBefore)
|
||||
out.write(buf.toString());
|
||||
|
||||
out.write("</table>\n");
|
||||
if (newEntries > 0) {
|
||||
out.write("<input type=\"submit\" name=\"action\" value=\"Fetch selected entries\" /> \n");
|
||||
@ -355,14 +474,30 @@ public class RemoteArchiveBean {
|
||||
} else {
|
||||
out.write(HTMLRenderer.sanitizeString(_remoteLocation) + " has no new posts to offer us\n");
|
||||
}
|
||||
if (localNew > 0) {
|
||||
out.write("<input type=\"submit\" name=\"action\" value=\"Post selected entries\" /> \n");
|
||||
}
|
||||
}
|
||||
private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.UK);
|
||||
private String getDate(long when) {
|
||||
synchronized (_dateFormat) {
|
||||
return _dateFormat.format(new Date(when));
|
||||
}
|
||||
}
|
||||
|
||||
private final String getEntryDate(long when) {
|
||||
synchronized (_dateFormat) {
|
||||
try {
|
||||
String str = _dateFormat.format(new Date(when));
|
||||
long dayBegin = _dateFormat.parse(str).getTime();
|
||||
return str + "." + (when - dayBegin);
|
||||
} catch (ParseException pe) {
|
||||
pe.printStackTrace();
|
||||
// wtf
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long getId(long id) {
|
||||
synchronized (_dateFormat) {
|
||||
try {
|
||||
|
@ -1,9 +1,7 @@
|
||||
<%@page import="net.i2p.syndie.web.ArchiveViewerBean, net.i2p.syndie.*" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<form action="index.jsp">
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" /><table border="0" width="100%">
|
||||
<tr><form action="index.jsp"><td nowrap="true">
|
||||
<b>Blogs:</b> <%ArchiveViewerBean.renderBlogSelector(user, request.getParameterMap(), out);%>
|
||||
<input type="submit" value="Refresh" />
|
||||
<input type="submit" name="action" value="<%=ArchiveViewerBean.SEL_ACTION_SET_AS_DEFAULT%>" /></form>
|
||||
<hr />
|
||||
|
||||
<%ArchiveViewerBean.renderBlogs(user, request.getParameterMap(), out); out.flush(); %>
|
||||
<input type="submit" name="action" value="<%=ArchiveViewerBean.SEL_ACTION_SET_AS_DEFAULT%>" />
|
||||
<%ArchiveViewerBean.renderBlogs(user, request.getParameterMap(), out, "</td></form></tr><tr><td align=\"left\" valign=\"top\">");%></td></tr></table>
|
@ -1,28 +1,3 @@
|
||||
<%@page import="net.i2p.syndie.web.ArchiveViewerBean, net.i2p.syndie.*, net.i2p.data.Base64" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.ArchiveIndex" id="archive" />
|
||||
<%if (request.getRequestURI().indexOf("register.jsp") == -1) {%>
|
||||
<jsp:include page="_leftnavprotected.jsp" />
|
||||
<hr />
|
||||
<% } %>
|
||||
<u>Local archive:</u><br />
|
||||
<b>Posts:</b> <jsp:getProperty name="archive" property="newEntries" />/<jsp:getProperty name="archive" property="allEntries" /><br />
|
||||
<b>Blogs:</b> <jsp:getProperty name="archive" property="newBlogs" />/<jsp:getProperty name="archive" property="allBlogs" /><br />
|
||||
<b>Size:</b> <jsp:getProperty name="archive" property="newSizeStr" />/<jsp:getProperty name="archive" property="totalSizeStr" /><br />
|
||||
<i>(new/total)</i>
|
||||
<hr />
|
||||
<u>Latest blogs:</u><br />
|
||||
<%!int i = 0; %>
|
||||
<%for (i = 0; i < archive.getNewestBlogCount(); i++) {
|
||||
String keyHash = Base64.encode(archive.getNewestBlog(i).getData());
|
||||
%><a href="viewmetadata.jsp?<%=ArchiveViewerBean.PARAM_BLOG%>=<%=keyHash%>">
|
||||
<%=ArchiveViewerBean.getBlogName(keyHash)%></a><br />
|
||||
<% } %>
|
||||
<hr />
|
||||
<u>Latest posts:</u><br />
|
||||
<%for (i = 0; i < archive.getNewestBlogEntryCount(); i++) {
|
||||
String keyHash = Base64.encode(archive.getNewestBlogEntry(i).getKeyHash().getData());
|
||||
long entryId = archive.getNewestBlogEntry(i).getEntryId();
|
||||
%><a href="index.jsp?<%=ArchiveViewerBean.PARAM_BLOG%>=<%=keyHash%>&<%=ArchiveViewerBean.PARAM_ENTRY%>=<%=entryId%>&<%=ArchiveViewerBean.PARAM_EXPAND_ENTRIES%>=true">
|
||||
<%=ArchiveViewerBean.getEntryTitle(keyHash, entryId)%></a><br />
|
||||
<% } %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.TransparentArchiveIndex" id="archive" />
|
@ -1,41 +0,0 @@
|
||||
<%@page import="net.i2p.syndie.*, net.i2p.syndie.sml.*" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.ArchiveIndex" id="archive" />
|
||||
<%
|
||||
if ("true".equals(request.getParameter("logout"))) {
|
||||
user.invalidate();
|
||||
}
|
||||
String login = request.getParameter("login");
|
||||
String pass = request.getParameter("password");
|
||||
String loginSubmit = request.getParameter("Login");
|
||||
if ( (login != null) && (pass != null) && (loginSubmit != null) && (loginSubmit.equals("Login")) ) {
|
||||
String loginResult = BlogManager.instance().login(user, login, pass);
|
||||
out.write("<b>" + loginResult + "</b>");
|
||||
}
|
||||
|
||||
if (user.getAuthenticated()) {%>
|
||||
<b><u><jsp:getProperty property="username" name="user" />:</u></b><br />
|
||||
<a href="<%=HTMLRenderer.getPageURL(user.getBlog(), null, -1, -1, -1, user.getShowExpanded(), user.getShowImages())%>">My blog</a><br />
|
||||
<a href="<%=HTMLRenderer.getPageURL(user.getBlog(), null, user.getMostRecentEntry(), -1, -1, true, user.getShowImages())%>">Last post</a><br />
|
||||
<a href="<%=HTMLRenderer.getPostURL(user.getBlog())%>">Post</a><br />
|
||||
<a href="<%=HTMLRenderer.getMetadataURL(user.getBlog())%>">Metadata</a><br />
|
||||
<a href="index.jsp?logout=true">Logout</a><br />
|
||||
<!--
|
||||
<hr />
|
||||
<u>Remote Archives:</u><br />
|
||||
<a href="viewarchive.jsp?url=eep://politics.i2p/archive/">politics.i2p</a><br />
|
||||
<a href="viewarchive.jsp?url=freenet://SSK@.../TFE/archive/">TFE</a><br />
|
||||
-->
|
||||
<%} else {%>
|
||||
<form action="<%=request.getRequestURI() + "?" + (request.getQueryString() != null ? request.getQueryString() : "")%>">
|
||||
<b>Login:</b> <input type="text" name="login" size="8" /><br />
|
||||
<b>Pass:</b> <input type="password" name="password" size="8" /><br /><%
|
||||
java.util.Enumeration params = request.getParameterNames();
|
||||
while (params.hasMoreElements()) {
|
||||
String p = (String)params.nextElement();
|
||||
String val = request.getParameter(p);
|
||||
%><input type="hidden" name="<%=p%>" value="<%=val%>" /><%
|
||||
}%>
|
||||
<input type="submit" name="Login" value="Login" /><br /></form>
|
||||
<a href="register.jsp">Register</a><br />
|
||||
<% } %>
|
@ -1,7 +1,5 @@
|
||||
<%@page import="net.i2p.syndie.BlogManager" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.ArchiveIndex" id="archive" />
|
||||
<% session.setAttribute("archive", BlogManager.instance().getArchive().getIndex()); %>
|
||||
<!--
|
||||
<center>[syndiemedia]</center>
|
||||
-->
|
@ -1,3 +1,42 @@
|
||||
<td valign="top" align="left" class="syndieTopNavBlogsCell" height="10"><a href="index.jsp">Blogs</a></td>
|
||||
<td valign="top" align="left" class="syndieTopNavRemoteCell" height="10"><a href="remote.jsp">Remote archives</a></td>
|
||||
<td valign="top" align="left" class="syndieTopNavManageCell" height="10">Manage</td>
|
||||
<%@page import="net.i2p.syndie.*, net.i2p.syndie.sml.*, net.i2p.syndie.web.*" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<td valign="top" align="left" class="syndieTopNavBlogsCell" height="10"><a href="index.jsp">Home</a></td>
|
||||
<td valign="top" align="left" class="syndieTopNavRemoteCell" height="10">
|
||||
<a href="remote.jsp">Remote archives</a>
|
||||
<a href="import.jsp">Import</a>
|
||||
</td>
|
||||
<form action="<%=request.getRequestURI() + "?" + (request.getQueryString() != null ? request.getQueryString() : "")%>">
|
||||
<td nowrap="true" valign="top" align="right" class="syndieTopNavManageCell" height="10"><%
|
||||
if ("true".equals(request.getParameter("logout"))) {
|
||||
user.invalidate();
|
||||
}
|
||||
String login = request.getParameter("login");
|
||||
String pass = request.getParameter("password");
|
||||
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("<b>" + loginResult + "</b>");
|
||||
}
|
||||
%>
|
||||
<% if (user.getAuthenticated()) { %>
|
||||
Logged in as: <b><jsp:getProperty property="username" name="user" />:</b>
|
||||
<a href="<%=HTMLRenderer.getPageURL(user.getBlog(), null, -1, -1, -1, user.getShowExpanded(), user.getShowImages())%>"><%=HTMLRenderer.sanitizeString(ArchiveViewerBean.getBlogName(user.getBlogStr()))%></a>
|
||||
<a href="<%=HTMLRenderer.getPostURL(user.getBlog())%>">Post</a>
|
||||
<a href="<%=HTMLRenderer.getMetadataURL(user.getBlog())%>">Metadata</a>
|
||||
<a href="index.jsp?logout=true">Logout</a><br />
|
||||
<%} else {%>
|
||||
Login: <input type="text" name="login" size="8" />
|
||||
Pass: <input type="password" name="password" size="8" /><%
|
||||
java.util.Enumeration params = request.getParameterNames();
|
||||
while (params.hasMoreElements()) {
|
||||
String p = (String)params.nextElement();
|
||||
String val = request.getParameter(p);
|
||||
%><input type="hidden" name="<%=p%>" value="<%=val%>" /><%
|
||||
}%>
|
||||
<input type="submit" name="Login" value="Login" />
|
||||
<a href="register.jsp">Register</a>
|
||||
<% } %>
|
||||
|
||||
</td>
|
||||
</form>
|
@ -1,5 +1,5 @@
|
||||
<%@page 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.*" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.ArchiveIndex" id="archive" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.TransparentArchiveIndex" id="archive" />
|
||||
<html>
|
||||
<head>
|
||||
<title>SyndieMedia import</title>
|
||||
|
@ -113,13 +113,13 @@ if ( (s != null) && (s.trim().length() > 0) ) {%>
|
||||
Attachment 0: <input type="file" name="entryfile0" /><br />
|
||||
Attachment 1: <input type="file" name="entryfile1" /><br />
|
||||
Attachment 2: <input type="file" name="entryfile2" /><br />
|
||||
Attachment 3: <input type="file" name="entryfile3" /><br />
|
||||
Attachment 3: <input type="file" name="entryfile3" /><br /><!--
|
||||
Attachment 4: <input type="file" name="entryfile4" /><br />
|
||||
Attachment 5: <input type="file" name="entryfile5" /><br />
|
||||
Attachment 6: <input type="file" name="entryfile6" /><br />
|
||||
Attachment 7: <input type="file" name="entryfile7" /><br />
|
||||
Attachment 8: <input type="file" name="entryfile8" /><br />
|
||||
Attachment 9: <input type="file" name="entryfile9" /><br />
|
||||
Attachment 9: <input type="file" name="entryfile9" /><br />-->
|
||||
<hr />
|
||||
<input type="submit" name="Post" value="Preview..." /> <input type="reset" value="Cancel" />
|
||||
<%
|
||||
|
@ -1,7 +1,7 @@
|
||||
<%@page contentType="text/html" import="net.i2p.syndie.web.*" %>
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.web.RemoteArchiveBean" id="remote" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.ArchiveIndex" id="archive" />
|
||||
<jsp:useBean scope="session" class="net.i2p.syndie.data.TransparentArchiveIndex" id="archive" />
|
||||
<html>
|
||||
<head>
|
||||
<title>SyndieMedia</title>
|
||||
@ -17,37 +17,41 @@
|
||||
<%
|
||||
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:
|
||||
} else { %>Import from:
|
||||
<select name="schema">
|
||||
<option value="web">Web</option>
|
||||
<option value="eep">I2P</option>
|
||||
<option value="tor">TOR</option>
|
||||
<option value="freenet">Freenet</option>
|
||||
<option value="web">I2P/TOR/Freenet</option>
|
||||
<option value="mnet">MNet</option>
|
||||
<option value="feedspace">Feedspace</option>
|
||||
<option value="usenet">Usenet</option>
|
||||
</select>
|
||||
<input name="location" size="60" /> <input type="submit" name="action" value="Continue..." />
|
||||
</select>
|
||||
Proxy <input type="text" size="10" name="proxyhost" value="localhost" />:<input type="text" size="4" name="proxyport" value="4444" />
|
||||
<input name="location" size="40" /> <input type="submit" name="action" value="Continue..." /><br />
|
||||
<%
|
||||
String action = request.getParameter("action");
|
||||
if ("Continue...".equals(action)) {
|
||||
remote.fetchIndex(user, request.getParameter("schema"), request.getParameter("location"));
|
||||
remote.fetchIndex(user, request.getParameter("schema"), request.getParameter("location"), request.getParameter("proxyhost"), request.getParameter("proxyport"));
|
||||
} else if ("Fetch metadata".equals(action)) {
|
||||
remote.fetchMetadata(user, request.getParameterMap());
|
||||
} else if ("Fetch selected entries".equals(action)) {
|
||||
remote.fetchSelectedEntries(user, request.getParameterMap());
|
||||
} else if ("Fetch all new entries".equals(action)) {
|
||||
remote.fetchAllEntries(user, request.getParameterMap());
|
||||
} else if ("Post selected entries".equals(action)) {
|
||||
remote.postSelectedEntries(user, request.getParameterMap());
|
||||
}
|
||||
String msgs = remote.getStatus();
|
||||
if ( (msgs != null) && (msgs.length() > 0) ) { %><pre><%=msgs%>
|
||||
<a href="remote.jsp">Refresh</a></pre><br /><% }
|
||||
<a href="remote.jsp">Refresh</a></pre><br /><%
|
||||
}
|
||||
if (remote.getFetchIndexInProgress()) { %><b>Please wait while the index is being fetched
|
||||
from <%=remote.getRemoteLocation()%></b>. <%
|
||||
} else if (remote.getRemoteIndex() != null) {
|
||||
// remote index is NOT null!
|
||||
%><b><%=remote.getRemoteLocation()%></b>:<br />
|
||||
%><b><%=remote.getRemoteLocation()%></b>
|
||||
<a href="remote.jsp?schema=<%=remote.getRemoteSchema()%>&location=<%=remote.getRemoteLocation()%><%
|
||||
if (remote.getProxyHost() != null && remote.getProxyPort() > 0) {
|
||||
%>&proxyhost=<%=remote.getProxyHost()%>&proxyport=<%=remote.getProxyPort()%><%
|
||||
} %>&action=Continue...">(refetch)</a>:<br />
|
||||
<%remote.renderDeltaForm(user, archive, out);%>
|
||||
<textarea style="font-size:8pt" rows="5" cols="120"><%=remote.getRemoteIndex()%></textarea><%
|
||||
}
|
||||
|
@ -4,11 +4,21 @@
|
||||
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
|
||||
|
||||
<web-app>
|
||||
<servlet>
|
||||
<servlet-name>net.i2p.syndie.web.ArchiveServlet</servlet-name>
|
||||
<servlet-class>net.i2p.syndie.web.ArchiveServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- precompiled servlets -->
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>net.i2p.syndie.jsp.index_jsp</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>net.i2p.syndie.web.ArchiveServlet</servlet-name>
|
||||
<url-pattern>/archive/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<session-config>
|
||||
<session-timeout>
|
||||
|
Reference in New Issue
Block a user