mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] LaunchServer instance в ProtectHandler
This commit is contained in:
parent
d5bab20610
commit
2e238f3dc2
6 changed files with 11 additions and 7 deletions
|
@ -23,7 +23,6 @@ protected Entry fetchEntry(UUID uuid) {
|
|||
@Override
|
||||
protected boolean updateAuth(UUID uuid, String username, String accessToken) {
|
||||
User user = srv.config.dao.userDAO.findByUUID(uuid);
|
||||
LogHelper.debug("UpdateAuth: %s: %s", uuid == null ? "null" : uuid.toString(), user == null ? "null" : user.getUsername());
|
||||
user.setAccessToken(accessToken);
|
||||
srv.config.dao.userDAO.update(user);
|
||||
return true;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
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.LaunchServer;
|
||||
import pro.gravit.launchserver.Reconfigurable;
|
||||
import pro.gravit.launchserver.auth.protect.hwid.HWIDException;
|
||||
import pro.gravit.launchserver.auth.protect.hwid.HWIDProvider;
|
||||
|
@ -21,6 +22,7 @@
|
|||
public class AdvancedProtectHandler extends StdProtectHandler implements SecureProtectHandler, HardwareProtectHandler, JoinServerProtectHandler, Reconfigurable {
|
||||
public boolean enableHardwareFeature;
|
||||
public HWIDProvider provider;
|
||||
private LaunchServer server;
|
||||
|
||||
@Override
|
||||
public boolean allowGetAccessToken(AuthResponse.AuthContext context) {
|
||||
|
@ -107,9 +109,9 @@ public boolean onJoinServer(String serverID, String username, Client client) {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
public void init(LaunchServer server) {
|
||||
if(provider != null)
|
||||
provider.init();
|
||||
provider.init(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package pro.gravit.launchserver.auth.protect;
|
||||
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
||||
import pro.gravit.utils.ProviderMap;
|
||||
|
||||
|
@ -21,7 +22,7 @@ public static void registerHandlers() {
|
|||
|
||||
public abstract void checkLaunchServerLicense(); //Выдает SecurityException при ошибке проверки лицензии
|
||||
|
||||
public void init()
|
||||
public void init(LaunchServer server)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package pro.gravit.launchserver.auth.protect.hwid;
|
||||
|
||||
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;
|
||||
|
@ -107,7 +108,7 @@ protected void printHardwareInfo(LogHelper.Level logLevel, HardwareReportRequest
|
|||
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);
|
||||
}
|
||||
|
||||
public void init()
|
||||
public void init(LaunchServer server)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package pro.gravit.launchserver.auth.protect.hwid;
|
||||
|
||||
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;
|
||||
|
@ -29,7 +30,7 @@ public class MysqlHWIDProvider extends HWIDProvider {
|
|||
private String sqlUpdateUsers;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
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);
|
||||
sqlFindByHardware = String.format("SELECT hwDiskId, baseboardSerialNumber, displayId, bitness, totalMemory, logicalProcessors, physicalProcessors, processorMaxFreq, battery, id, banned FROM %s", tableHWID);
|
||||
sqlCreateHardware = String.format("INSERT INTO `%s` (`publickey`, `hwDiskId`, `baseboardSerialNumber`, `displayId`, `bitness`, `totalMemory`, `logicalProcessors`, `physicalProcessors`, `processorMaxFreq`, `battery`, `banned`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '0')", tableHWID);
|
||||
|
|
|
@ -184,7 +184,7 @@ public void init(LaunchServer.ReloadType type) {
|
|||
}
|
||||
if (protectHandler != null) {
|
||||
server.registerObject("protectHandler", protectHandler);
|
||||
protectHandler.init();
|
||||
protectHandler.init(server);
|
||||
protectHandler.checkLaunchServerLicense();
|
||||
}
|
||||
if (components != null) {
|
||||
|
|
Loading…
Reference in a new issue