forked from I2P_Developers/i2p.i2p
merge of '98b80575def2548ebf853a03d8029a40e9546ec8'
and 'e7693976cb5a07bd0477aa2d8fef1ecc9c56c3d8'
This commit is contained in:
@@ -830,12 +830,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
||||
int space = targetRequest.indexOf(' ');
|
||||
String filename = null;
|
||||
try {
|
||||
filename = targetRequest.substring(10, space);
|
||||
filename = targetRequest.substring(17, space); // "proxy.i2p/themes/".length
|
||||
} catch (IndexOutOfBoundsException ioobe) {}
|
||||
// theme hack
|
||||
if (filename.startsWith("themes/console/default/"))
|
||||
if (filename.startsWith("console/default/"))
|
||||
filename = filename.replaceFirst("default", I2PAppContext.getGlobalContext().getProperty("routerconsole.theme", "light"));
|
||||
File file = new File(_errorDir, filename);
|
||||
File themesDir = new File(_errorDir, "themes");
|
||||
File file = new File(themesDir, filename);
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
String type;
|
||||
if (filename.endsWith(".css"))
|
||||
@@ -849,7 +850,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
||||
out.write("HTTP/1.1 200 OK\r\nContent-Type: ".getBytes());
|
||||
out.write(type.getBytes());
|
||||
out.write("\r\nCache-Control: max-age=86400\r\n\r\n".getBytes());
|
||||
FileUtil.readFile(filename, _errorDir.getAbsolutePath(), out);
|
||||
FileUtil.readFile(filename, themesDir.getAbsolutePath(), out);
|
||||
return;
|
||||
} catch (IOException ioe) {}
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
path = new File(path, app + ".war");
|
||||
s.addWebApplication("/"+ app, path.getAbsolutePath()).start();
|
||||
// no passwords... initialize(wac);
|
||||
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "<a> started");
|
||||
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started");
|
||||
} catch (Exception ioe) {
|
||||
addFormError("Failed to start " + app + " " + ioe);
|
||||
}
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* I2P - An anonymous, secure, and fully-distributed communication network.
|
||||
*
|
||||
* ServiceManager.java
|
||||
* 2004 The I2P Project
|
||||
* http://www.i2p.net
|
||||
* This code is public domain.
|
||||
*/
|
||||
|
||||
package net.i2p.router.web;
|
||||
|
||||
//import java.io.InputStream;
|
||||
|
||||
import net.i2p.util.ShellCommand;
|
||||
|
||||
/**
|
||||
* Handles installation and uninstallation of I2P as a service.
|
||||
*
|
||||
* @author hypercubus
|
||||
*/
|
||||
public class ServiceManager {
|
||||
|
||||
private static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows") ? true : false;
|
||||
|
||||
private ShellCommand _shellCommand = new ShellCommand();
|
||||
|
||||
/**
|
||||
* Invokes the service wrapper installation script via a shell process.
|
||||
*
|
||||
* @return <code>null</code> if the installation was successful, otherwise
|
||||
* a <code>String</code> containing the shell output including error
|
||||
* messages is returned.
|
||||
*/
|
||||
public String installService() {
|
||||
return exec("install_i2p_service_" + (IS_WINDOWS ? "winnt.bat" : "unix"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the service wrapper uninstallation script via a shell process.
|
||||
*
|
||||
* @return <code>null</code> if the uninstallation was successful, otherwise
|
||||
* a <code>String</code> containing the shell output including error
|
||||
* messages is returned.
|
||||
*/
|
||||
public String uninstallService() {
|
||||
return exec("uninstall_i2p_service_" + (IS_WINDOWS ? "winnt.bat" : "unix"));
|
||||
}
|
||||
|
||||
private String exec(String command) {
|
||||
|
||||
// InputStream StdoutStream = _shellCommand.getInputStream();
|
||||
// InputStream StderrStream = _shellCommand.getErrorStream();
|
||||
StringBuilder result = null;
|
||||
|
||||
if (_shellCommand.executeAndWait(command))
|
||||
return null;
|
||||
|
||||
else
|
||||
if (result.toString().equals(""))
|
||||
return null;
|
||||
|
||||
else
|
||||
return result.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user