mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[REFACTOR] Switch to log4j 2
This commit is contained in:
parent
66db1eb861
commit
5d35c0823e
14 changed files with 69 additions and 58 deletions
|
@ -1,11 +1,12 @@
|
|||
package pro.gravit.launchserver.auth.protect.hwid;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.request.secure.HardwareReportRequest;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.helper.DamerauHelper;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.utils.ProviderMap;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
import pro.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -13,6 +14,7 @@
|
|||
public abstract class HWIDProvider {
|
||||
public static final ProviderMap<HWIDProvider> providers = new ProviderMap<>("HWIDProvider");
|
||||
private static boolean registredProv = false;
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
public static void registerProviders() {
|
||||
if (!registredProv) {
|
||||
|
@ -92,10 +94,10 @@ public HardwareInfoCompareResult compareHardwareInfo(HardwareReportRequest.Hardw
|
|||
return result;
|
||||
}
|
||||
|
||||
protected void printHardwareInfo(LogHelper.Level logLevel, HardwareReportRequest.HardwareInfo info) {
|
||||
LogHelper.log(logLevel, String.format("[HardwareInfo] Processor: logical %d | physical %d | freq %d | bitness %d", info.logicalProcessors, info.physicalProcessors, info.processorMaxFreq, info.bitness), false);
|
||||
LogHelper.log(logLevel, String.format("[HardwareInfo] Memory max: %d | battery %s", info.totalMemory, info.battery ? "true" : "false"), false);
|
||||
LogHelper.log(logLevel, String.format("[HardwareInfo] HWDiskID %s | baseboardSerialNumber %s | displayId hash: %s", info.hwDiskId, info.baseboardSerialNumber, SecurityHelper.toHex(SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, info.displayId))), false);
|
||||
protected void printHardwareInfo(HardwareReportRequest.HardwareInfo info) {
|
||||
logger.info("[HardwareInfo] Processor: logical {} | physical {} | freq {} | bitness {}", info.logicalProcessors, info.physicalProcessors, info.processorMaxFreq, info.bitness);
|
||||
logger.info("[HardwareInfo] Memory max: {} | battery {}", info.totalMemory, info.battery ? "true" : "false");
|
||||
logger.info("[HardwareInfo] HWDiskID {} | baseboardSerialNumber {} | displayId hash: {}", info.hwDiskId, info.baseboardSerialNumber, SecurityHelper.toHex(SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, info.displayId)));
|
||||
}
|
||||
|
||||
public void init(LaunchServer server) {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package pro.gravit.launchserver.auth.protect.hwid;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.request.secure.HardwareReportRequest;
|
||||
import pro.gravit.launchserver.Reconfigurable;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.utils.command.Command;
|
||||
import pro.gravit.utils.command.SubCommand;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
import pro.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -17,7 +18,8 @@
|
|||
public class MemoryHWIDProvider extends HWIDProvider implements Reconfigurable {
|
||||
public double warningSpoofingLevel = -1.0;
|
||||
public double criticalCompareLevel = 1.0;
|
||||
public Set<MemoryHWIDEntity> db = ConcurrentHashMap.newKeySet();
|
||||
public transient Set<MemoryHWIDEntity> db = ConcurrentHashMap.newKeySet();
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Override
|
||||
public Map<String, Command> getCommands() {
|
||||
|
@ -26,9 +28,9 @@ public Map<String, Command> getCommands() {
|
|||
@Override
|
||||
public void invoke(String... args) {
|
||||
for (MemoryHWIDEntity e : db) {
|
||||
printHardwareInfo(LogHelper.Level.INFO, e.hardware);
|
||||
LogHelper.info("ID %d banned %s", e.id, e.banned ? "true" : "false");
|
||||
LogHelper.info("PublicKey Hash: %s", SecurityHelper.toHex(SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA1, e.publicKey)));
|
||||
printHardwareInfo(e.hardware);
|
||||
logger.info("ID {} banned {}", e.id, e.banned ? "true" : "false");
|
||||
logger.info("PublicKey Hash: {}", SecurityHelper.toHex(SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA1, e.publicKey)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -40,7 +42,7 @@ public void invoke(String... args) throws Exception {
|
|||
for (MemoryHWIDEntity e : db) {
|
||||
if (e.id == id) {
|
||||
e.banned = true;
|
||||
LogHelper.info("HardwareID %d banned", e.id);
|
||||
logger.info("HardwareID {} banned", e.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,11 +72,11 @@ public boolean addPublicKeyToHardwareInfo(HardwareReportRequest.HardwareInfo har
|
|||
for (MemoryHWIDEntity e : db) {
|
||||
HardwareInfoCompareResult result = compareHardwareInfo(e.hardware, hardwareInfo);
|
||||
if (warningSpoofingLevel > 0 && result.firstSpoofingLevel > warningSpoofingLevel && !isAlreadyWarning) {
|
||||
LogHelper.warning("HardwareInfo spoofing level too high: %f", result.firstSpoofingLevel);
|
||||
logger.warn("HardwareInfo spoofing level too high: {}", result.firstSpoofingLevel);
|
||||
isAlreadyWarning = true;
|
||||
}
|
||||
if (result.compareLevel > criticalCompareLevel) {
|
||||
LogHelper.debug("HardwareInfo publicKey change: compareLevel %f", result.compareLevel);
|
||||
logger.debug("HardwareInfo publicKey change: compareLevel {}", result.compareLevel);
|
||||
if (e.banned) throw new HWIDException("You HWID banned");
|
||||
e.publicKey = publicKey;
|
||||
return true;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package pro.gravit.launchserver.auth.protect.hwid;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.request.secure.HardwareReportRequest;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -29,6 +30,8 @@ public class MysqlHWIDProvider extends HWIDProvider {
|
|||
private String sqlUpdateHardware;
|
||||
private String sqlUpdateUsers;
|
||||
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Override
|
||||
public void init(LaunchServer server) {
|
||||
sqlFindByPublicKey = String.format("SELECT hwDiskId, baseboardSerialNumber, displayId, bitness, totalMemory, logicalProcessors, physicalProcessors, processorMaxFreq, battery, id, banned FROM %s WHERE `publicKey` = ?", tableHWID);
|
||||
|
@ -39,7 +42,7 @@ public void init(LaunchServer server) {
|
|||
if (tableUsers != null && usersHWIDColumn != null && usersNameColumn != null) {
|
||||
sqlUpdateUsers = String.format("UPDATE %s SET `%s` = ? WHERE `%s` = ?", tableUsers, usersHWIDColumn, usersNameColumn);
|
||||
} else {
|
||||
LogHelper.warning("[MysqlHWIDProvider] Link to users table not configured");
|
||||
logger.warn("[MysqlHWIDProvider] Link to users table not configured");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +64,7 @@ public HardwareReportRequest.HardwareInfo findHardwareInfoByPublicKey(byte[] pub
|
|||
return null;
|
||||
}
|
||||
} catch (SQLException | IOException throwables) {
|
||||
LogHelper.error(throwables);
|
||||
logger.error(throwables);
|
||||
throw new HWIDException("SQL error. Please try again later");
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +106,7 @@ public void createHardwareInfo(HardwareReportRequest.HardwareInfo hardwareInfo,
|
|||
}
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
LogHelper.error(throwables);
|
||||
logger.error(throwables);
|
||||
throw new HWIDException("SQL error. Please try again later");
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +132,7 @@ public boolean addPublicKeyToHardwareInfo(HardwareReportRequest.HardwareInfo har
|
|||
}
|
||||
}
|
||||
} catch (SQLException | IOException throwables) {
|
||||
LogHelper.error(throwables);
|
||||
logger.error(throwables);
|
||||
throw new HWIDException("SQL error. Please try again later");
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import pro.gravit.launchserver.auth.AuthException;
|
||||
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
import pro.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
@ -25,9 +24,9 @@ public final class MySQLAuthProvider extends AuthProvider {
|
|||
@Override
|
||||
public void init(LaunchServer srv) {
|
||||
super.init(srv);
|
||||
if (query == null) LogHelper.error("[Verify][AuthProvider] query cannot be null");
|
||||
if (message == null) LogHelper.error("[Verify][AuthProvider] message cannot be null");
|
||||
if (mySQLHolder == null) LogHelper.error("[Verify][AuthProvider] mySQLHolder cannot be null");
|
||||
if (query == null) throw new RuntimeException("[Verify][AuthProvider] query cannot be null");
|
||||
if (message == null) throw new RuntimeException("[Verify][AuthProvider] message cannot be null");
|
||||
if (mySQLHolder == null) throw new RuntimeException("[Verify][AuthProvider] mySQLHolder cannot be null");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package pro.gravit.launchserver.auth.provider;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.ClientPermissions;
|
||||
import pro.gravit.launcher.request.auth.AuthRequest;
|
||||
import pro.gravit.launchserver.Reconfigurable;
|
||||
|
@ -17,6 +19,8 @@ public final class RejectAuthProvider extends AuthProvider implements Reconfigur
|
|||
public String message;
|
||||
public ArrayList<String> whitelist = new ArrayList<>();
|
||||
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
public RejectAuthProvider() {
|
||||
}
|
||||
|
||||
|
@ -49,7 +53,7 @@ public Map<String, Command> getCommands() {
|
|||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args, 1);
|
||||
message = args[0];
|
||||
LogHelper.info("New reject message: %s", message);
|
||||
logger.info("New reject message: {}", message);
|
||||
}
|
||||
});
|
||||
commands.put("whitelist.add", new SubCommand() {
|
||||
|
@ -57,7 +61,7 @@ public void invoke(String... args) throws Exception {
|
|||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args, 1);
|
||||
whitelist.add(args[0]);
|
||||
LogHelper.info("%s added to whitelist", args[0]);
|
||||
logger.info("{} added to whitelist", args[0]);
|
||||
}
|
||||
});
|
||||
return commands;
|
||||
|
|
|
@ -33,8 +33,8 @@ public final class RequestAuthProvider extends AuthProvider {
|
|||
@Override
|
||||
public void init(LaunchServer srv) {
|
||||
super.init(srv);
|
||||
if (url == null) LogHelper.error("[Verify][AuthProvider] url cannot be null");
|
||||
if (response == null) LogHelper.error("[Verify][AuthProvider] response cannot be null");
|
||||
if (url == null) throw new RuntimeException("[Verify][AuthProvider] url cannot be null");
|
||||
if (response == null) throw new RuntimeException("[Verify][AuthProvider] response cannot be null");
|
||||
pattern = Pattern.compile(response);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public Path process(Path inputFile) throws IOException {
|
|||
|
||||
private void attach(ZipOutputStream output, Path inputFile, List<Path> lst) throws IOException {
|
||||
for (Path p : lst) {
|
||||
LogHelper.debug("Attaching: " + p);
|
||||
AdditionalFixesApplyTask.apply(inputFile, p, output, srv, (e) -> exclusions.stream().anyMatch(e.getName()::startsWith), false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package pro.gravit.launchserver.binary.tasks;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.asn1.x500.X500NameBuilder;
|
||||
import org.bouncycastle.asn1.x500.style.BCStyle;
|
||||
|
@ -17,7 +19,6 @@
|
|||
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.helper.SignHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
|
@ -37,6 +38,8 @@ public class CertificateAutogenTask implements LauncherBuildTask {
|
|||
public X509CertificateHolder bcCertificate;
|
||||
public CMSSignedDataGenerator signedDataGenerator;
|
||||
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
public CertificateAutogenTask(LaunchServer server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
@ -50,9 +53,9 @@ public String getName() {
|
|||
public Path process(Path inputFile) throws IOException {
|
||||
if (signedDataGenerator != null) return inputFile;
|
||||
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.");
|
||||
logger.warn("You are using an auto-generated certificate (sign.enabled false). It is not good");
|
||||
logger.warn("It is highly recommended that you use the correct certificate (sign.enabled true)");
|
||||
logger.warn("You can use GenerateCertificateModule or your own certificate.");
|
||||
X500NameBuilder subject = new X500NameBuilder();
|
||||
subject.addRDN(BCStyle.CN, server.config.projectName.concat(" Autogenerated"));
|
||||
subject.addRDN(BCStyle.O, server.config.projectName);
|
||||
|
@ -63,11 +66,11 @@ public Path process(Path inputFile) throws IOException {
|
|||
Date.from(startDate.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(startDate.plusDays(3650).atZone(ZoneId.systemDefault()).toInstant()),
|
||||
new X500Name("CN=ca"),
|
||||
SubjectPublicKeyInfo.getInstance(server.publicKey.getEncoded()));
|
||||
SubjectPublicKeyInfo.getInstance(server.keyAgreementManager.ecdsaPublicKey.getEncoded()));
|
||||
builder.addExtension(Extension.extendedKeyUsage, false, new ExtendedKeyUsage(KeyPurposeId.id_kp_codeSigning));
|
||||
//builder.addExtension(Extension.keyUsage, false, new KeyUsage(1));
|
||||
JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder("SHA256WITHECDSA");
|
||||
ContentSigner signer = csBuilder.build(server.privateKey);
|
||||
ContentSigner signer = csBuilder.build(server.keyAgreementManager.ecdsaPrivateKey);
|
||||
bcCertificate = builder.build(signer);
|
||||
certificate = new JcaX509CertificateConverter().setProvider("BC")
|
||||
.getCertificate(bcCertificate);
|
||||
|
@ -75,7 +78,7 @@ public Path process(Path inputFile) throws IOException {
|
|||
chain.add(certificate);
|
||||
signedDataGenerator = SignHelper.createSignedDataGenerator(server.privateKey, certificate, chain, "SHA256WITHECDSA");
|
||||
} catch (OperatorCreationException | CMSException | CertificateException e) {
|
||||
LogHelper.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
return inputFile;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package pro.gravit.launchserver.binary.tasks;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Type;
|
||||
|
@ -34,6 +36,7 @@ public class MainBuildTask implements LauncherBuildTask {
|
|||
public final IOHookSet<BuildContext> postBuildHook = new IOHookSet<>();
|
||||
public final Map<String, Object> properties = new HashMap<>();
|
||||
private final LaunchServer server;
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
public MainBuildTask(LaunchServer srv) {
|
||||
server = srv;
|
||||
|
@ -58,13 +61,9 @@ public Path process(Path inputJar) throws IOException {
|
|||
properties.put("launcher.modules", context.clientModules.stream().map(e -> Type.getObjectType(e.replace('.', '/'))).collect(Collectors.toList()));
|
||||
postInitProps();
|
||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||
server.launcherBinary.coreLibs.forEach(e -> {
|
||||
try {
|
||||
for(Path e : server.launcherBinary.coreLibs) {
|
||||
reader.getCp().add(new JarFile(e.toFile()));
|
||||
} catch (IOException e1) {
|
||||
LogHelper.error(e1);
|
||||
}
|
||||
});
|
||||
};
|
||||
context.pushJarFile(inputJar, (e) -> blacklist.contains(e.getName()), (e) -> true);
|
||||
|
||||
// map for guard
|
||||
|
@ -86,7 +85,7 @@ protected void postInitProps() {
|
|||
try {
|
||||
return e.getEncoded();
|
||||
} catch (CertificateEncodingException e2) {
|
||||
LogHelper.error(e2);
|
||||
logger.error(e2);
|
||||
return new byte[0];
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package pro.gravit.launchserver.binary.tasks;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
import pro.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -16,6 +17,7 @@
|
|||
public class PrepareBuildTask implements LauncherBuildTask {
|
||||
private final LaunchServer server;
|
||||
private final Path result;
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
public PrepareBuildTask(LaunchServer server) {
|
||||
this.server = server;
|
||||
|
@ -44,7 +46,7 @@ public boolean allowDelete() {
|
|||
}
|
||||
|
||||
public void tryUnpack() throws IOException {
|
||||
LogHelper.info("Unpacking launcher native guard list and runtime");
|
||||
logger.info("Unpacking launcher native guard list and runtime");
|
||||
UnpackHelper.unpackZipNoCheck("guard.zip", server.launcherBinary.guardDir);
|
||||
UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package pro.gravit.launchserver.binary.tasks;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bouncycastle.cms.CMSException;
|
||||
import org.bouncycastle.cms.CMSSignedDataGenerator;
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
|
@ -8,7 +10,6 @@
|
|||
import pro.gravit.launchserver.config.LaunchServerConfig;
|
||||
import pro.gravit.launchserver.helper.SignHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -27,6 +28,7 @@ public class SignJarTask implements LauncherBuildTask {
|
|||
|
||||
private final LaunchServerConfig.JarSignerConf config;
|
||||
private final LaunchServer srv;
|
||||
private transient static final Logger logger = LogManager.getLogger();
|
||||
|
||||
public SignJarTask(LaunchServerConfig.JarSignerConf config, LaunchServer srv) {
|
||||
this.config = config;
|
||||
|
@ -39,7 +41,7 @@ public static CMSSignedDataGenerator gen(LaunchServerConfig.JarSignerConf config
|
|||
config.keyAlias, config.signAlgo, config.keyPass);
|
||||
} catch (CertificateEncodingException | UnrecoverableKeyException | KeyStoreException
|
||||
| OperatorCreationException | NoSuchAlgorithmException | CMSException e) {
|
||||
LogHelper.error(e);
|
||||
logger.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
import net.sf.launch4j.Builder;
|
||||
import net.sf.launch4j.Log;
|
||||
import net.sf.launch4j.config.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.binary.tasks.LauncherBuildTask;
|
||||
import pro.gravit.utils.Version;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
@ -18,6 +19,7 @@ public class Launch4JTask implements LauncherBuildTask, BuildExeMainTask {
|
|||
private static final int BUILD = Version.getVersion().build;
|
||||
private final Path faviconFile;
|
||||
private final LaunchServer server;
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
|
||||
public Launch4JTask(LaunchServer launchServer) {
|
||||
this.server = launchServer;
|
||||
|
@ -35,7 +37,7 @@ public String getName() {
|
|||
|
||||
@Override
|
||||
public Path process(Path inputFile) throws IOException {
|
||||
LogHelper.info("Building launcher EXE binary file (Using Launch4J)");
|
||||
logger.info("Building launcher EXE binary file (Using Launch4J)");
|
||||
Path output = setConfig();
|
||||
|
||||
// Set favicon path
|
||||
|
@ -44,7 +46,7 @@ public Path process(Path inputFile) throws IOException {
|
|||
config.setIcon(faviconFile.toFile());
|
||||
else {
|
||||
config.setIcon(null);
|
||||
LogHelper.warning("Missing favicon.ico file");
|
||||
logger.warn("Missing favicon.ico file");
|
||||
}
|
||||
|
||||
// Start building
|
||||
|
@ -114,10 +116,11 @@ private Path setConfig() {
|
|||
|
||||
private final static class Launch4JLog extends Log {
|
||||
private static final Launch4JLog INSTANCE = new Launch4JLog();
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Override
|
||||
public void append(String s) {
|
||||
LogHelper.subInfo(s);
|
||||
logger.info(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
import io.netty.handler.codec.http.HttpRequest;
|
||||
import io.netty.util.ReferenceCounted;
|
||||
import pro.gravit.launchserver.socket.NettyConnectContext;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -36,11 +35,8 @@ protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> o
|
|||
realIP = headers.get("X-Real-IP");
|
||||
}
|
||||
if (realIP != null) {
|
||||
if (LogHelper.isDevEnabled()) {
|
||||
LogHelper.dev("Real IP address %s", realIP);
|
||||
}
|
||||
context.ip = realIP;
|
||||
} else LogHelper.error("IpForwarding error. Headers not found");
|
||||
}
|
||||
out.add(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
@ -23,7 +22,6 @@ public static PlayerProfile getProfile(UUID uuid, String username, String client
|
|||
try {
|
||||
skin = textureProvider.getSkinTexture(uuid, username, client);
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(new IOException(String.format("Can't get skin texture: '%s'", username), e));
|
||||
skin = null;
|
||||
}
|
||||
|
||||
|
@ -32,7 +30,6 @@ public static PlayerProfile getProfile(UUID uuid, String username, String client
|
|||
try {
|
||||
cloak = textureProvider.getCloakTexture(uuid, username, client);
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(new IOException(String.format("Can't get cloak texture: '%s'", username), e));
|
||||
cloak = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue