diff --git a/src/main/java/net/doubledoordev/backend/Main.java b/src/main/java/net/doubledoordev/backend/Main.java index 1659ca5..4355f85 100644 --- a/src/main/java/net/doubledoordev/backend/Main.java +++ b/src/main/java/net/doubledoordev/backend/Main.java @@ -50,6 +50,7 @@ import net.doubledoordev.backend.web.http.ServerFileHandler; import net.doubledoordev.backend.web.socket.ServerControlSocketApplication; import net.doubledoordev.backend.web.socket.ServerMonitorSocketApplication; +import net.doubledoordev.backend.web.socket.ServerPropertiesSocketApplication; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.glassfish.grizzly.http.server.CLStaticHttpHandler; @@ -143,6 +144,7 @@ public static void main(String[] args) throws Exception // Socket stuff ServerMonitorSocketApplication.register(); ServerControlSocketApplication.register(); + ServerPropertiesSocketApplication.register(); final NetworkListener networkListener = new NetworkListener("secured-listener"); //networkListener.setSecure(true); @@ -168,6 +170,7 @@ public static void main(String[] args) throws Exception CommandHandler.init(); for (Server server : SETTINGS.servers.values()) { + server.init(); if (server.getAutoStart()) { try diff --git a/src/main/java/net/doubledoordev/backend/server/FileManager.java b/src/main/java/net/doubledoordev/backend/server/FileManager.java index 51c476f..b4af2e6 100644 --- a/src/main/java/net/doubledoordev/backend/server/FileManager.java +++ b/src/main/java/net/doubledoordev/backend/server/FileManager.java @@ -48,6 +48,7 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.logging.log4j.util.Strings; +import org.glassfish.grizzly.http.util.MimeType; import org.spout.nbt.Tag; import java.io.File; @@ -140,6 +141,9 @@ public boolean canEdit(File file) case "jar": case "zip": case "disabled": + case "exe": + case "mca": + case "mcr": return false; default: @@ -153,15 +157,19 @@ public String getEditor() if (file.getName().equals("whitelist.json")) return "whitelist.ftl"; if (file.getName().equals("banned-players.json")) return "banned-players.ftl"; if (file.getName().equals("banned-ips.json")) return "banned-ips.ftl"; + if (file.getName().equals("server.properties")) return "serverProperties.ftl"; switch (getExtension()) { case "jar": case "zip": case "disabled": + case "mca": + case "mcr": return null; case "json": case "dat": + case "dat_old": return "json.ftl"; case "jpg": @@ -182,6 +190,8 @@ public String getIcon(File file) case "html": case "json": case "dat": + case "dat_old": + case "properties": return "file-code-o"; case "txt": @@ -208,6 +218,7 @@ public String getFileContentsAsJson() throws IOException case "json": return FileUtils.readFileToString(file); case "dat": + case "dat_old": Tag tag = Helper.readRawNBT(file, true); if (tag == null) tag = Helper.readRawNBT(file, false); if (tag != null) return JsonNBTHelper.parseNBT(tag).toString(); @@ -221,34 +232,10 @@ public String getFileContentsAsString() throws IOException return StringEscapeUtils.escapeHtml4(FileUtils.readFileToString(file)); } -// public String getFileContentsAsBase64() throws IOException -// { -// return String.format("data:%s;base64,%s", SimpleWebServer.MIME_TYPES.get(getExtension()), Base64.encodeBase64String(FileUtils.readFileToByteArray(file))); -// } - -// public NanoHTTPD.Response set(String contents) -// { -// if (!file.canWrite()) return new NanoHTTPD.Response(FORBIDDEN, MIME_PLAINTEXT, "File is write protected."); -// try -// { -// switch (getExtension()) -// { -// case "dat": -// Helper.writeRawNBT(file, Helper.readRawNBT(file, true) != null, JsonNBTHelper.parseJSON(Constants.JSONPARSER.parse(contents))); -// break; -// default: -// FileUtils.writeStringToFile(file, contents); -// break; -// } -// } -// catch (IOException e) -// { -// e.printStackTrace(); -// return new NanoHTTPD.Response(INTERNAL_ERROR, MIME_PLAINTEXT, e.toString()); -// } -// -// return new NanoHTTPD.Response(OK, MIME_PLAINTEXT, "OK"); -// } + public String getFileContentsAsBase64() throws IOException + { + return String.format("data:%s;base64,%s", MimeType.get(getExtension()), Base64.encodeBase64String(FileUtils.readFileToByteArray(file))); + } public void rename(String newname) { diff --git a/src/main/java/net/doubledoordev/backend/server/Server.java b/src/main/java/net/doubledoordev/backend/server/Server.java index 96c426f..28dc8fb 100644 --- a/src/main/java/net/doubledoordev/backend/server/Server.java +++ b/src/main/java/net/doubledoordev/backend/server/Server.java @@ -77,14 +77,14 @@ @SuppressWarnings("UnusedDeclaration") public class Server { - private static final String SERVER_PROPERTIES = "server.properties"; - private static final String SERVER_PORT = "server-port"; - private static final String QUERY_PORT = "query.port"; - private static final String QUERY_ENABLE = "enable-query"; - private static final String RCON_ENABLE = "enable-rcon"; - private static final String RCON_PASSWORD = "rcon.password"; - private static final String RCON_PORT = "rcon.port"; - private static final String SERVER_IP = "server-ip"; + public static final String SERVER_PROPERTIES = "server.properties"; + public static final String SERVER_PORT = "server-port"; + public static final String QUERY_PORT = "query.port"; + public static final String QUERY_ENABLE = "enable-query"; + public static final String RCON_ENABLE = "enable-rcon"; + public static final String RCON_PASSWORD = "rcon.password"; + public static final String RCON_PORT = "rcon.port"; + public static final String SERVER_IP = "server-ip"; /* * START exposed Json data diff --git a/src/main/java/net/doubledoordev/backend/util/Helper.java b/src/main/java/net/doubledoordev/backend/util/Helper.java index 6d1fde6..c6a09c8 100644 --- a/src/main/java/net/doubledoordev/backend/util/Helper.java +++ b/src/main/java/net/doubledoordev/backend/util/Helper.java @@ -40,14 +40,20 @@ package net.doubledoordev.backend.util; +import com.google.gson.JsonArray; +import com.google.gson.JsonPrimitive; import net.doubledoordev.backend.Main; import net.doubledoordev.backend.server.Server; +import net.doubledoordev.backend.util.methodCaller.IMethodCaller; +import net.doubledoordev.backend.util.methodCaller.WebSocketCaller; import org.apache.logging.log4j.util.Strings; +import org.glassfish.grizzly.websockets.WebSocket; import org.spout.nbt.Tag; import org.spout.nbt.stream.NBTInputStream; import org.spout.nbt.stream.NBTOutputStream; import java.io.*; +import java.lang.reflect.InvocationTargetException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.URL; @@ -60,6 +66,7 @@ import static net.doubledoordev.backend.util.Constants.JSONPARSER; import static net.doubledoordev.backend.util.Constants.RANDOM; +import static net.doubledoordev.backend.util.Constants.SERVERS; import static net.doubledoordev.backend.util.Settings.SETTINGS; /** @@ -294,4 +301,49 @@ public static String getOnlineTime(String dayString, String hoursString, String sb.append(String.format(secondsString, time / (1000))); return sb.toString(); } + + public static String getReadOnlyProperties() + { + JsonArray array = new JsonArray(); + + if (SETTINGS.fixedPorts) + { + array.add(new JsonPrimitive(Server.SERVER_PORT)); + array.add(new JsonPrimitive(Server.QUERY_PORT)); + array.add(new JsonPrimitive(Server.RCON_PORT)); + } + if (SETTINGS.fixedIP) array.add(new JsonPrimitive(Server.SERVER_IP)); + + array.add(new JsonPrimitive(Server.RCON_ENABLE)); + array.add(new JsonPrimitive(Server.RCON_PASSWORD)); + array.add(new JsonPrimitive(Server.QUERY_ENABLE)); + + return array.toString(); + } + + public static boolean invokeWithRefectionMagic(WebSocket caller, Object instance, String[] split, int start) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException + { + start++; + for (java.lang.reflect.Method method : instance.getClass().getDeclaredMethods()) + { + if (!method.getName().equalsIgnoreCase(split[start - 1])) continue; // Name match + boolean userMethodCaller = method.getParameterTypes().length != 0 && method.getParameterTypes()[0].isAssignableFrom(IMethodCaller.class); // See if first type is IMethodCaller + if (method.getParameterTypes().length == split.length - start + (userMethodCaller ? 1 : 0)) // parameter length match + { + try + { + Object parms[] = new Object[split.length - start + (userMethodCaller ? 1 : 0)]; + if (userMethodCaller) parms[0] = new WebSocketCaller(caller); + for (int i = userMethodCaller ? 1 : 0; i < method.getParameterTypes().length; i++) parms[i] = TypeHellhole.convert(method.getParameterTypes()[i], split[i + start - (userMethodCaller ? 1 : 0)]); + method.invoke(instance, parms); + return userMethodCaller; + } + catch (ClassCastException ignored) + { + ignored.printStackTrace(); + } + } + } + throw new NoSuchMethodException(split[start - 1]); + } } diff --git a/src/main/java/net/doubledoordev/backend/util/WebSocketHelper.java b/src/main/java/net/doubledoordev/backend/util/WebSocketHelper.java index 60f79a4..c7d55be 100644 --- a/src/main/java/net/doubledoordev/backend/util/WebSocketHelper.java +++ b/src/main/java/net/doubledoordev/backend/util/WebSocketHelper.java @@ -46,6 +46,7 @@ import net.doubledoordev.backend.server.Server; import net.doubledoordev.backend.web.socket.ServerControlSocketApplication; import net.doubledoordev.backend.web.socket.ServerMonitorSocketApplication; +import net.doubledoordev.backend.web.socket.ServerPropertiesSocketApplication; import org.glassfish.grizzly.websockets.WebSocket; import static net.doubledoordev.backend.util.Constants.*; @@ -122,6 +123,7 @@ public static void sendData(WebSocket socket, JsonElement s) public static void sendServerUpdate(Server instance) { ServerMonitorSocketApplication.sendUpdateToAll(instance); + ServerPropertiesSocketApplication.sendUpdateToAll(instance); } public static void sendOk(WebSocket socket) @@ -132,4 +134,17 @@ public static void sendOk(WebSocket socket) socket.send(root.toString()); } + + public static void sendError(WebSocket socket, Throwable e) + { + StringBuilder error = new StringBuilder(); + do + { + error.append('\n').append(e.getClass().getSimpleName()); + if (e.getMessage() != null) error.append(": ").append(e.getMessage()); + } + while ((e = e.getCause()) != null); + WebSocketHelper.sendError(socket, error.substring(1)); + socket.close(); + } } diff --git a/src/main/java/net/doubledoordev/backend/web/socket/FileManagerSocketApplication.java b/src/main/java/net/doubledoordev/backend/web/socket/FileManagerSocketApplication.java new file mode 100644 index 0000000..21ee519 --- /dev/null +++ b/src/main/java/net/doubledoordev/backend/web/socket/FileManagerSocketApplication.java @@ -0,0 +1,52 @@ +/* + * Unless otherwise specified through the '@author' tag or comments at + * the top of the file or on a specific portion of the code the following license applies: + * + * Copyright (c) 2014, DoubleDoorDevelopment + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * The header specified or the above copyright notice, this list of conditions + * and the following disclaimer below must be displayed at the top of the source code + * of any web page received while using any part of the service this software provides. + * + * The header to be displayed: + * This page was generated by DoubleDoorDevelopment's D3Backend or a derivative thereof. + * + * Neither the name of the project nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +package net.doubledoordev.backend.web.socket; + +import org.glassfish.grizzly.websockets.WebSocketApplication; + +/** + * @author Dries007 + */ +public class FileManagerSocketApplication extends WebSocketApplication +{ + //TODO: +} diff --git a/src/main/java/net/doubledoordev/backend/web/socket/ServerControlSocketApplication.java b/src/main/java/net/doubledoordev/backend/web/socket/ServerControlSocketApplication.java index 0e3a775..dba6ff5 100644 --- a/src/main/java/net/doubledoordev/backend/web/socket/ServerControlSocketApplication.java +++ b/src/main/java/net/doubledoordev/backend/web/socket/ServerControlSocketApplication.java @@ -45,6 +45,7 @@ import net.doubledoordev.backend.Main; import net.doubledoordev.backend.permissions.User; import net.doubledoordev.backend.server.Server; +import net.doubledoordev.backend.util.Helper; import net.doubledoordev.backend.util.Settings; import net.doubledoordev.backend.util.TypeHellhole; import net.doubledoordev.backend.util.WebSocketHelper; @@ -73,32 +74,6 @@ private ServerControlSocketApplication() { } - private static boolean invokeWithRefectionMagic(WebSocket caller, Object instance, String[] split, int start) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException - { - start++; - for (java.lang.reflect.Method method : instance.getClass().getDeclaredMethods()) - { - if (!method.getName().equalsIgnoreCase(split[start - 1])) continue; // Name match - boolean userMethodCaller = method.getParameterTypes().length != 0 && method.getParameterTypes()[0].isAssignableFrom(IMethodCaller.class); // See if first type is IMethodCaller - if (method.getParameterTypes().length == split.length - start + (userMethodCaller ? 1 : 0)) // parameter length match - { - try - { - Object parms[] = new Object[split.length - start + (userMethodCaller ? 1 : 0)]; - if (userMethodCaller) parms[0] = new WebSocketCaller(caller); - for (int i = userMethodCaller ? 1 : 0; i < method.getParameterTypes().length; i++) parms[i] = TypeHellhole.convert(method.getParameterTypes()[i], split[i + start - (userMethodCaller ? 1 : 0)]); - method.invoke(instance, parms); - return userMethodCaller; - } - catch (ClassCastException ignored) - { - ignored.printStackTrace(); - } - } - } - throw new NoSuchMethodException(split[start - 1]); - } - @Override public void onConnect(WebSocket socket) { @@ -147,7 +122,7 @@ public void onMessage(WebSocket socket, String text) } try { - if (!invokeWithRefectionMagic(socket, server, args, 0)) + if (!Helper.invokeWithRefectionMagic(socket, server, args, 0)) { WebSocketHelper.sendOk(socket); socket.close(); @@ -155,8 +130,7 @@ public void onMessage(WebSocket socket, String text) } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - WebSocketHelper.sendError(socket, e.getClass().getSimpleName() + (e.getMessage() != null ? ": " + e.getMessage() : "")); - socket.close(); + WebSocketHelper.sendError(socket, e); } } diff --git a/src/main/java/net/doubledoordev/backend/web/socket/ServerPropertiesSocketApplication.java b/src/main/java/net/doubledoordev/backend/web/socket/ServerPropertiesSocketApplication.java new file mode 100644 index 0000000..a35edc8 --- /dev/null +++ b/src/main/java/net/doubledoordev/backend/web/socket/ServerPropertiesSocketApplication.java @@ -0,0 +1,162 @@ +/* + * Unless otherwise specified through the '@author' tag or comments at + * the top of the file or on a specific portion of the code the following license applies: + * + * Copyright (c) 2014, DoubleDoorDevelopment + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * The header specified or the above copyright notice, this list of conditions + * and the following disclaimer below must be displayed at the top of the source code + * of any web page received while using any part of the service this software provides. + * + * The header to be displayed: + * This page was generated by DoubleDoorDevelopment's D3Backend or a derivative thereof. + * + * Neither the name of the project nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +package net.doubledoordev.backend.web.socket; + +import com.google.common.base.Strings; +import com.google.gson.JsonObject; +import net.doubledoordev.backend.Main; +import net.doubledoordev.backend.permissions.User; +import net.doubledoordev.backend.server.Server; +import net.doubledoordev.backend.util.Settings; +import net.doubledoordev.backend.util.WebSocketHelper; +import net.doubledoordev.backend.util.methodCaller.WebSocketCaller; +import org.glassfish.grizzly.http.server.DefaultSessionManager; +import org.glassfish.grizzly.http.server.Session; +import org.glassfish.grizzly.websockets.DefaultWebSocket; +import org.glassfish.grizzly.websockets.WebSocket; +import org.glassfish.grizzly.websockets.WebSocketEngine; + +import java.io.IOException; + +import static net.doubledoordev.backend.util.Constants.SERVER; +import static net.doubledoordev.backend.util.Constants.SOCKET_CONTEXT; +import static net.doubledoordev.backend.util.Constants.USER; +import static net.doubledoordev.backend.util.Settings.SETTINGS; + +/** + * @author Dries007 + */ +public class ServerPropertiesSocketApplication extends KeepAliveWebSocketApplication +{ + private static final ServerPropertiesSocketApplication APPLICATION = new ServerPropertiesSocketApplication(); + private static final String URL_PATTERN = "/serverproperties/*"; + + private ServerPropertiesSocketApplication() + { + } + + @Override + public void onConnect(WebSocket socket) + { + Session session = DefaultSessionManager.instance().getSession(null, ((DefaultWebSocket) socket).getUpgradeRequest().getRequestedSessionId()); + if (session == null) + { + WebSocketHelper.sendError(socket, "No valid session."); + socket.close(); + return; + } + ((DefaultWebSocket) socket).getUpgradeRequest().setAttribute(USER, session.getAttribute(USER)); + + String serverName = ((DefaultWebSocket) socket).getUpgradeRequest().getPathInfo(); + if (Strings.isNullOrEmpty(serverName) || Strings.isNullOrEmpty(serverName.substring(1))) + { + WebSocketHelper.sendError(socket, "No valid server."); + socket.close(); + return; + } + Server server = Settings.getServerByName(serverName.substring(1)); + if (server == null) + { + WebSocketHelper.sendError(socket, "No valid server."); + socket.close(); + return; + } + else if (!server.canUserControl((User) session.getAttribute(USER))) + { + WebSocketHelper.sendError(socket, "You have no rights to this server."); + socket.close(); + return; + } + WebSocketHelper.sendData(socket, getData(server)); + ((DefaultWebSocket) socket).getUpgradeRequest().setAttribute(SERVER, server); + + // Add socket to the list of sockets + super.onConnect(socket); + } + + @Override + public void onMessage(WebSocket socket, String text) + { + Server server = (Server) ((DefaultWebSocket) socket).getUpgradeRequest().getAttribute(SERVER); + String[] split = text.split("=", 2); + try + { + server.setProperty(new WebSocketCaller(socket), split[0], split[1]); + } + catch (IOException e) + { + WebSocketHelper.sendError(socket, e); + } + sendUpdateToAll(server); + } + + public static void sendUpdateToAll(Server server) + { + APPLICATION.doSendUpdateToAll(server); + } + + private void doSendUpdateToAll(Server server) + { + for (WebSocket socket : getWebSockets()) + { + if (((DefaultWebSocket) socket).getUpgradeRequest().getAttribute(SERVER) != server) continue; + if (server.canUserControl((User) ((DefaultWebSocket) socket).getUpgradeRequest().getAttribute(USER))) WebSocketHelper.sendData(socket, getData(server)); + } + } + + public JsonObject getData(Server server) + { + JsonObject object = new JsonObject(); + + for (Object key : server.getProperties().keySet()) + { + object.addProperty(key.toString(), server.getProperty(key.toString())); + } + + return object; + } + + public static void register() + { + WebSocketEngine.getEngine().register(SOCKET_CONTEXT, URL_PATTERN, APPLICATION); + } +} diff --git a/src/main/resources/templates/editors/ace.ftl b/src/main/resources/templates/editors/ace.ftl index 8f5e114..761d57f 100644 --- a/src/main/resources/templates/editors/ace.ftl +++ b/src/main/resources/templates/editors/ace.ftl @@ -1,46 +1,48 @@ - +
+ - + -
${fm.getFileContentsAsString()}
+
${fm.getFileContentsAsString()}
- - + -<#if !readonly> - -<#else> -

