diff --git a/apps/addressbook/README.txt b/apps/addressbook/README.txt deleted file mode 100644 index d5f13d9d6..000000000 --- a/apps/addressbook/README.txt +++ /dev/null @@ -1,43 +0,0 @@ -addressbook v2.0.2 - A simple name resolution mechanism for I2P - -addressbook is a simple implementation of subscribable address books for I2P. -Addresses are stored in userhosts.txt and a second copy of the address book is -placed on your eepsite as hosts.txt. - -subscriptions.txt contains a list of urls to check for new addresses. -Since the urls are checked in order, and conflicting addresses are not added, -addressbook.subscriptions can be considered to be ranked in order of trust. - -The system created by addressbook is similar to the early days of DNS, -when everyone ran a local name server. The major difference is the lack of -authority. Name cannot be guaranteed to be globally unique, but in practise -they probably will be, for a variety of social reasons. - -Requirements -************ - -i2p with a running http proxy - -Installation and Usage -********************** - -1. Unzip addressbook-%ver.zip into your i2p directory. -2. Restart your router. - -The addressbook daemon will automatically run while the router is up. - -Aside from the daemon itself, the other elements of the addressbook interface -are the config.txt, myhosts.txt, and subscriptions.txt files found in the addressbook -directory. - -config.txt is the configuration file for addressbook. - -myhosts.txt is the addressbook master address book. Addresses placed in this file -take precidence over those in the router address book and in remote address books. -If changes are made to this file, they will be reflected in the router address book -and published address book after the next update. Do not make changes directly to the -router address book, as they could be lost during an update. - -subscriptions.txt is the subscription list for addressbook. Each entry is an absolute -url to a file in hosts.txt format. Since the list is checked in order, url's should be -listed in order of trust. diff --git a/apps/addressbook/config.txt b/apps/addressbook/config.txt deleted file mode 100644 index 49a4212f4..000000000 --- a/apps/addressbook/config.txt +++ /dev/null @@ -1,48 +0,0 @@ -# This is the configuration file for addressbook. -# -# Options -# ******* -# All paths are realitive to i2p/addressbook. Default value for -# each option is given in parentheses. -# -# proxy_host The hostname of your I2P http proxy. -# (localhost) -# -# proxy_port The port of your I2P http proxy. (4444) -# -# master_addressbook The path to your master address book, used for local -# changes only. (myhosts.txt) -# -# router_addressbook The path to the address book used by the router. -# Contains the addresses from your master address book -# and your subscribed address books. (../userhosts.txt) -# -# private_addressbook The path to the private address book used by the router. -# This is used only by the router and SusiDNS. -# It is not published by addressbook. (../privatehosts.txt) -# -# published_addressbook The path to the copy of your address book made -# available on i2p. (../eepsite/docroot/hosts.txt) -# -# log The path to your addressbook log. (log.txt) -# -# subscriptions The path to your subscription file. (subscriptions.txt) -# -# etags The path to the etags header storage file. (etags) -# -# last_modified The path to the last-modified header storage file. -# (last_modified) -# -# update_delay The time (in hours) between each update. (1) - -proxy_host=localhost -proxy_port=4444 -master_addressbook=myhosts.txt -router_addressbook=../userhosts.txt -private_addressbook=../privatehosts.txt -published_addressbook=../eepsite/docroot/hosts.txt -log=log.txt -subscriptions=subscriptions.txt -etags=etags -last_modified=last_modified -update_delay=1 diff --git a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java index 58b08db53..020692a9e 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/ConfigParser.java @@ -166,6 +166,10 @@ class ConfigParser { Map result; try { result = parse(file); + // migrate + String local = result.remove("master_addressbook"); + if (local != null) + result.put("local_addressbook", local); for (Map.Entry entry : map.entrySet()) { if (!result.containsKey(entry.getKey())) result.put(entry.getKey(), entry.getValue()); diff --git a/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java b/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java index 010c0782b..d0c20d064 100644 --- a/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java +++ b/apps/addressbook/java/src/net/i2p/addressbook/Daemon.java @@ -67,8 +67,8 @@ class Daemon { * Update the router and published address books using remote data from the * subscribed address books listed in subscriptions. * - * @param master - * The master AddressBook. This address book is never + * @param local + * The local AddressBook. This address book is never * overwritten, so it is safe for the user to write to. * It is only merged to the published addressbook. * May be null. @@ -87,7 +87,7 @@ class Daemon { * The log to write changes and conflicts to. * May be null. */ - public static void update(AddressBook master, AddressBook router, + public static void update(AddressBook local, AddressBook router, File published, SubscriptionList subscriptions, Log log) { for (AddressBook book : subscriptions) { // yes, the EepGet fetch() is done in next() @@ -95,8 +95,8 @@ class Daemon { } router.write(); if (published != null) { - if (master != null) - router.merge(master, true, null); + if (local != null) + router.merge(local, true, null); router.write(published); } subscriptions.write(); @@ -105,7 +105,7 @@ class Daemon { /** * Update the router and published address books using remote data from the * subscribed address books listed in subscriptions. - * Merging of the "master" addressbook is NOT supported. + * Merging of the "local" addressbook is NOT supported. * * @param router * The NamingService to update, generally the root NamingService from the context. @@ -751,17 +751,17 @@ class Daemon { if (Boolean.parseBoolean(settings.get("update_direct"))) { // Direct hosts.txt access File routerFile = new File(home, settings.get("router_addressbook")); - AddressBook master; + AddressBook local; if (should_publish) { - File masterFile = new File(home, settings.get("master_addressbook")); - master = new AddressBook(masterFile); + File localFile = new File(home, settings.get("local_addressbook")); + local = new AddressBook(localFile); } else { - master = null; + local = null; } AddressBook router = new AddressBook(routerFile); - update(master, router, published, subscriptions, log); + update(local, router, published, subscriptions, log); } else { - // Naming service - no merging of master to router and published is supported. + // Naming service - no merging of local to router and published is supported. update(getNamingService(settings.get("naming_service")), published, subscriptions, log); } } @@ -841,7 +841,7 @@ class Daemon { Map defaultSettings = new HashMap(); defaultSettings.put("proxy_host", "127.0.0.1"); defaultSettings.put("proxy_port", "4444"); - defaultSettings.put("master_addressbook", "../userhosts.txt"); + defaultSettings.put("local_addressbook", "../userhosts.txt"); defaultSettings.put("router_addressbook", "../hosts.txt"); defaultSettings.put("published_addressbook", "../eepsite/docroot/hosts.txt"); defaultSettings.put("should_publish", "false"); @@ -868,7 +868,7 @@ class Daemon { // wait try { Thread.sleep(5*60*1000 + I2PAppContext.getGlobalContext().random().nextLong(5*60*1000)); - // Static method, and redundent Thread.currentThread().sleep(5*60*1000); + // Static method, and redundant Thread.currentThread().sleep(5*60*1000); } catch (InterruptedException ie) {} while (_running) { diff --git a/apps/addressbook/myhosts.txt b/apps/addressbook/myhosts.txt deleted file mode 100644 index 680d4204b..000000000 --- a/apps/addressbook/myhosts.txt +++ /dev/null @@ -1,10 +0,0 @@ -# addressbook master address book. Addresses placed in this file take precidence -# over those in the router address book and in remote address books. If changes -# are made to this file, they will be reflected in the router address book and -# published address book after the next update. -# -# Do not make changes directly to the router address book, as they could be lost -# during an update. -# -# This file takes addresses in the hosts.txt format, i.e. -# example.i2p=somereallylongbase64thingAAAA diff --git a/apps/addressbook/subscriptions.txt b/apps/addressbook/subscriptions.txt deleted file mode 100644 index 62741055b..000000000 --- a/apps/addressbook/subscriptions.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Subscription list for addressbook -# -# Each entry is an absolute url to a file in hosts.txt format. -# Since the list is checked in order, url's should be listed in order of trust. -# -http://dev.i2p/i2p/hosts.txt -http://duck.i2p/hosts.txt diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index ae18ed74e..fd553e477 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -1460,7 +1460,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn "

