Changeset 848ead7


Ignore:
Timestamp:
Sep 29, 2005 7:19:22 PM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
c528e4d
Parents:
1b8419b
git-author:
jrandom <jrandom> (09/29/05 19:19:22)
git-committer:
zzz <zzz@…> (09/29/05 19:19:22)
Message:
  • 2005-09-29 0.6.1 released

2005-09-29 jrandom

  • Let syndie users modify their metadata.
  • Reseed the router on startup if there aren't enough peer references known locally. This can be disabled by creating the file .i2pnoreseed in your home directory, and the existing detection and reseed handling on the web interface is unchanged.
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ReseedHandler.java

    r1b8419b r848ead7  
    2929        if (nonce.equals(System.getProperty("net.i2p.router.web.ReseedHandler.nonce")) ||
    3030            nonce.equals(System.getProperty("net.i2p.router.web.ReseedHandler.noncePrev"))) {
    31             synchronized (_reseedRunner) {
    32                 if (_reseedRunner.isRunning()) {
    33                     return;
    34                 } else {
    35                     System.setProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "true");
    36                     I2PThread reseed = new I2PThread(_reseedRunner, "Reseed");
    37                     reseed.start();
    38                 }
     31            requestReseed();
     32        }
     33    }
     34   
     35    public static void requestReseed() {
     36        synchronized (_reseedRunner) {
     37            if (_reseedRunner.isRunning()) {
     38                return;
     39            } else {
     40                System.setProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "true");
     41                System.out.println("Reseeding");
     42                I2PThread reseed = new I2PThread(_reseedRunner, "Reseed");
     43                reseed.start();
    3944            }
    4045        }
     
    4752        public void run() {
    4853            _isRunning = true;
    49             reseed();
     54            reseed(false);
     55            System.out.println("Reseeding complete");
    5056            System.setProperty("net.i2p.router.web.ReseedHandler.reseedInProgress", "false");
    5157            _isRunning = false;
     
    6066     *
    6167     */
    62     private static void reseed() {
     68    private static void reseed(boolean echoStatus) {
    6369        String seedURL = System.getProperty("i2p.reseedURL", DEFAULT_SEED_URL);
    6470        if ( (seedURL == null) || (seedURL.trim().length() <= 0) )
     
    8692                    fetchSeed(seedURL, (String)iter.next());
    8793                    fetched++;
     94                    if (echoStatus) {
     95                        System.out.print(".");
     96                        if (fetched % 60 == 0)
     97                            System.out.println();
     98                    }
    8899                } catch (Exception e) {
    89100                    errors++;
    90101                }
    91102            }
     103            if (echoStatus) System.out.println();
    92104        } catch (Throwable t) {
    93105            I2PAppContext.getGlobalContext().logManager().getLog(ReseedHandler.class).error("Error reseeding", t);
     
    173185   
    174186    public static void main(String args[]) {
    175         reseed();
    176         //System.out.println("Done reseeding");
     187        if ( (args != null) && (args.length == 1) && (!Boolean.valueOf(args[0]).booleanValue()) ) {
     188            System.out.println("Not reseeding, as requested");
     189            return; // not reseeding on request
     190        }
     191        System.out.println("Reseeding");
     192        reseed(true);
    177193    }
    178194}
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    r1b8419b r848ead7  
    7373            t.printStackTrace();
    7474        }
     75
     76        File noReseedFile = new File(new File(System.getProperty("user.home")), ".i2pnoreseed");
     77        if (!noReseedFile.exists()) {
     78            RouterContext ctx = (RouterContext)RouterContext.listContexts().get(0);
     79            if (ctx.netDb().getKnownRouters() < 15) {
     80                ReseedHandler.requestReseed();
     81            }
     82        }
    7583       
    7684        NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext());
  • apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java

    r1b8419b r848ead7  
    9595            _isRunning = true;
    9696            update();
    97             System.setProperty("net.i2p.router.web.ReseedHandler.updateInProgress", "false");
     97            System.setProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false");
    9898            _isRunning = false;
    9999        }
  • apps/syndie/java/src/net/i2p/syndie/BlogManager.java

    r1b8419b r848ead7  
    142142       
    143143        return info;
     144    }
     145   
     146    public boolean updateMetadata(User user, Hash blog, Properties opts) {
     147        if (!user.getAuthenticated()) return false;
     148        BlogInfo oldInfo = getArchive().getBlogInfo(blog);
     149        if (oldInfo == null) return false;
     150        if (!user.getBlog().equals(oldInfo.getKey().calculateHash())) return false;
     151        int oldEdition = 0;
     152        try {
     153            String ed = oldInfo.getProperty("Edition");
     154            if (ed != null)
     155                oldEdition = Integer.parseInt(ed);
     156        } catch (NumberFormatException nfe) {}
     157        opts.setProperty("Edition", oldEdition + 1 + "");
     158        BlogInfo info = new BlogInfo(oldInfo.getKey(), oldInfo.getPosters(), opts);
     159        SigningPrivateKey key = getMyPrivateKey(oldInfo);
     160        info.sign(_context, key);
     161        getArchive().storeBlogInfo(info);
     162        user.setLastMetaEntry(oldEdition+1);
     163        saveUser(user);
     164        return true;
    144165    }
    145166   
  • apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java

    r1b8419b r848ead7  
    673673    }
    674674   
    675     public static void renderMetadata(Map parameters, Writer out) throws IOException {
     675    private static String getURL(String uri, Map parameters) {
     676        StringBuffer rv = new StringBuffer(128);
     677        rv.append(uri);
     678        rv.append('?');
     679        if (parameters != null) {
     680            for (Iterator iter = parameters.keySet().iterator(); iter.hasNext(); ) {
     681                String key = (String)iter.next();
     682                String vals[] = getStrings(parameters, key);
     683                // we are already looking at the page with the given parameters, no need to further sanitize
     684                if ( (key != null) && (vals != null) )
     685                    for (int i = 0; i < vals.length; i++)
     686                        rv.append(key).append('=').append(vals[i]).append('&');
     687            }
     688        }
     689        return rv.toString();
     690    }
     691   
     692    private static void updateMetadata(User viewer, Map parameters, Writer out) throws IOException {
     693        if ( (viewer == null) || (!viewer.getAuthenticated()) )
     694            return;
     695        String blogStr = getString(parameters, PARAM_BLOG);
     696        if (blogStr != null) {
     697            Hash blog = new Hash(Base64.decode(blogStr));
     698            Archive archive = BlogManager.instance().getArchive();
     699            BlogInfo info = archive.getBlogInfo(blog);
     700            if (info != null) {
     701                boolean isUser = viewer.getBlog().equals(info.getKey().calculateHash());
     702                if (!isUser)
     703                    return;
     704                Properties toSave = new Properties();
     705                String existing[] = info.getProperties();
     706                for (int i = 0; i < existing.length; i++) {
     707                    String newVal = getString(parameters, existing[i]);
     708                    if ( (newVal != null) && (newVal.length() > 0) )
     709                        toSave.setProperty(existing[i], newVal.trim());
     710                    else
     711                        toSave.setProperty(existing[i], info.getProperty(existing[i]));
     712                }
     713                boolean saved = BlogManager.instance().updateMetadata(viewer, blog, toSave);
     714                if (saved)
     715                    out.write("<p><em class=\"b_msgOk\">Blog metadata saved</em></p>\n");
     716                else
     717                    out.write("<p><em class=\"b_msgErr\">Blog metadata could not be saved</em></p>\n");
     718            }
     719        }
     720    }
     721   
     722    /**
     723     * @param currentURI URI of the with current page without any parameters tacked on
     724     */
     725    public static void renderMetadata(User viewer, String currentURI, Map parameters, Writer out) throws IOException {
     726        if (parameters.get("action") != null) {
     727            updateMetadata(viewer, parameters, out);
     728        }
    676729        String blogStr = getString(parameters, PARAM_BLOG);
    677730        if (blogStr != null) {
     
    683736                return;
    684737            }
     738            boolean isUser = ( (viewer != null) && (viewer.getAuthenticated()) && (viewer.getBlog().equals(info.getKey().calculateHash())) );
    685739            String props[] = info.getProperties();
     740            if (isUser) {
     741                out.write("<form action=\"" + getURL(currentURI, parameters) + "\" method=\"GET\">\n");
     742                out.write("<input type=\"hidden\" name=\"submit_blog\" value=\"" + blog.toBase64() + "\" />\n");
     743            }
    686744            out.write("<table class=\"b_meta\" border=\"0\">");
    687745            for (int i = 0; i < props.length; i++) {
     
    705763                    }
    706764                } else {
    707                     out.write("<tr class=\"b_metaField\"><td class=\"b_metaField\"><span class=\"b_metaField\">" + HTMLRenderer.sanitizeString(props[i])
    708                               + ":</span></td><td class=\"b_metaValue\"><span class=\"b_metaValue\">" + HTMLRenderer.sanitizeString(info.getProperty(props[i])) + "</span></td></tr>\n");
     765                    String field = HTMLRenderer.sanitizeString(props[i]);
     766                    String val = HTMLRenderer.sanitizeString(info.getProperty(props[i]));
     767                    out.write("<tr class=\"b_metaField\"><td class=\"b_metaField\"><span class=\"b_metaField\">" + field
     768                              + ":</span></td><td class=\"b_metaValue\"><span class=\"b_metaValue\">" + val + "</span></td></tr>\n");
     769                   
     770                    if (isUser && (!field.equals("Edition")))
     771                        out.write("<tr class=\"b_metaField\"><td>&nbsp;</td><td class=\"b_metaValue\"><input type=\"text\" name=\""
     772                                  + HTMLRenderer.sanitizeTagParam(props[i]) + "\" value=\""
     773                                  + HTMLRenderer.sanitizeTagParam(info.getProperty(props[i])) + "\" size=\"40\" ></td></tr>");
    709774                }
    710775            }
     
    719784                out.write("</td></tr>");
    720785            }
     786            if (isUser)
     787                out.write("<tr class=\"b_metaField\"><td colspan=\"2\" class=\"b_metaField\"><input type=\"submit\" name=\"action\" value=\"Save changes\" class=\"b_metaSave\" /></td></tr>\n");
    721788            out.write("</table>");
    722789        } else {
  • apps/syndie/jsp/viewmetadata.jsp

    r1b8419b r848ead7  
    1515    <td valign="top" align="left" rowspan="2" class="b_rightnav"><jsp:include page="_rightnav.jsp" /></td></tr>
    1616<tr class="b_content"><td valign="top" align="left" colspan="3" class="b_content"><%
    17 ArchiveViewerBean.renderMetadata(request.getParameterMap(), out);
     17ArchiveViewerBean.renderMetadata(user, request.getRequestURI(), request.getParameterMap(), out);
    1818if (user.getAuthenticated()) {
    1919  if ("Authorize".equals(request.getParameter("action"))) {
  • core/java/src/net/i2p/CoreVersion.java

    r1b8419b r848ead7  
    1515 */
    1616public class CoreVersion {
    17     public final static String ID = "$Revision: 1.41 $ $Date: 2005/09/02 14:10:08 $";
    18     public final static String VERSION = "0.6.0.6";
     17    public final static String ID = "$Revision: 1.42 $ $Date: 2005/09/17 20:29:59 $";
     18    public final static String VERSION = "0.6.1";
    1919
    2020    public static void main(String args[]) {
  • history.txt

    r1b8419b r848ead7  
    1 $Id: history.txt,v 1.268 2005/09/27 17:42:49 jrandom Exp $
     1$Id: history.txt,v 1.269 2005/09/28 04:17:55 jrandom Exp $
     2
     3* 2005-09-29  0.6.1 released
     4
     52005-09-29  jrandom
     6    * Let syndie users modify their metadata.
     7    * Reseed the router on startup if there aren't enough peer references
     8      known locally.  This can be disabled by creating the file .i2pnoreseed
     9      in your home directory, and the existing detection and reseed handling
     10      on the web interface is unchanged.
    211
    3122005-09-28  jrandom
  • initialNews.xml

    r1b8419b r848ead7  
    1 <i2p.news date="$Date: 2005/09/02 14:10:05 $">
    2  <i2p.release version="0.6.0.6" date="2005/09/17" minVersion="0.6"
     1<i2p.news date="$Date: 2005/09/17 20:30:00 $">
     2 <i2p.release version="0.6.1" date="2005/09/29" minVersion="0.6"
    33              anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
    44              publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
  • install-headless.txt

    r1b8419b r848ead7  
    1 $Id: install-headless.txt,v 1.3 2004/09/29 14:38:15 jrandom Exp $
     1$Id: install-headless.txt,v 1.4 2004/12/21 11:32:50 jrandom Exp $
    22Headless I2P installation instructions
    33
    441) tar xjf i2p.tar.bz2                     (you've already done this)
    552) cd i2p ; vi install-headless.txt        (you're doing this now)
    6 3) sh postinstall.sh                       (this launches the router)
    7 4) lynx http://localhost:7657/index.jsp    (configure the router)
     63) java -jar lib/reseed.jar                (optional)
     74) sh postinstall.sh                       (this launches the router)
     85) lynx http://localhost:7657/index.jsp    (configure the router)
    89
    910If you're having trouble, swing by http://forum.i2p.net/, check the
     
    1213To run I2P explicitly:
    1314   (*nix): sh i2prouter start
    14    (win*): I2Psvc.exe -c wrapper.config
     15   (win*): I2P.exe
    1516
    1617To stop the router (gracefully):
  • news.xml

    r1b8419b r848ead7  
    1 <i2p.news date="$Date: 2005/09/17 20:30:00 $">
    2  <i2p.release version="0.6.0.6" date="2005/09/17" minVersion="0.6"
     1<i2p.news date="$Date: 2005/09/23 23:08:42 $">
     2 <i2p.release version="0.6.1" date="2005/09/29" minVersion="0.6"
    33              anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
    44              publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
     
    1010            anonlogs="http://i2p/Nf3ab-ZFkmI-LyMt7GjgT-jfvZ3zKDl0L96pmGQXF1B82W2Bfjf0n7~288vafocjFLnQnVcmZd~-p0-Oolfo9aW2Rm-AhyqxnxyLlPBqGxsJBXjPhm1JBT4Ia8FB-VXt0BuY0fMKdAfWwN61-tj4zIcQWRxv3DFquwEf035K~Ra4SWOqiuJgTRJu7~o~DzHVljVgWIzwf8Z84cz0X33pv-mdG~~y0Bsc2qJVnYwjjR178YMcRSmNE0FVMcs6f17c6zqhMw-11qjKpY~EJfHYCx4lBWF37CD0obbWqTNUIbL~78vxqZRT3dgAgnLixog9nqTO-0Rh~NpVUZnoUi7fNR~awW5U3Cf7rU7nNEKKobLue78hjvRcWn7upHUF45QqTDuaM3yZa7OsjbcH-I909DOub2Q0Dno6vIwuA7yrysccN1sbnkwZbKlf4T6~iDdhaSLJd97QCyPOlbyUfYy9QLNExlRqKgNVJcMJRrIual~Lb1CLbnzt0uvobM57UpqSAAAA/meeting141"
    1111            publiclogs="http://www.i2p.net/meeting141" />
    12 &#149; Thanks everyone for upgrading to 0.6.0.6 so quickly (and hope its going well for you!)<br />
    13 &#149; Just a note regarding syndie - there's a bug in 0.6.0.6-0, so you should try syncing off
    14        <a href="http://gloinsblog.i2p/?i2paddresshelper=~yIGbO5q5Nw5wRAtZVh57IQr-f1ygwjJGCX2gaSldFi~T45ys0CllBqI-6z-Cpzx2iHzyXyFcp3yyU-MeNcILk1y8Ukgr-~0lN2JFzUVmwPOWjoMaAuhIejCd-iliVhwpqfHbwdujO10QYuLP4i3dtcsRh7uONUOtB-w9Iq0womgMPcski07fTD94pqAAf9LyIi3piI9-Y59HGnCaZ~N~anQrRyd0rYoimltgMEqHA~sIuqYRqQtLYQmDqYcCphSgrmy9YXKFn1INLBQMcCa0JTJwujDluAnckiJ0Hic70WOpTinX8V~1FqKsq8M9N3iESN~jDiieFRgzc2KslxFrCph9jFfeU6wgQ4~mxIparIyG8CYmnp2xy1iGfipHa1ZevsARTpad0YB7xDaRCqyNzXGaTmuC0Eb2WCox5Ci7qN8N3bTKtZjD4VeFZ7tTwKGkVKif6ywVe7U8v3KmXR5K2qG74d281YrC2r3ACn0X9E2uR0AuDb3x75loyXMg00IAAAA">gloinsblog.i2p</a> or another syndie node instead of syndiemedia for the moment.<br />
     12&#149; There's a new 0.6.1 release out, and while its backwards compatible, upgrading is recommended!  Thanks<br />
    1513</i2p.news>
  • readme.html

    r1b8419b r848ead7  
    1 <p>If this is your first time running I2P, you will see a link on the left hand
    2 side telling you to "reseed" - click that to get connected to the network (you
    3 only need to do it if that link shows up).  Within 5 minutes, you should see
    4 the number of "Active: " peers rise, and you should see some local "destinations"
    5 listed (if not, <a href="#trouble">see below</a>).  Once those are up, you can:</p>
     1<p>If you've just started I2P, the Active: number on the left should start to
     2grow over the next few minutes and you'll see some local "destinations" listed
     3on the left (if not, <a href="#trouble">see below</a>).  Once those show up,
     4you can:</p>
    65<ul>
    76 <li><b>blog anonymously</b> - check out <a href="/syndie/">Syndie</a></li>
  • router/java/src/net/i2p/router/RouterVersion.java

    r1b8419b r848ead7  
    1616 */
    1717public class RouterVersion {
    18     public final static String ID = "$Revision: 1.248 $ $Date: 2005/09/27 17:42:49 $";
    19     public final static String VERSION = "0.6.0.6";
    20     public final static long BUILD = 8;
     18    public final static String ID = "$Revision: 1.249 $ $Date: 2005/09/28 04:17:54 $";
     19    public final static String VERSION = "0.6.1";
     20    public final static long BUILD = 0;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
Note: See TracChangeset for help on using the changeset viewer.