File is readonly.

- \ No newline at end of file + function setMode(mode) { + editor.getSession().setMode("ace/mode/" + mode); + } + + <#if !readonly> + + <#else> +

File is readonly.

+ +
\ No newline at end of file diff --git a/src/main/resources/templates/editors/banned-ips.ftl b/src/main/resources/templates/editors/banned-ips.ftl index 4206657..a52c07c 100644 --- a/src/main/resources/templates/editors/banned-ips.ftl +++ b/src/main/resources/templates/editors/banned-ips.ftl @@ -1,127 +1,129 @@ -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- - - - - - - - - - - - - -
IPSourceReasonCreatedExpires
- -<#if !readonly> - -<#else> -

File is readonly.

- \ No newline at end of file + + <#if !readonly> + + <#else> +

File is readonly.

+ + \ No newline at end of file diff --git a/src/main/resources/templates/editors/banned-players.ftl b/src/main/resources/templates/editors/banned-players.ftl index 36764c8..ab8353c 100644 --- a/src/main/resources/templates/editors/banned-players.ftl +++ b/src/main/resources/templates/editors/banned-players.ftl @@ -1,149 +1,151 @@ -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
- - - - - - - - - - - - - - -
UsernameUUIDSourceReasonCreatedExpires
- -<#if !readonly> - -<#else> -

