forked from I2P_Developers/i2p.i2p
* installer: Fix DOS line endings on misc. files (ticket #872)
* SusiDNS: - Trim and sort config form data - Fix DOS line endings on config files in Linux (ticket #872)
This commit is contained in:
@@ -24,15 +24,16 @@
|
||||
|
||||
package i2p.susi.dns;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.OrderedProperties;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
|
||||
public class ConfigBean implements Serializable {
|
||||
@@ -84,25 +85,19 @@ public class ConfigBean implements Serializable {
|
||||
File file = new File( configFileName );
|
||||
if( file != null && file.isFile() ) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader( new FileReader( file ) );
|
||||
String line;
|
||||
while( ( line = br.readLine() ) != null ) {
|
||||
buf.append( line );
|
||||
buf.append( "\n" );
|
||||
// use loadProps to trim
|
||||
Properties props = new OrderedProperties();
|
||||
DataHelper.loadProps(props, file);
|
||||
for (Map.Entry e : props.entrySet()) {
|
||||
buf.append((String) e.getKey()).append('=')
|
||||
.append((String) e.getValue()).append('\n');
|
||||
}
|
||||
config = buf.toString();
|
||||
saved = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (br != null)
|
||||
try { br.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,27 +106,23 @@ public class ConfigBean implements Serializable {
|
||||
{
|
||||
File file = new File( configFileName );
|
||||
try {
|
||||
PrintWriter out = new PrintWriter( new SecureFileOutputStream( file ) );
|
||||
out.print( config );
|
||||
out.flush();
|
||||
out.close();
|
||||
// use loadProps to trim, use storeProps to sort and get line endings right
|
||||
Properties props = new OrderedProperties();
|
||||
DataHelper.loadProps(props, new ByteArrayInputStream(config.getBytes("UTF-8")));
|
||||
DataHelper.storeProps(props, file);
|
||||
saved = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setConfig(String config) {
|
||||
// will come from form with \r\n line endings
|
||||
this.config = config;
|
||||
this.saved = false;
|
||||
|
||||
/*
|
||||
* as this is a property file we need a newline at the end of the last line!
|
||||
*/
|
||||
if( ! this.config.endsWith( "\n" ) ) {
|
||||
this.config += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessages() {
|
||||
String message = "";
|
||||
if( action != null ) {
|
||||
@@ -155,12 +146,14 @@ public class ConfigBean implements Serializable {
|
||||
message = "<p class=\"messages\">" + message + "</p>";
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getSerial()
|
||||
{
|
||||
lastSerial = "" + Math.random();
|
||||
action = null;
|
||||
return lastSerial;
|
||||
}
|
||||
|
||||
public void setSerial(String serial ) {
|
||||
this.serial = serial;
|
||||
}
|
||||
|
||||
@@ -24,16 +24,20 @@
|
||||
|
||||
package i2p.susi.dns;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Properties;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.SecureFileOutputStream;
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
public class SubscriptionsBean extends BaseBean
|
||||
{
|
||||
@@ -55,6 +59,7 @@ public class SubscriptionsBean extends BaseBean
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
private void reload()
|
||||
{
|
||||
File file = new File( getFileName() );
|
||||
@@ -69,9 +74,6 @@ public class SubscriptionsBean extends BaseBean
|
||||
buf.append( "\n" );
|
||||
}
|
||||
content = buf.toString();
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@@ -86,15 +88,27 @@ public class SubscriptionsBean extends BaseBean
|
||||
{
|
||||
File file = new File( getFileName() );
|
||||
try {
|
||||
// trim and sort
|
||||
List<String> urls = new ArrayList();
|
||||
InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
|
||||
String line;
|
||||
while ((line = DataHelper.readLine(in)) != null) {
|
||||
line = line.trim();
|
||||
if (line.length() > 0)
|
||||
urls.add(line);
|
||||
}
|
||||
Collections.sort(urls);
|
||||
PrintWriter out = new PrintWriter( new SecureFileOutputStream( file ) );
|
||||
out.print( content );
|
||||
out.flush();
|
||||
for (String url : urls) {
|
||||
out.println(url);
|
||||
}
|
||||
out.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessages() {
|
||||
String message = "";
|
||||
if( action != null ) {
|
||||
@@ -134,25 +148,23 @@ public class SubscriptionsBean extends BaseBean
|
||||
message = "<p class=\"messages\">" + message + "</p>";
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getSerial()
|
||||
{
|
||||
lastSerial = "" + Math.random();
|
||||
action = null;
|
||||
return lastSerial;
|
||||
}
|
||||
|
||||
public void setSerial(String serial ) {
|
||||
this.serial = serial;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
// will come from form with \r\n line endings
|
||||
this.content = content;
|
||||
|
||||
/*
|
||||
* as this is a property file we need a newline at the end of the last line!
|
||||
*/
|
||||
if( ! this.content.endsWith( "\n" ) ) {
|
||||
this.content += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
if( content != null )
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
* Console: Show log location on /logs even if not opened yet (ticket #905)
|
||||
* HTTP proxy: Verify nonce count in digest auth
|
||||
* i2psnark: Use smaller piece size for small torrents
|
||||
* installer: Fix DOS line endings on misc. files (ticket #872)
|
||||
* Plugins: Track pending plugin clients better, don't hold references,
|
||||
start delayed clients from SimpleTimer2 instead of Job queue (ticket #670)
|
||||
* SusiDNS:
|
||||
- Trim and sort config form data
|
||||
- Fix DOS line endings on config files in Linux (ticket #872)
|
||||
|
||||
2013-04-25 kytv
|
||||
* Portuguese, Russian, Spanish, and Swedish translation updates from Transifex
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
#
|
||||
# If you have a 'split' directory installation, with configuration
|
||||
# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
|
||||
# edit the file in the configuration directory, NOT the install directory.
|
||||
#
|
||||
# Blocking is now enabled by default.
|
||||
# To disable blocking, set router.blocklist.enable=false on configadvanced.jsp,
|
||||
# or simply delete this file or remove all the entries below, and restart.
|
||||
#
|
||||
# Add additional entries as desired, sorting not required.
|
||||
# This file is only read at router startup.
|
||||
# To manually block a router after startup, use the form on http://127.0.0.1:7657/configpeer.jsp
|
||||
# Warning - a large list will increase memory usage.
|
||||
# Please do not block too broadly, it will segment and harm the network.
|
||||
# For example, http://www.bluetack.co.uk/config/splist.zip is very broad and includes Tor users, it is not recommended.
|
||||
# A more reasonable list: http://www.bluetack.co.uk/config/level1.zip
|
||||
#
|
||||
# We have included the bogons from http://www.team-cymru.org/Services/Bogons/http.html ,
|
||||
# but you will have to update your blocklist manually if the bogon list changes.
|
||||
# You must update this list yourself, it is not overwritten by the update process.
|
||||
#
|
||||
# * Acceptable formats (IPV4 only):
|
||||
# * #comment (# must be in column 1)
|
||||
# * comment:IP-IP
|
||||
# * comment:morecomments:IP-IP
|
||||
# * (comments also allowed before any of the following)
|
||||
# * IP-IP
|
||||
# * IP/masklength
|
||||
# * IP
|
||||
# * hostname (DNS looked up at list readin time, not dynamically, so may not be much use)
|
||||
# * 44-byte Base64 router hash
|
||||
# *
|
||||
# * No whitespace allowed after the last ':'.
|
||||
# *
|
||||
# * For further information and downloads:
|
||||
# * http://www.bluetack.co.uk/forums/index.php?autocom=faq&CODE=02&qid=17
|
||||
# * http://blocklist.googlepages.com/
|
||||
# * http://www.team-cymru.org/Services/Bogons/http.html
|
||||
#
|
||||
Chinese Floodfill Flooder:159.226.40.7
|
||||
Friend of the Chinese Floodfill Flooder:159.226.40.3
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:0.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:10.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:127.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:169.254.0.0/16
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:172.16.0.0/12
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.0.0.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.0.2.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.168.0.0/16
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:198.18.0.0/15
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:198.51.100.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:203.0.113.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:224.0.0.0/3
|
||||
#
|
||||
# If you have a 'split' directory installation, with configuration
|
||||
# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
|
||||
# edit the file in the configuration directory, NOT the install directory.
|
||||
#
|
||||
# Blocking is now enabled by default.
|
||||
# To disable blocking, set router.blocklist.enable=false on configadvanced.jsp,
|
||||
# or simply delete this file or remove all the entries below, and restart.
|
||||
#
|
||||
# Add additional entries as desired, sorting not required.
|
||||
# This file is only read at router startup.
|
||||
# To manually block a router after startup, use the form on http://127.0.0.1:7657/configpeer.jsp
|
||||
# Warning - a large list will increase memory usage.
|
||||
# Please do not block too broadly, it will segment and harm the network.
|
||||
# For example, http://www.bluetack.co.uk/config/splist.zip is very broad and includes Tor users, it is not recommended.
|
||||
# A more reasonable list: http://www.bluetack.co.uk/config/level1.zip
|
||||
#
|
||||
# We have included the bogons from http://www.team-cymru.org/Services/Bogons/http.html ,
|
||||
# but you will have to update your blocklist manually if the bogon list changes.
|
||||
# You must update this list yourself, it is not overwritten by the update process.
|
||||
#
|
||||
# * Acceptable formats (IPV4 only):
|
||||
# * #comment (# must be in column 1)
|
||||
# * comment:IP-IP
|
||||
# * comment:morecomments:IP-IP
|
||||
# * (comments also allowed before any of the following)
|
||||
# * IP-IP
|
||||
# * IP/masklength
|
||||
# * IP
|
||||
# * hostname (DNS looked up at list readin time, not dynamically, so may not be much use)
|
||||
# * 44-byte Base64 router hash
|
||||
# *
|
||||
# * No whitespace allowed after the last ':'.
|
||||
# *
|
||||
# * For further information and downloads:
|
||||
# * http://www.bluetack.co.uk/forums/index.php?autocom=faq&CODE=02&qid=17
|
||||
# * http://blocklist.googlepages.com/
|
||||
# * http://www.team-cymru.org/Services/Bogons/http.html
|
||||
#
|
||||
Chinese Floodfill Flooder:159.226.40.7
|
||||
Friend of the Chinese Floodfill Flooder:159.226.40.3
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:0.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:10.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:127.0.0.0/8
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:169.254.0.0/16
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:172.16.0.0/12
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.0.0.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.0.2.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:192.168.0.0/16
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:198.18.0.0/15
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:198.51.100.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:203.0.113.0/24
|
||||
<a href="http://www.team-cymru.org/Services/Bogons/http.html">The Team Cymru Bogon List v6.8 03 FEB 2011</a>:224.0.0.0/3
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<html>
|
||||
<!--
|
||||
#
|
||||
# If you have a 'split' directory installation, with configuration
|
||||
# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
|
||||
# edit the file in the configuration directory, NOT the install directory.
|
||||
#
|
||||
-->
|
||||
<head>
|
||||
<!-- remove the following three lines to stop redirecting to the help page -->
|
||||
<meta http-equiv="refresh" content="1;url=/help/" />
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<title>I2P Anonymous Webserver</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<!--
|
||||
#
|
||||
# If you have a 'split' directory installation, with configuration
|
||||
# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
|
||||
# edit the file in the configuration directory, NOT the install directory.
|
||||
#
|
||||
-->
|
||||
<head>
|
||||
<!-- remove the following three lines to stop redirecting to the help page -->
|
||||
<meta http-equiv="refresh" content="1;url=/help/" />
|
||||
<meta http-equiv="pragma" content="no-cache">
|
||||
<meta http-equiv="cache-control" content="no-cache">
|
||||
<title>I2P Anonymous Webserver</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 17;
|
||||
public final static long BUILD = 18;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
||||
Reference in New Issue
Block a user