mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
Merge branch 'release/5.1.5'
This commit is contained in:
commit
98f1e30e61
17 changed files with 110 additions and 15 deletions
6
.github/workflows/push.yml
vendored
6
.github/workflows/push.yml
vendored
|
@ -42,9 +42,9 @@ jobs:
|
||||||
cd ../../../LauncherAuthlib/build/libs
|
cd ../../../LauncherAuthlib/build/libs
|
||||||
cp LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar
|
cp LauncherAuthlib.jar ../../../artifacts/LauncherAuthlib.jar
|
||||||
cd ../../../
|
cd ../../../
|
||||||
cp modules/*_module/build/libs/*.jar artifacts/modules
|
cp modules/*_module/build/libs/*.jar artifacts/modules || true
|
||||||
cp modules/*_swmodule/build/libs/*.jar artifacts/modules
|
cp modules/*_swmodule/build/libs/*.jar artifacts/modules || true
|
||||||
cp modules/*_lmodule/build/libs/*.jar artifacts/modules
|
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
package pro.gravit.launchserver.auth.protect;
|
package pro.gravit.launchserver.auth.protect;
|
||||||
|
|
||||||
import pro.gravit.launcher.events.request.GetSecureLevelInfoRequestEvent;
|
import pro.gravit.launcher.events.request.GetSecureLevelInfoRequestEvent;
|
||||||
|
import pro.gravit.launcher.events.request.HardwareReportRequestEvent;
|
||||||
|
import pro.gravit.launcher.events.request.VerifySecureLevelKeyRequestEvent;
|
||||||
|
import pro.gravit.launchserver.auth.protect.interfaces.HardwareProtectHandler;
|
||||||
import pro.gravit.launchserver.auth.protect.interfaces.SecureProtectHandler;
|
import pro.gravit.launchserver.auth.protect.interfaces.SecureProtectHandler;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
||||||
|
import pro.gravit.launchserver.socket.response.secure.HardwareReportResponse;
|
||||||
|
|
||||||
public class AdvancedProtectHandler extends ProtectHandler implements SecureProtectHandler {
|
public class AdvancedProtectHandler extends StdProtectHandler implements SecureProtectHandler, HardwareProtectHandler {
|
||||||
|
public boolean enableHardwareFeature;
|
||||||
@Override
|
@Override
|
||||||
public boolean allowGetAccessToken(AuthResponse.AuthContext context) {
|
public boolean allowGetAccessToken(AuthResponse.AuthContext context) {
|
||||||
return (context.authType == AuthResponse.ConnectTypes.CLIENT) && context.client.checkSign;
|
return (context.authType == AuthResponse.ConnectTypes.CLIENT) && context.client.checkSign;
|
||||||
|
@ -26,4 +30,24 @@ public GetSecureLevelInfoRequestEvent onGetSecureLevelInfo(GetSecureLevelInfoReq
|
||||||
public boolean allowGetSecureLevelInfo(Client client) {
|
public boolean allowGetSecureLevelInfo(Client client) {
|
||||||
return client.checkSign;
|
return client.checkSign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHardwareReport(HardwareReportResponse response, Client client) {
|
||||||
|
if(!enableHardwareFeature)
|
||||||
|
{
|
||||||
|
response.sendResult(new HardwareReportRequestEvent());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
response.sendResult(new HardwareReportRequestEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VerifySecureLevelKeyRequestEvent onSuccessVerify(Client client) {
|
||||||
|
if(enableHardwareFeature)
|
||||||
|
{
|
||||||
|
return new VerifySecureLevelKeyRequestEvent(true);
|
||||||
|
}
|
||||||
|
return new VerifySecureLevelKeyRequestEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package pro.gravit.launchserver.auth.protect.interfaces;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
|
import pro.gravit.launchserver.socket.response.secure.HardwareReportResponse;
|
||||||
|
|
||||||
|
public interface HardwareProtectHandler {
|
||||||
|
void onHardwareReport(HardwareReportResponse response, Client client);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import pro.gravit.launcher.events.request.GetSecureLevelInfoRequestEvent;
|
import pro.gravit.launcher.events.request.GetSecureLevelInfoRequestEvent;
|
||||||
import pro.gravit.launcher.events.request.SecurityReportRequestEvent;
|
import pro.gravit.launcher.events.request.SecurityReportRequestEvent;
|
||||||
|
import pro.gravit.launcher.events.request.VerifySecureLevelKeyRequestEvent;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.response.secure.SecurityReportResponse;
|
import pro.gravit.launchserver.socket.response.secure.SecurityReportResponse;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
@ -31,4 +32,8 @@ default void verifySecureLevelKey(byte[] publicKey, byte[] data, byte[] signatur
|
||||||
default SecurityReportRequestEvent onSecurityReport(SecurityReportResponse report, Client client) {
|
default SecurityReportRequestEvent onSecurityReport(SecurityReportResponse report, Client client) {
|
||||||
return new SecurityReportRequestEvent();
|
return new SecurityReportRequestEvent();
|
||||||
}
|
}
|
||||||
|
default VerifySecureLevelKeyRequestEvent onSuccessVerify(Client client)
|
||||||
|
{
|
||||||
|
return new VerifySecureLevelKeyRequestEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ public String getName() {
|
||||||
public Path process(Path inputFile) throws IOException {
|
public Path process(Path inputFile) throws IOException {
|
||||||
if (signedDataGenerator != null) return inputFile;
|
if (signedDataGenerator != null) return inputFile;
|
||||||
try {
|
try {
|
||||||
|
LogHelper.warning("You are using an auto-generated certificate (sign.enabled false). It is not good");
|
||||||
|
LogHelper.warning("It is highly recommended that you use the correct certificate (sign.enabled true)");
|
||||||
|
LogHelper.warning("You can use GenerateCertificateModule or your own certificate.");
|
||||||
X500NameBuilder subject = new X500NameBuilder();
|
X500NameBuilder subject = new X500NameBuilder();
|
||||||
subject.addRDN(BCStyle.CN, server.config.projectName.concat(" Autogenerated"));
|
subject.addRDN(BCStyle.CN, server.config.projectName.concat(" Autogenerated"));
|
||||||
subject.addRDN(BCStyle.O, server.config.projectName);
|
subject.addRDN(BCStyle.O, server.config.projectName);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import proguard.Configuration;
|
import proguard.Configuration;
|
||||||
import proguard.ConfigurationParser;
|
import proguard.ConfigurationParser;
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class ProGuardBuildTask implements LauncherBuildTask {
|
public class ProGuardBuildTask implements LauncherBuildTask {
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
|
@ -30,6 +32,21 @@ public Path process(Path inputFile) throws IOException {
|
||||||
Configuration proguard_cfg = new Configuration();
|
Configuration proguard_cfg = new Configuration();
|
||||||
ConfigurationParser parser = new ConfigurationParser(server.proguardConf.buildConfig(inputFile, outputJar),
|
ConfigurationParser parser = new ConfigurationParser(server.proguardConf.buildConfig(inputFile, outputJar),
|
||||||
server.proguardConf.proguard.toFile(), System.getProperties());
|
server.proguardConf.proguard.toFile(), System.getProperties());
|
||||||
|
if (JVMHelper.JVM_VERSION >= 9)
|
||||||
|
{
|
||||||
|
Path javaJModsPath = Paths.get(System.getProperty("java.home")).resolve("jmods");
|
||||||
|
if(!IOHelper.exists(javaJModsPath))
|
||||||
|
{
|
||||||
|
LogHelper.warning("Directory %s not found. It is not good", javaJModsPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Find javaFX libraries
|
||||||
|
if(!IOHelper.exists(javaJModsPath.resolve("javafx.base.jmod"))) LogHelper.warning("javafx.base.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
|
||||||
|
if(!IOHelper.exists(javaJModsPath.resolve("javafx.graphics.jmod"))) LogHelper.warning("javafx.graphics.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
|
||||||
|
if(!IOHelper.exists(javaJModsPath.resolve("javafx.controls.jmod"))) LogHelper.warning("javafx.controls.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
parser.parse(proguard_cfg);
|
parser.parse(proguard_cfg);
|
||||||
ProGuard proGuard = new ProGuard(proguard_cfg);
|
ProGuard proGuard = new ProGuard(proguard_cfg);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public LaunchServerModulesManager(Path modulesDir, Path configDir, LauncherTrust
|
||||||
super(modulesDir, configDir, trustManager);
|
super(modulesDir, configDir, trustManager);
|
||||||
coreModule = new LaunchServerCoreModule();
|
coreModule = new LaunchServerCoreModule();
|
||||||
checkMode = LauncherTrustManager.CheckMode.NONE_IN_NOT_SIGNED;
|
checkMode = LauncherTrustManager.CheckMode.NONE_IN_NOT_SIGNED;
|
||||||
modules.add(coreModule);
|
loadModule(coreModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fullInitializedLaunchServer(LaunchServer server) {
|
public void fullInitializedLaunchServer(LaunchServer server) {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.NettyConnectContext;
|
import pro.gravit.launchserver.socket.NettyConnectContext;
|
||||||
import pro.gravit.launchserver.socket.WebSocketService;
|
import pro.gravit.launchserver.socket.WebSocketService;
|
||||||
|
import pro.gravit.utils.BiHookSet;
|
||||||
|
import pro.gravit.utils.HookSet;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
@ -22,6 +24,7 @@ public class WebSocketFrameHandler extends SimpleChannelInboundHandler<WebSocket
|
||||||
public final WebSocketService service;
|
public final WebSocketService service;
|
||||||
private final UUID connectUUID = UUID.randomUUID();
|
private final UUID connectUUID = UUID.randomUUID();
|
||||||
public NettyConnectContext context;
|
public NettyConnectContext context;
|
||||||
|
public BiHookSet<ChannelHandlerContext, WebSocketFrame> hooks = new BiHookSet<>();
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
public WebSocketFrameHandler(NettyConnectContext context, LaunchServer srv, WebSocketService service) {
|
public WebSocketFrameHandler(NettyConnectContext context, LaunchServer srv, WebSocketService service) {
|
||||||
|
@ -58,6 +61,7 @@ public void channelActive(ChannelHandlerContext ctx) {
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame frame) {
|
protected void channelRead0(ChannelHandlerContext ctx, WebSocketFrame frame) {
|
||||||
// ping and pong frames already handled
|
// ping and pong frames already handled
|
||||||
|
if(hooks.hook(ctx, frame)) return;
|
||||||
if (frame instanceof TextWebSocketFrame) {
|
if (frame instanceof TextWebSocketFrame) {
|
||||||
service.process(ctx, (TextWebSocketFrame) frame, client, context.ip);
|
service.process(ctx, (TextWebSocketFrame) frame, client, context.ip);
|
||||||
} else if ((frame instanceof PingWebSocketFrame)) {
|
} else if ((frame instanceof PingWebSocketFrame)) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package pro.gravit.launchserver.socket.response.secure;
|
package pro.gravit.launchserver.socket.response.secure;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import pro.gravit.launcher.events.request.HardwareReportRequestEvent;
|
||||||
import pro.gravit.launcher.request.secure.HardwareReportRequest;
|
import pro.gravit.launcher.request.secure.HardwareReportRequest;
|
||||||
|
import pro.gravit.launchserver.auth.protect.interfaces.HardwareProtectHandler;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||||
|
|
||||||
|
@ -15,6 +17,13 @@ public String getType() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
|
if(server.config.protectHandler instanceof HardwareProtectHandler)
|
||||||
|
{
|
||||||
|
((HardwareProtectHandler) server.config.protectHandler).onHardwareReport(this, client);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sendResult(new HardwareReportRequestEvent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,6 @@ public void execute(ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
}
|
}
|
||||||
client.trustLevel.keyChecked = true;
|
client.trustLevel.keyChecked = true;
|
||||||
client.trustLevel.publicKey = publicKey;
|
client.trustLevel.publicKey = publicKey;
|
||||||
sendResult(new VerifySecureLevelKeyRequestEvent());
|
sendResult(secureProtectHandler.onSuccessVerify(client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package pro.gravit.launcher;
|
package pro.gravit.launcher;
|
||||||
|
|
||||||
import pro.gravit.launcher.client.ClientLauncherEntryPoint;
|
import pro.gravit.launcher.client.*;
|
||||||
import pro.gravit.launcher.client.ClientLauncherProcess;
|
|
||||||
import pro.gravit.launcher.client.ClientModuleManager;
|
|
||||||
import pro.gravit.launcher.client.DirBridge;
|
|
||||||
import pro.gravit.launcher.client.events.ClientEngineInitPhase;
|
import pro.gravit.launcher.client.events.ClientEngineInitPhase;
|
||||||
import pro.gravit.launcher.client.events.ClientExitPhase;
|
import pro.gravit.launcher.client.events.ClientExitPhase;
|
||||||
import pro.gravit.launcher.client.events.ClientPreGuiPhase;
|
import pro.gravit.launcher.client.events.ClientPreGuiPhase;
|
||||||
|
@ -93,6 +90,7 @@ public static void main(String... args) throws Throwable {
|
||||||
LauncherEngine.checkClass(LauncherAgent.class);
|
LauncherEngine.checkClass(LauncherAgent.class);
|
||||||
LauncherEngine.checkClass(ClientLauncherEntryPoint.class);
|
LauncherEngine.checkClass(ClientLauncherEntryPoint.class);
|
||||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||||
|
LauncherEngine.modulesManager.loadModule(new ClientLauncherCoreModule());
|
||||||
LauncherConfig.initModules(LauncherEngine.modulesManager);
|
LauncherConfig.initModules(LauncherEngine.modulesManager);
|
||||||
LauncherEngine.modulesManager.initModules(null);
|
LauncherEngine.modulesManager.initModules(null);
|
||||||
// Start Launcher
|
// Start Launcher
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package pro.gravit.launcher.client;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.modules.LauncherInitContext;
|
||||||
|
import pro.gravit.launcher.modules.LauncherModule;
|
||||||
|
import pro.gravit.launcher.modules.LauncherModuleInfo;
|
||||||
|
import pro.gravit.utils.Version;
|
||||||
|
|
||||||
|
public class ClientLauncherCoreModule extends LauncherModule {
|
||||||
|
public ClientLauncherCoreModule() {
|
||||||
|
super(new LauncherModuleInfo("ClientLauncherCore", Version.getVersion()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(LauncherInitContext initContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,6 +67,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
LauncherEngine.checkClass(LauncherAgent.class);
|
LauncherEngine.checkClass(LauncherAgent.class);
|
||||||
LauncherEngine.checkClass(ClientLauncherEntryPoint.class);
|
LauncherEngine.checkClass(ClientLauncherEntryPoint.class);
|
||||||
LauncherEngine.modulesManager = new ClientModuleManager();
|
LauncherEngine.modulesManager = new ClientModuleManager();
|
||||||
|
LauncherEngine.modulesManager.loadModule(new ClientLauncherCoreModule());
|
||||||
LauncherConfig.initModules(LauncherEngine.modulesManager); //INIT
|
LauncherConfig.initModules(LauncherEngine.modulesManager); //INIT
|
||||||
LauncherEngine.modulesManager.initModules(null);
|
LauncherEngine.modulesManager.initModules(null);
|
||||||
initGson(LauncherEngine.modulesManager);
|
initGson(LauncherEngine.modulesManager);
|
||||||
|
|
|
@ -3,6 +3,15 @@
|
||||||
import pro.gravit.launcher.events.RequestEvent;
|
import pro.gravit.launcher.events.RequestEvent;
|
||||||
|
|
||||||
public class VerifySecureLevelKeyRequestEvent extends RequestEvent {
|
public class VerifySecureLevelKeyRequestEvent extends RequestEvent {
|
||||||
|
public boolean needHardwareInfo;
|
||||||
|
|
||||||
|
public VerifySecureLevelKeyRequestEvent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public VerifySecureLevelKeyRequestEvent(boolean needHardwareInfo) {
|
||||||
|
this.needHardwareInfo = needHardwareInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return "verifySecureLevelKey";
|
return "verifySecureLevelKey";
|
||||||
|
|
|
@ -6,7 +6,7 @@ public final class Version {
|
||||||
|
|
||||||
public static final int MAJOR = 5;
|
public static final int MAJOR = 5;
|
||||||
public static final int MINOR = 1;
|
public static final int MINOR = 1;
|
||||||
public static final int PATCH = 4;
|
public static final int PATCH = 5;
|
||||||
public static final int BUILD = 1;
|
public static final int BUILD = 1;
|
||||||
public static final Version.Type RELEASE = Type.STABLE;
|
public static final Version.Type RELEASE = Type.STABLE;
|
||||||
public final int major;
|
public final int major;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
||||||
}
|
}
|
||||||
group = 'pro.gravit.launcher'
|
group = 'pro.gravit.launcher'
|
||||||
version = '5.1.4'
|
version = '5.1.5'
|
||||||
|
|
||||||
apply from: 'props.gradle'
|
apply from: 'props.gradle'
|
||||||
|
|
||||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit b3e50712f6a01f6ea4f0d7772371f9c01c309438
|
Subproject commit 04984c3c75c484671e5b286527403ab55da28a01
|
Loading…
Reference in a new issue