File is readonly.

- \ No newline at end of file + + <#if !readonly> + + <#else> +

File is readonly.

+ + \ No newline at end of file diff --git a/src/main/resources/templates/editors/img.ftl b/src/main/resources/templates/editors/img.ftl index 29f1002..e4d6157 100644 --- a/src/main/resources/templates/editors/img.ftl +++ b/src/main/resources/templates/editors/img.ftl @@ -1 +1,3 @@ - \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/src/main/resources/templates/editors/json.ftl b/src/main/resources/templates/editors/json.ftl index 78893db..e791d3a 100644 --- a/src/main/resources/templates/editors/json.ftl +++ b/src/main/resources/templates/editors/json.ftl @@ -1,43 +1,45 @@ - - - - +
+ + + + - - + + - - + + - -
-<#if !readonly> - -<#else> -

File is readonly.

- - \ No newline at end of file + if (json == null) { + alert("Data file might be currupt. It can't be read by our parser."); + document.getElementById("savebtn").disabled = true; + document.getElementById("jsoneditor").innerHTML = "Error. File corrupt?"; + } + else editor = new JSONEditor(container, options, json); + +
\ No newline at end of file diff --git a/src/main/resources/templates/editors/ops.ftl b/src/main/resources/templates/editors/ops.ftl index 1429350..6d242be 100644 --- a/src/main/resources/templates/editors/ops.ftl +++ b/src/main/resources/templates/editors/ops.ftl @@ -1,97 +1,99 @@ -
-
- - -
-
- - -
- -
- - - - - - - - - - - -
UsernameUUIDPerm lvl
- -<#if !readonly> - -<#else> -

