i2psnark standalone:

- Add shutdown hook to delete temp dir
- Fix up CSS URL paths to use single quotes
- Don't attempt to register with update manager
This commit is contained in:
zzz
2016-06-11 13:34:09 +00:00
parent e27af374b0
commit bb8e050434
4 changed files with 21 additions and 7 deletions

View File

@ -191,7 +191,9 @@
<zipfileset src="build/i2psnark.jar" />
<zipfileset src="../../../core/java/build/i2p.jar" />
<zipfileset src="../../jetty/jettylib/commons-logging.jar" />
<!-- without this we get a warning about 'no JSP support' but that's it
<zipfileset src="../../jetty/jettylib/jasper-runtime.jar" />
-->
<zipfileset src="../../jetty/jettylib/javax.servlet.jar" />
<zipfileset src="../../jetty/jettylib/jetty-continuation.jar" />
<zipfileset src="../../jetty/jettylib/jetty-deploy.jar" />
@ -244,8 +246,8 @@
</replace>
<replace dir="build/standalone-resources/.resources/themes/snark"
summary="true"
token="url(&quot;../../console/light/images/"
value="url(&quot;/i2psnark/.resources/themes/snark/ubergine/images/" >
token="url('../../console/light/images/"
value="url('/i2psnark/.resources/themes/snark/ubergine/images/" >
<include name="**/*.css" />
</replace>
<replace dir="build/standalone-resources/.resources/themes/snark"

View File

@ -233,6 +233,8 @@ public class SnarkManager implements CompleteListener {
_configFile = new File(_configDir, CONFIG_FILE);
_trackerMap = new ConcurrentHashMap<String, Tracker>(4);
loadConfig(null);
if (!ctx.isRouterContext())
Runtime.getRuntime().addShutdownHook(new Thread(new TempDeleter(_util.getTempDir()), "Snark Temp Dir Deleter"));
}
/** Caller _must_ call loadConfig(file) before this if setting new values
@ -245,7 +247,7 @@ public class SnarkManager implements CompleteListener {
_monitor = new I2PAppThread(new DirMonitor(), "Snark DirMonitor", true);
_monitor.start();
// only if default instance
if ("i2psnark".equals(_contextName))
if (_context.isRouterContext() && "i2psnark".equals(_contextName))
// delay until UpdateManager is there
_context.simpleTimer2().addEvent(new Register(), 4*60*1000);
// Not required, Jetty has a shutdown hook
@ -254,6 +256,16 @@ public class SnarkManager implements CompleteListener {
_idleChecker.schedule(5*60*1000);
}
/**
* Only used in app context
* @since 0.9.27
*/
private static class TempDeleter implements Runnable {
private final File file;
public TempDeleter(File f) { file = f; }
public void run() { FileUtil.rmdir(file, false); }
}
/** @since 0.9.4 */
private class Register implements SimpleTimer.TimedEvent {
public void timeReached() {

View File

@ -29,7 +29,7 @@ body.iframed {
font-weight: bold;
font-size: 9pt;
color: #559;
background: #fff url("../../console/light/images/header.png") repeat-x scroll center center;
background: #fff url('../../console/light/images/header.png') repeat-x scroll center center;
-moz-border-radius: 0px;
-khtml-border-radius: 3px;
border-radius: 0px;
@ -167,7 +167,7 @@ th {
border-bottom: 1px solid #66f;
color: #001;
whitespace: nowrap;
background: #fff url("../../console/light/images/header.png") repeat-x scroll center center;
background: #fff url('../../console/light/images/header.png') repeat-x scroll center center;
}
th:first-child {
@ -414,7 +414,7 @@ td:first-child {
border-radius: 0 0 5px 5px;
border-top: 0;
text-shadow: 0 1px 0 #aaa;
background: #fff url("../../console/light/images/header.png") repeat-x scroll center center;
background: #fff url('../../console/light/images/header.png') repeat-x scroll center center;
font-variant: small-caps !important;
box-shadow: 0 1px 3px #999;
}

View File

@ -166,7 +166,7 @@ tr {
}
thead, tfoot {
background: url("images/bling2.png") repeat-x scroll center center #867;
background: url('images/bling2.png') repeat-x scroll center center #867;
font-weight: bold;
color: #503;
}