diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 80ad1675..dae1f39b 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -254,6 +254,7 @@ public static class NettyConfig { public boolean fileServerEnabled; public boolean sendExceptionEnabled; public boolean ipForwarding; + public boolean showHiddenFiles; public String launcherURL; public String downloadURL; public String launcherEXEURL; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java index b1ab80b7..e95fa544 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java @@ -63,7 +63,7 @@ public void initChannel(SocketChannel ch) { pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true)); if (server.config.netty.fileServerEnabled) - pipeline.addLast(new FileServerHandler(server.updatesDir, true)); + pipeline.addLast(new FileServerHandler(server.updatesDir, true, config.showHiddenFiles)); pipeline.addLast(new WebSocketFrameHandler(context, server, service)); pipelineHook.hook(context, ch); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java index b6deb6e3..ff3e6b19 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java @@ -58,10 +58,12 @@ public class FileServerHandler extends SimpleChannelInboundHandler&\\\"]*"); - private static void sendListing(ChannelHandlerContext ctx, File dir, String dirPath) { + private static void sendListing(ChannelHandlerContext ctx, File dir, String dirPath, boolean showHidden) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK); response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/html; charset=UTF-8"); @@ -201,7 +203,7 @@ private static void sendListing(ChannelHandlerContext ctx, File dir, String dirP .append("
  • ..
  • \r\n"); for (File f : dir.listFiles()) { - if (f.isHidden() || !f.canRead()) { + if (( f.isHidden() && !showHidden) || !f.canRead()) { continue; }