File is readonly.

- \ No newline at end of file + + <#if !readonly> + + <#else> +

File is readonly.

+ + \ No newline at end of file diff --git a/src/main/resources/templates/editors/serverProperties.ftl b/src/main/resources/templates/editors/serverProperties.ftl new file mode 100644 index 0000000..ee28759 --- /dev/null +++ b/src/main/resources/templates/editors/serverProperties.ftl @@ -0,0 +1,60 @@ +
+ Click on any value to change it. Changes only apply once the server has been restarted!
+ Red values are read only. +
+ + + + + + + + + +
PropertyValue
+ \ No newline at end of file diff --git a/src/main/resources/templates/editors/whitelist.ftl b/src/main/resources/templates/editors/whitelist.ftl index 85c0236..8c225f3 100644 --- a/src/main/resources/templates/editors/whitelist.ftl +++ b/src/main/resources/templates/editors/whitelist.ftl @@ -1,69 +1,71 @@ -
-
- - -
- -
- - - - - - - - - - -
UsernameUUID
- -<#if !readonly> - -<#else> -

File is readonly.

- \ No newline at end of file + + <#if !readonly> + + <#else> +

File is readonly.

+ + \ No newline at end of file diff --git a/src/main/resources/templates/filemanager.ftl b/src/main/resources/templates/filemanager.ftl index 10fbedc..35a6eb4 100644 --- a/src/main/resources/templates/filemanager.ftl +++ b/src/main/resources/templates/filemanager.ftl @@ -22,38 +22,32 @@ <#list fm.file.listFiles() as file> - <#if file.getName() != "server.properties"> - - <#if fm.canEdit(file)> - - rel="tooltip" data-toggle="tooltip" data-placement="top" title="${Helper.getUsernameFromUUID(file.getName())}">${file.getName()} - - <#else> - ${file.getName()} - - - <#if !file.isDirectory()>Raw file - - -
- - - <#if !file.canWrite()> - - <#if fm.getExtension(file) == "jar" || fm.getExtension(file) == "zip"> - - <#elseif fm.getExtension(file) == "disabled"> - -
+ + <#if fm.canEdit(file)> + + rel="tooltip" data-toggle="tooltip" data-placement="top" title="${Helper.getUsernameFromUUID(file.getName())}">${file.getName()} <#else> - - ${file.getName()} - + ${file.getName()} + + <#if !file.isDirectory()>Raw file + + +
+ + + <#if !file.canWrite()> + + <#if fm.getExtension(file) == "jar" || fm.getExtension(file) == "zip"> + + <#elseif fm.getExtension(file) == "disabled"> + +
+ @@ -65,13 +59,13 @@
<#list fm.makeBreadcrumbs() as file> / rel="tooltip" data-toggle="tooltip" data-placement="top" title="${Helper.getUsernameFromUUID(file.getName())}">${file.getName()}
-
- <#if fm.getEditor()??> - <#include "editors/" + fm.getEditor()> - <#else> + <#if fm.getEditor()??> + <#include "editors/" + fm.getEditor()> + <#else> +

This kind of file can't be displayed.

- -
+
+ diff --git a/src/main/resources/templates/serverproperties.ftl b/src/main/resources/templates/serverproperties.ftl index e69de29..b39cf8b 100644 --- a/src/main/resources/templates/serverproperties.ftl +++ b/src/main/resources/templates/serverproperties.ftl @@ -0,0 +1,68 @@ +<#include "header.ftl"> +

${server.ID} + ${server.getDisplayAddress()} +

+
+
server.properties
+
+ Click on any value to change it. Changes only apply once the server has been restarted!
+ Red values are read only. +
+ + + + + + + + + +
PropertyValue
+
+ +<#include "footer.ftl">