mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
LauncherAPI/ServerWrapper модуль
This commit is contained in:
parent
c856d351f1
commit
f83afcd8e1
24 changed files with 57 additions and 22 deletions
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':libLauncher')
|
||||
compile project(':LauncherAPI')
|
||||
compile 'org.javassist:javassist:3.23.1-GA'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.5'
|
||||
compileOnly 'com.google.guava:guava:26.0-jre'
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
import ru.gravit.launcher.request.update.LauncherRequest;
|
||||
import ru.gravit.launcher.serialize.HInput;
|
||||
import ru.gravit.launcher.serialize.HOutput;
|
||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||
|
||||
|
@ -93,7 +92,7 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
|
|||
boolean autoEnter, boolean fullScreen, int ram, int width, int height) {
|
||||
this.launcherSign = launcherSign.clone();
|
||||
this.updateOptional = new HashSet<>();
|
||||
for(ClientProfile.MarkedString s : ClientLauncher.profile.getOptional())
|
||||
for(ClientProfile.MarkedString s : Launcher.profile.getOptional())
|
||||
{
|
||||
if(s.mark) updateOptional.add(s);
|
||||
}
|
||||
|
@ -173,8 +172,6 @@ public void write(HOutput output) throws IOException {
|
|||
@LauncherAPI
|
||||
public static final String SKIN_URL_PROPERTY = "skinURL";
|
||||
@LauncherAPI
|
||||
public static ClientProfile profile;
|
||||
@LauncherAPI
|
||||
public static final String SKIN_DIGEST_PROPERTY = "skinDigest";
|
||||
|
||||
@LauncherAPI
|
||||
|
@ -443,7 +440,7 @@ public static void main(String... args) throws Throwable {
|
|||
Files.delete(paramsFile);
|
||||
}
|
||||
}
|
||||
ClientLauncher.profile = profile.object;
|
||||
Launcher.profile = profile.object;
|
||||
Launcher.modulesManager.initModules();
|
||||
// Verify ClientLauncher sign and classpath
|
||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||
|
@ -466,7 +463,7 @@ public static void main(String... args) throws Throwable {
|
|||
// Verify current state of all dirs
|
||||
//verifyHDir(IOHelper.JVM_DIR, jvmHDir.object, null, digest);
|
||||
HashedDir hdir = clientHDir.object;
|
||||
for(ClientProfile.MarkedString s : ClientLauncher.profile.getOptional())
|
||||
for(ClientProfile.MarkedString s : Launcher.profile.getOptional())
|
||||
{
|
||||
if(params.updateOptional.contains(s)) s.mark = true;
|
||||
else hdir.removeR(s.string);
|
||||
|
@ -509,7 +506,7 @@ private static LinkedList<Path> resolveClassPathList(Path clientDir, String... c
|
|||
|
||||
@LauncherAPI
|
||||
public static void setProfile(ClientProfile profile) {
|
||||
ClientLauncher.profile = profile;
|
||||
Launcher.profile = profile;
|
||||
LogHelper.debug("New Profile name: %s", profile.getTitle());
|
||||
}
|
||||
|
||||
|
|
6
LauncherAPI/build.gradle
Normal file
6
LauncherAPI/build.gradle
Normal file
|
@ -0,0 +1,6 @@
|
|||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
dependencies {
|
||||
compile project(':libLauncher')
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.utils.helper.JVMHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
import ru.gravit.utils.helper.VerifyHelper;
|
||||
|
@ -67,7 +67,7 @@ public Integer getType() {
|
|||
@Override
|
||||
protected Result requestDo(HInput input, HOutput output) throws IOException {
|
||||
output.writeString(login, SerializeLimits.MAX_LOGIN);
|
||||
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.writeInt(auth_id);
|
||||
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetHddId() : 0);
|
||||
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetCpuid() : 0);
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.VerifyHelper;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
|
@ -39,12 +39,12 @@ public Integer getType() {
|
|||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
||||
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
|
||||
if(ClientLauncher.profile == null) {
|
||||
if(Launcher.profile == null) {
|
||||
LogHelper.error("Profile is null. Title is not net.");
|
||||
output.writeString("", SerializeLimits.MAX_CLIENT);
|
||||
}
|
||||
else
|
||||
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.flush();
|
||||
|
||||
// Read response
|
|
@ -16,9 +16,9 @@
|
|||
import java.util.Queue;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||
import ru.gravit.launcher.hasher.HashedDir;
|
||||
import ru.gravit.launcher.hasher.HashedEntry;
|
||||
|
@ -307,7 +307,7 @@ protected SignedObjectHolder<HashedDir> requestDo(HInput input, HOutput output)
|
|||
// Get diff between local and remote dir
|
||||
SignedObjectHolder<HashedDir> remoteHDirHolder = new SignedObjectHolder<>(input, config.publicKey, HashedDir::new);
|
||||
HashedDir hackHackedDir = remoteHDirHolder.object;
|
||||
ClientLauncher.profile.pushOptional(hackHackedDir,!ClientLauncher.profile.isUpdateFastCheck());
|
||||
Launcher.profile.pushOptional(hackHackedDir,!Launcher.profile.isUpdateFastCheck());
|
||||
HashedDir.Diff diff = hackHackedDir.diff(localDir, matcher);
|
||||
totalSize = diff.mismatch.size();
|
||||
boolean compress = input.readBoolean();
|
|
@ -4,9 +4,9 @@
|
|||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.Request;
|
||||
import ru.gravit.launcher.request.RequestType;
|
||||
|
@ -36,7 +36,7 @@ public Integer getType() {
|
|||
@Override
|
||||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||
output.writeUUID(uuid);
|
||||
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.flush();
|
||||
|
||||
// Return profile
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.utils.helper.VerifyHelper;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.request.Request;
|
||||
|
@ -35,7 +35,7 @@ public Integer getType() {
|
|||
@Override
|
||||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
||||
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||
output.flush();
|
||||
// Return profile
|
||||
return input.readBoolean() ? new PlayerProfile(input) : null;
|
28
ServerWrapper/build.gradle
Normal file
28
ServerWrapper/build.gradle
Normal file
|
@ -0,0 +1,28 @@
|
|||
String mainClassName = "ru.gravit.launcher.server.ServerWrapper"
|
||||
String mainAgentName = "ru.gravit.launcher.server.ServerAgent"
|
||||
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "http://repo.spring.io/plugins-release/"
|
||||
}
|
||||
}
|
||||
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
jar {
|
||||
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
manifest.attributes("Main-Class": mainClassName,
|
||||
"Premain-Class": mainAgentName,
|
||||
"Can-Redefine-Classes": "true",
|
||||
"Can-Retransform-Classes": "true",
|
||||
"Can-Set-Native-Method-Prefix": "true")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':LauncherAPI')
|
||||
compile 'org.javassist:javassist:3.23.1-GA'
|
||||
compileOnly 'com.google.code.gson:gson:2.8.5'
|
||||
compileOnly 'com.google.guava:guava:26.0-jre'
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncher;
|
||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
||||
|
@ -47,8 +46,8 @@ public static void main(String[] args) throws Throwable {
|
|||
LogHelper.debug("Get profile: %s", p.object.getTitle());
|
||||
if (p.object.getTitle().equals(config.title)) {
|
||||
wrapper.profile = p.object;
|
||||
ClientLauncher.setProfile(p.object);
|
||||
LogHelper.debug("Found profile: %s", ClientLauncher.profile.getTitle());
|
||||
Launcher.profile = p.object;
|
||||
LogHelper.debug("Found profile: %s", Launcher.profile.getTitle());
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.utils.Version;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
|
@ -39,6 +40,8 @@ static int readBuildNumber() {
|
|||
@LauncherAPI
|
||||
public static final String CONFIG_FILE = "config.bin";
|
||||
@LauncherAPI
|
||||
public static ClientProfile profile;
|
||||
@LauncherAPI
|
||||
public static final String INIT_SCRIPT_FILE = "init.js";
|
||||
@LauncherAPI
|
||||
public static final String API_SCRIPT_FILE = "engine/api.js";
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
include 'Launcher'
|
||||
include 'libLauncher'
|
||||
include 'LauncherAPI'
|
||||
include 'ServerWrapper'
|
||||
include 'LaunchServer'
|
||||
include 'modules'
|
||||
file('modules').eachDir { sub ->
|
||||
|
|
Loading…
Reference in a new issue