[FEATURE] Гибкая настройка URL скачивания клиента

This commit is contained in:
Gravit 2019-04-21 04:56:56 +07:00
parent 4d6a456b8f
commit 21d698deb3
3 changed files with 6 additions and 3 deletions

View file

@ -242,11 +242,12 @@ public class LauncherConf
public class NettyConfig { public class NettyConfig {
public boolean clientEnabled; public boolean clientEnabled;
public boolean sendExcptionEnabled; public boolean sendExceptionEnabled;
public String launcherURL; public String launcherURL;
public String downloadURL; public String downloadURL;
public String launcherEXEURL; public String launcherEXEURL;
public String address; public String address;
public Map<String, String> bindings = new HashMap<>();
public NettyPerformanceConfig performance; public NettyPerformanceConfig performance;
public NettyBindAddress[] binds; public NettyBindAddress[] binds;
} }

View file

@ -70,7 +70,7 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
} catch (Exception e) { } catch (Exception e) {
LogHelper.error(e); LogHelper.error(e);
RequestEvent event; RequestEvent event;
if(server.config.netty.sendExcptionEnabled) if(server.config.netty.sendExceptionEnabled)
{ {
event = new ExceptionEvent(e); event = new ExceptionEvent(e);
} }

View file

@ -39,6 +39,8 @@ public void execute(ChannelHandlerContext ctx, Client client) {
service.sendObject(ctx, new ErrorRequestEvent(String.format("Directory %s not found", dirName))); service.sendObject(ctx, new ErrorRequestEvent(String.format("Directory %s not found", dirName)));
return; return;
} }
service.sendObject(ctx, new UpdateRequestEvent(dir.object, LaunchServer.server.config.netty.downloadURL.replace("%dirname%",dirName))); String url = LaunchServer.server.config.netty.downloadURL.replace("%dirname%",dirName);
if(server.config.netty.bindings.get(dirName) != null) url = server.config.netty.bindings.get(dirName);
service.sendObject(ctx, new UpdateRequestEvent(dir.object, url));
} }
} }