" + _t("Save {0} to router address book and continue to website", destination) + "

\n

" + _t("This address will be saved to your Router address book where your subscription-based addresses are stored.")); if(_context.namingService().getName().equals("BlockfileNamingService")) { - out.write(" " + _t("If you want to keep track of sites you have added manually, add to your Master or Private address book instead.")); + out.write(" " + _t("If you want to keep track of sites you have added manually, add to your Local or Private address book instead.")); } // FIXME wasn't escaped String label = _t("Save & continue").replace("&", "&"); @@ -1470,9 +1470,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn if(_context.namingService().getName().equals("BlockfileNamingService")) { // only blockfile supports multiple books - out.write("

" + _t("Save {0} to master address book and continue to website", destination) + "

\n

" + - _t("This address will be saved to your Master address book. Select this option for addresses you wish to keep separate from the main router address book, but don't mind publishing.") + - "

\n
\n"); out.write("

" + _t("Save {0} to private address book and continue to website", destination) + "

\n

" + diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/localServer/LocalHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/localServer/LocalHTTPServer.java index d674b26a4..26ae12ccd 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/localServer/LocalHTTPServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/localServer/LocalHTTPServer.java @@ -155,7 +155,7 @@ public abstract class LocalHTTPServer { } // Add to addressbook (form submit) - // Parameters are url, host, dest, nonce, and master | router | private. + // Parameters are url, host, dest, nonce, and local | router | private. // Do the add and redirect. if (targetRequest.equals("/add")) { if (query == null) { @@ -170,7 +170,7 @@ public abstract class LocalHTTPServer { String nonce = opts.get("nonce"); String referer = opts.get("referer"); String book = "privatehosts.txt"; - if (opts.get("master") != null) + if (opts.get("local") != null) book = "userhosts.txt"; else if (opts.get("router") != null) book = "hosts.txt"; @@ -345,7 +345,7 @@ public abstract class LocalHTTPServer { if ("hosts.txt".equals(book)) tbook = _t("router"); else if ("userhosts.txt".equals(book)) - tbook = _t("master"); + tbook = _t("local"); else if ("privatehosts.txt".equals(book)) tbook = _t("private"); else diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java index 6c3526a3f..940598fee 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java @@ -118,7 +118,7 @@ public class AddressbookBean extends BaseBean */ public String getBook() { - if( book == null || ( !book.equalsIgnoreCase( "master" ) && + if( book == null || ( !book.equalsIgnoreCase( "local" ) && !book.equalsIgnoreCase( "router" ) && !book.equalsIgnoreCase( "private" ) && !book.equalsIgnoreCase( "published" ))) @@ -127,6 +127,8 @@ public class AddressbookBean extends BaseBean return book; } public void setBook(String book) { + if ("master".equals(book)) + book = "local"; this.book = DataHelper.stripHTML(book); // XSS } @@ -403,25 +405,6 @@ public class AddressbookBean extends BaseBean return filter; } -/**** - public boolean isMaster() - { - return getBook().equalsIgnoreCase("master"); - } - public boolean isRouter() - { - return getBook().equalsIgnoreCase("router"); - } - public boolean isPublished() - { - return getBook().equalsIgnoreCase("published"); - } - public boolean isPrivate() - { - return getBook().equalsIgnoreCase("private"); - } -****/ - /** * Because the following from addressbook.jsp fails parsing in the new EL: * javax.el.ELException: Failed to parse the expression @@ -437,7 +420,7 @@ public class AddressbookBean extends BaseBean public boolean isValidBook() { String s = getBook().toLowerCase(Locale.US); return s.equals("router") || - s.equals("master") || + s.equals("local") || s.equals("published") || s.equals("private"); } diff --git a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java index e59b8c017..a160cd8ef 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java @@ -79,6 +79,12 @@ public class BaseBean // added in 0.5, for compatibility with 0.4 config.txt if( properties.getProperty(PRIVATE_BOOK) == null) properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK); + // migrate + String local = properties.getProperty("master_addressbook"); + if (local != null) { + properties.setProperty("local_addressbook", local); + properties.remove("master_addressbook"); + } configLastLoaded = System.currentTimeMillis(); } } diff --git a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java index 51e05ed3b..f094715cb 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/NamingServiceBean.java @@ -103,6 +103,8 @@ public class NamingServiceBean extends AddressbookBean return super.getFileName(); loadConfig(); String filename = properties.getProperty( getBook() + "_addressbook" ); + if (filename == null) + return getBook(); return basename(filename); } diff --git a/apps/susidns/src/jsp/addressbook.jsp b/apps/susidns/src/jsp/addressbook.jsp index d15635c72..19c5f257d 100644 --- a/apps/susidns/src/jsp/addressbook.jsp +++ b/apps/susidns/src/jsp/addressbook.jsp @@ -66,7 +66,7 @@