I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 09cb5fad authored by jrandom's avatar jrandom Committed by zzz
Browse files

allow you to bookmark syndie archives and later recall those bookmarks on the remote page

parent ee8e45ec
No related branches found
No related tags found
No related merge requests found
......@@ -578,6 +578,9 @@ public class HTMLRenderer extends EventReceiverImpl {
_postBodyBuffer.append("\">").append(sanitizeString(a.name)).append("</a>");
if (a.description != null)
_postBodyBuffer.append(": ").append(sanitizeString(a.description));
_postBodyBuffer.append(" <a href=\"");
_postBodyBuffer.append(getBookmarkURL(a.name, a.location, a.locationSchema, "syndiearchive"));
_postBodyBuffer.append("\">bookmark</a>");
}
_postBodyBuffer.append("<br />\n");
}
......@@ -869,4 +872,11 @@ public class HTMLRenderer extends EventReceiverImpl {
+ "&schema=" + sanitizeTagParam(archiveLocation.getSchema())
+ "&location=" + sanitizeTagParam(archiveLocation.getLocation());
}
public static String getBookmarkURL(String name, String location, String schema, String protocol) {
return "addresses.jsp?name=" + sanitizeTagParam(name)
+ "&network=" + sanitizeTagParam(schema)
+ "&protocol=" + sanitizeTagParam(protocol)
+ "&location=" + sanitizeTagParam(location);
}
}
......@@ -141,11 +141,31 @@ if (!user.getAuthenticated()) {
out.write(buf.toString());
buf.setLength(0);
}
String net = request.getParameter("network");
String proto = request.getParameter("protocol");
String name = request.getParameter("name");
String loc = request.getParameter("location");
boolean active = (request.getParameter("action") != null);
if (net == null || active) net = "";
if (proto == null || active) proto = "";
if (name == null || active) name = "";
if (loc == null || active) loc= "";
%>
<tr><form action="addresses.jsp" method="POST"><td><input type="text" name="name" size="20" /></td>
<td><select name="network"><option value="i2p">I2P</option><option value="syndie">Syndie</option><option value="tor">Tor</option><option value="freenet">Freenet</option><option value="internet">Internet</option></select></td>
<td><select name="protocol"><option value="http">HTTP</option><option value="irc">IRC</option><option value="i2phex">I2Phex</option><option value="syndiearchive">Syndie archive</option><option value="syndieblog">Syndie blog</option></select></td>
<td><input type="text" size="50" name="location" /></td>
<tr><form action="addresses.jsp" method="POST"><td><input type="text" name="name" size="20" value="<%=name%>" /></td>
<td><select name="network">
<option value="i2p" <%="i2p".equals(net) ? " selected=\"true\" " : ""%>>I2P</option>
<option value="syndie" <%="syndie".equals(net) ? " selected=\"true\" " : ""%>>Syndie</option>
<option value="tor" <%="tor".equals(net) ? " selected=\"true\" " : ""%>>Tor</option>
<option value="freenet" <%="freenet".equals(net) ? " selected=\"true\" " : ""%>>Freenet</option>
<option value="internet" <%="internet".equals(net) ? " selected=\"true\" " : ""%>>Internet</option></select></td>
<td><select name="protocol">
<option value="http" <%="http".equals(proto) ? " selected=\"true\" " : ""%>>HTTP</option>
<option value="irc" <%="irc".equals(proto) ? " selected=\"true\" " : ""%>>IRC</option>
<option value="i2phex" <%="i2phex".equals(proto) ? " selected=\"true\" " : ""%>>I2Phex</option>
<option value="syndiearchive" <%="syndiearchive".equals(proto) ? " selected=\"true\" " : ""%>>Syndie archive</option>
<option value="syndieblog" <%="syndieblog".equals(proto) ? " selected=\"true\" " : ""%>>Syndie blog</option></select></td>
<td><input type="text" size="50" name="location" value="<%=loc%>" /></td>
<td><input type="checkbox" name="isPublic" /></td>
<td><input type="text" name="groups" size="10" /></td>
<td><input type="submit" name="action" value="Add" /></td>
......
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="net.i2p.syndie.web.*" %>
<%@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"); %>
<jsp:useBean scope="session" class="net.i2p.syndie.web.RemoteArchiveBean" id="remote" />
<jsp:useBean scope="session" class="net.i2p.syndie.User" id="user" />
......@@ -25,13 +25,27 @@ if (!user.getAuthenticated() || !user.getAllowAccessRemote()) {
<option value="feedspace" <%=("feedspace".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>Feedspace</option>
<option value="usenet" <%=("usenet".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>Usenet</option>
</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" value="<%=(request.getParameter("location") != null ? request.getParameter("location") : "")%>" />
Proxy <input type="text" size="10" name="proxyhost" value="localhost" />:<input type="text" size="4" name="proxyport" value="4444" /><br />
Bookmarked archives: <select name="archivepetname"><option value="">Custom location</option><%
for (Iterator iter = user.getPetNameDB().getNames().iterator(); iter.hasNext(); ) {
PetName pn = user.getPetNameDB().get((String)iter.next());
if ("syndiearchive".equals(pn.getProtocol())) {
%><option value="<%=HTMLRenderer.sanitizeTagParam(pn.getName())%>"><%=HTMLRenderer.sanitizeString(pn.getName())%></option><%
}
}
%></select> or
<input name="location" size="30" value="<%=(request.getParameter("location") != null ? request.getParameter("location") : "")%>" />
<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"), request.getParameter("proxyhost"), request.getParameter("proxyport"));
String location = request.getParameter("location");
String pn = request.getParameter("archivepetname");
if ( (pn != null) && (pn.trim().length() > 0) ) {
PetName pnval = user.getPetNameDB().get(pn);
if (pnval != null) location = pnval.getLocation();
}
remote.fetchIndex(user, request.getParameter("schema"), 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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment