From c9ccf362527adac329ad0d7d4a0cfb028688f29a Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Tue, 23 Jan 2024 19:34:53 +0700 Subject: [PATCH] [ANY] Remove reg limiter --- .../launchserver/components/Component.java | 1 - .../components/RegLimiterComponent.java | 34 ------------------- .../config/LaunchServerConfig.java | 6 ---- .../manangers/hook/AuthHookManager.java | 15 -------- 4 files changed, 56 deletions(-) delete mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/components/RegLimiterComponent.java diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java b/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java index 5eb20ad1..857fce51 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java @@ -11,7 +11,6 @@ public abstract class Component { public static void registerComponents() { if (!registredComp) { providers.register("authLimiter", AuthLimiterComponent.class); - providers.register("regLimiter", RegLimiterComponent.class); providers.register("commandRemover", CommandRemoverComponent.class); providers.register("proguard", ProGuardComponent.class); providers.register("whitelist", WhitelistComponent.class); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/components/RegLimiterComponent.java b/LaunchServer/src/main/java/pro/gravit/launchserver/components/RegLimiterComponent.java deleted file mode 100644 index 7452c560..00000000 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/components/RegLimiterComponent.java +++ /dev/null @@ -1,34 +0,0 @@ -package pro.gravit.launchserver.components; - -import pro.gravit.launchserver.LaunchServer; -import pro.gravit.launchserver.manangers.hook.AuthHookManager; -import pro.gravit.utils.HookException; - -import java.util.ArrayList; -import java.util.List; - -public class RegLimiterComponent extends IPLimiter implements AutoCloseable { - - public transient LaunchServer launchServer; - public String message; - - public List excludeIps = new ArrayList<>(); - - @Override - public void init(LaunchServer launchServer) { - this.launchServer = launchServer; - launchServer.authHookManager.registraion.registerHook(this::registerHook); - } - - public boolean registerHook(AuthHookManager.RegContext context) { - if (!check(context.ip)) { - throw new HookException(message); - } - return false; - } - - @Override - public void close() { - launchServer.authHookManager.registraion.unregisterHook(this::registerHook); - } -} diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index be906d4a..42d63bbc 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -15,7 +15,6 @@ import pro.gravit.launchserver.components.AuthLimiterComponent; import pro.gravit.launchserver.components.Component; import pro.gravit.launchserver.components.ProGuardComponent; -import pro.gravit.launchserver.components.RegLimiterComponent; import pro.gravit.utils.helper.JVMHelper; import java.io.File; @@ -87,11 +86,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) { authLimiterComponent.rateLimitMillis = SECONDS.toMillis(8); authLimiterComponent.message = "Превышен лимит авторизаций"; newConfig.components.put("authLimiter", authLimiterComponent); - RegLimiterComponent regLimiterComponent = new RegLimiterComponent(); - regLimiterComponent.rateLimit = 3; - regLimiterComponent.rateLimitMillis = HOURS.toMillis(10); - regLimiterComponent.message = "Превышен лимит регистраций"; - newConfig.components.put("regLimiter", regLimiterComponent); ProGuardComponent proGuardComponent = new ProGuardComponent(); newConfig.components.put("proguard", proGuardComponent); return newConfig; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/AuthHookManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/AuthHookManager.java index 8148e975..fcaaf91a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/AuthHookManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/hook/AuthHookManager.java @@ -16,19 +16,4 @@ public class AuthHookManager { public final BiHookSet postCheckServerHook = new BiHookSet<>(); public final BiHookSet joinServerHook = new BiHookSet<>(); public final BiHookSet setProfileHook = new BiHookSet<>(); - public final HookSet registraion = new HookSet<>(); - - public static class RegContext { - public final String login; - public final String password; - public final String ip; - public final boolean trustContext; - - public RegContext(String login, String password, String ip, boolean trustContext) { - this.login = login; - this.password = password; - this.ip = ip; - this.trustContext = trustContext; - } - } }