diff --git a/LICENSE.txt b/LICENSE.txt index bc8d615ae5..fd59c032ee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -173,6 +173,10 @@ Applications: Copyright (C) sponge See licenses/COPYING-BOB.txt + Desktopgui + Copyright (c) Mathias De Maré + See licenses/LICENSE-DesktopGUI.txt + I2PSnark: Copyright (C) 2003 Mark J. Wielaard GPLv2 (or any later version) @@ -291,10 +295,6 @@ distributions. See the source package for the additional license information. Copyright (C) sponge DWTFYWTPL - Desktopgui - Copyright (c) Mathias De Maré - See apps/desktopgui/LICENSE - SAM C Library: Copyright (c) 2004, Matthew P. Cashdollar See apps/sam/c/doc/license.txt diff --git a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java index 0d5dde09ed..ac97a2652a 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java @@ -39,6 +39,7 @@ import net.i2p.util.PortMapper; import net.i2p.util.SecureDirectory; import net.i2p.util.I2PSSLSocketFactory; import net.i2p.util.SystemVersion; + import org.eclipse.jetty.security.HashLoginService; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -69,6 +70,8 @@ import org.eclipse.jetty.util.thread.ExecutorThreadPool; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.ThreadPool; +import org.tanukisoftware.wrapper.WrapperManager; + /** * Start the router console. */ @@ -128,6 +131,7 @@ public class RouterConsoleRunner implements RouterApp { private static final int MAX_THREADS = 24; private static final int MAX_IDLE_TIME = 90*1000; private static final String THREAD_NAME = "RouterConsole Jetty"; + private final static String DAEMON_USER = "i2psvc"; /** *
@@ -213,7 +217,7 @@ public class RouterConsoleRunner implements RouterApp {
     public synchronized void startup() {
         changeState(STARTING);
         checkJavaVersion();
-        startTrayApp(_context);
+        startTrayApp();
         startConsole();
     }
 
@@ -265,18 +269,23 @@ public class RouterConsoleRunner implements RouterApp {
         return _server;
     }
 
-    private static void startTrayApp(I2PAppContext ctx) {
+    private void startTrayApp() {
+        // if no permissions, don't even try
+        // isLaunchedAsService() always returns true on Linux
+        if (DAEMON_USER.equals(System.getProperty("user.name")) ||
+            (SystemVersion.isWindows() && _context.hasWrapper() && WrapperManager.isLaunchedAsService())) {
+            // required true for jrobin to work
+            System.setProperty("java.awt.headless", "true");
+            return;
+        }
         try {
-            //TODO: move away from routerconsole into a separate application.
-            //ApplicationManager?
-            boolean recentJava = SystemVersion.isJava6();
             // default false for now
-            boolean desktopguiEnabled = ctx.getBooleanProperty("desktopgui.enabled");
-            if (recentJava && desktopguiEnabled) {
+            boolean desktopguiEnabled = _context.getBooleanProperty("desktopgui.enabled");
+            if (desktopguiEnabled) {
                 //Check if we are in a headless environment, set properties accordingly
           	System.setProperty("java.awt.headless", Boolean.toString(GraphicsEnvironment.isHeadless()));
-                String[] args = new String[0];
-                net.i2p.desktopgui.Main.beginStartup(args);    
+                net.i2p.desktopgui.Main dtg = new net.i2p.desktopgui.Main(_context, _mgr, null);    
+                dtg.startup();
             } else {
                 // required true for jrobin to work
           	System.setProperty("java.awt.headless", "true");
diff --git a/build.xml b/build.xml
index 20ff3d158f..64c2c6c8dd 100644
--- a/build.xml
+++ b/build.xml
@@ -1257,9 +1257,10 @@
           
         
         
+        
     
 
-    
+    
         
     
 
@@ -1476,15 +1477,16 @@
         
         
         
-       
         
-       -->
         
         
         
-        
+        
+