X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FMain.java;h=7be305a0977abc17c0fd227f10d1f18c97dca70a;hb=8dc26a0ac5e5f1aa9296c5db71114dce19503973;hp=9d9592eefd3356e9d7c1e61b9e0b5142ab7b2376;hpb=868e32295fb975158cb8456cb559e79924b73151;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index 9d9592e..7be305a 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -19,6 +19,7 @@ import be.nikiroo.fanfix.library.CacheLibrary; import be.nikiroo.fanfix.library.LocalLibrary; import be.nikiroo.fanfix.library.RemoteLibrary; import be.nikiroo.fanfix.library.RemoteLibraryServer; +import be.nikiroo.fanfix.library.WebLibraryServer; import be.nikiroo.fanfix.output.BasicOutput; import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.fanfix.reader.BasicReader; @@ -28,7 +29,7 @@ import be.nikiroo.fanfix.supported.BasicSupport; import be.nikiroo.fanfix.supported.SupportType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; -import be.nikiroo.utils.serial.server.ServerObject; +import be.nikiroo.utils.VersionCheck; /** * Main program entry point. @@ -78,7 +79,7 @@ public class Main { *
* Will only be called when a version is available. *
- * Note that you can call {@link VersionCheck#ok()} on it if the user has - * read the information (by default, it is marked read only on certain other - * actions). + * Note that you can call {@link Instance#setVersionChecked()} on it if the + * user has read the information (by default, it is marked read only on + * certain other actions). * * @param updates * the new version information @@ -1023,20 +1030,29 @@ public class Main { /** * Start a Fanfix server. * - * @param key - * the key taht will be needed to contact the Fanfix server - * @param port - * the port on which to run - * * @throws IOException * in case of I/O errors * @throws SSLException * when the key was not accepted */ - private void startServer(String key, int port) throws IOException { - ServerObject server = new RemoteLibraryServer(key, port); - server.setTraceHandler(Instance.getInstance().getTraceHandler()); - server.run(); + private void startServer() throws IOException { + String mode = Instance.getInstance().getConfig() + .getString(Config.SERVER_MODE, "fanfix"); + if (mode.equals("fanfix")) { + RemoteLibraryServer server = new RemoteLibraryServer(); + server.setTraceHandler(Instance.getInstance().getTraceHandler()); + server.run(); + } else if (mode.equals("http")) { + WebLibraryServer server = new WebLibraryServer(false); + server.setTraceHandler(Instance.getInstance().getTraceHandler()); + server.run(); + } else if (mode.equals("https")) { + WebLibraryServer server = new WebLibraryServer(true); + server.setTraceHandler(Instance.getInstance().getTraceHandler()); + server.run(); + } else { + throw new IOException("Unknown server mode: " + mode); + } } /**