From: Niki Roo Date: Tue, 12 May 2020 22:07:12 +0000 (+0200) Subject: ui X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=4bd7d202930dd0ba9129c7bd6af7dd83bc294c24;p=fanfix.git ui --- diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServer.java b/src/be/nikiroo/fanfix/library/WebLibraryServer.java index 4abd438..7c5cf42 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/WebLibraryServer.java @@ -93,8 +93,8 @@ public class WebLibraryServer implements Runnable { subkeys.add(""); for (String subkey : subkeys) { - if (CookieUtils.validateCookie( - wookie + subkey + opts, rehashed)) { + if (CookieUtils.validateCookie(wookie + subkey + + opts, rehashed)) { this.wookie = wookie; this.token = token; this.success = true; @@ -148,8 +148,7 @@ public class WebLibraryServer implements Runnable { Integer port = Instance.getInstance().getConfig() .getInteger(Config.SERVER_PORT); if (port == null) { - throw new IOException( - "Cannot start web server: port not specified"); + throw new IOException("Cannot start web server: port not specified"); } int cacheMb = Instance.getInstance().getConfig() @@ -173,8 +172,8 @@ public class WebLibraryServer implements Runnable { if (!keystorePath.isEmpty()) { File keystoreFile = new File(keystorePath); try { - KeyStore keystore = KeyStore - .getInstance(KeyStore.getDefaultType()); + KeyStore keystore = KeyStore.getInstance(KeyStore + .getDefaultType()); InputStream keystoreStream = new FileInputStream( keystoreFile); try { @@ -226,8 +225,8 @@ public class WebLibraryServer implements Runnable { params.get("login"), whitelist); } else { String token = cookies.get("token"); - login = login(who, token, Instance.getInstance().getConfig() - .getList(Config.SERVER_ALLOWED_SUBKEYS)); + login = login(who, token, Instance.getInstance() + .getConfig().getList(Config.SERVER_ALLOWED_SUBKEYS)); } if (login.isSuccess()) { @@ -236,8 +235,9 @@ public class WebLibraryServer implements Runnable { } // refresh token - session.getCookies().set(new Cookie("token", - login.getToken(), "30; path=/")); + session.getCookies() + .set(new Cookie("token", login.getToken(), + "30; path=/")); // set options String optionName = params.get("optionName"); @@ -247,8 +247,9 @@ public class WebLibraryServer implements Runnable { session.getCookies().delete(optionName); cookies.remove(optionName); } else { - session.getCookies().set(new Cookie(optionName, - optionValue, "; path=/")); + session.getCookies().set( + new Cookie(optionName, optionValue, + "; path=/")); cookies.put(optionName, optionValue); } } @@ -258,7 +259,7 @@ public class WebLibraryServer implements Runnable { if (!login.isSuccess() && (uri.equals("/") // || uri.startsWith(STORY_URL_BASE) // || uri.startsWith(VIEWER_URL_BASE) // - || uri.startsWith(LIST_URL))) { + || uri.startsWith(LIST_URL))) { rep = loginPage(login, uri); } @@ -302,9 +303,10 @@ public class WebLibraryServer implements Runnable { NanoHTTPD.MIME_PLAINTEXT, "Not Found"); } } catch (Exception e) { - Instance.getInstance().getTraceHandler().error( - new IOException("Cannot process web request", - e)); + Instance.getInstance() + .getTraceHandler() + .error(new IOException( + "Cannot process web request", e)); rep = newFixedLengthResponse(Status.INTERNAL_ERROR, NanoHTTPD.MIME_PLAINTEXT, "An error occured"); } @@ -413,8 +415,8 @@ public class WebLibraryServer implements Runnable { wl = false; } - rw = Instance.getInstance().getConfig().getBoolean(Config.SERVER_RW, - rw); + rw = Instance.getInstance().getConfig() + .getBoolean(Config.SERVER_RW, rw); if (!subkey.isEmpty()) { List allowed = Instance.getInstance().getConfig() .getList(Config.SERVER_ALLOWED_SUBKEYS); @@ -448,10 +450,9 @@ public class WebLibraryServer implements Runnable { uri = "/"; } - builder.append( - "