mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
Merge branch 'master' of github.com:GravitLauncher/Launcher
This commit is contained in:
commit
04149c9491
5 changed files with 14 additions and 7 deletions
|
@ -93,6 +93,8 @@ public static final class Config extends ConfigObject {
|
|||
|
||||
public final int authRateLimitMilis;
|
||||
|
||||
public final ListConfigEntry authLimitExclusions;
|
||||
|
||||
public final String authRejectString;
|
||||
|
||||
public final String projectName;
|
||||
|
@ -122,6 +124,7 @@ private Config(BlockConfigEntry block, Path coredir, LaunchServer server) {
|
|||
VerifyHelper.range(0, 1000000), "Illegal authRateLimit");
|
||||
authRateLimitMilis = VerifyHelper.verifyInt(block.getEntryValue("authRateLimitMilis", IntegerConfigEntry.class),
|
||||
VerifyHelper.range(10, 10000000), "Illegal authRateLimitMillis");
|
||||
authLimitExclusions = block.hasEntry("authLimitExclusions") ? block.getEntry("authLimitExclusions", ListConfigEntry.class) : null;
|
||||
bindAddress = block.hasEntry("bindAddress") ?
|
||||
block.getEntryValue("bindAddress", StringConfigEntry.class) : getAddress();
|
||||
authRejectString = block.hasEntry("authRejectString") ?
|
||||
|
@ -129,7 +132,6 @@ private Config(BlockConfigEntry block, Path coredir, LaunchServer server) {
|
|||
whitelistRejectString = block.hasEntry("whitelistRejectString") ?
|
||||
block.getEntryValue("whitelistRejectString", StringConfigEntry.class) : "Вас нет в белом списке";
|
||||
|
||||
|
||||
// Set handlers & providers
|
||||
authHandler = new AuthHandler[1];
|
||||
authHandler[0] = AuthHandler.newHandler(block.getEntryValue("authHandler", StringConfigEntry.class),
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package ru.gravit.launchserver.auth;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import ru.gravit.launcher.NeedGarbageCollection;
|
||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
|
||||
public class AuthLimiter implements NeedGarbageCollection {
|
||||
|
@ -50,10 +53,13 @@ public String toString() {
|
|||
public final int rateLimit;
|
||||
public final int rateLimitMilis;
|
||||
|
||||
private HashMap<String, AuthEntry> map;
|
||||
private final HashMap<String, AuthEntry> map;
|
||||
private final List<String> excludeIps;
|
||||
|
||||
public AuthLimiter(LaunchServer srv) {
|
||||
map = new HashMap<>();
|
||||
excludeIps = new ArrayList<>();
|
||||
if (srv.config.authLimitExclusions != null) srv.config.authLimitExclusions.stream(StringConfigEntry.class).forEach(excludeIps::add);
|
||||
rateLimit = srv.config.authRateLimit;
|
||||
rateLimitMilis = srv.config.authRateLimitMilis;
|
||||
}
|
||||
|
@ -66,6 +72,7 @@ public void garbageCollection() {
|
|||
}
|
||||
|
||||
public boolean isLimit(String ip) {
|
||||
if (excludeIps.contains(ip)) return false;
|
||||
if (map.containsKey(ip)) {
|
||||
AuthEntry rate = map.get(ip);
|
||||
long currenttime = System.currentTimeMillis();
|
||||
|
|
|
@ -54,10 +54,8 @@ protected AuthHandler(BlockConfigEntry block) {
|
|||
super(block);
|
||||
}
|
||||
|
||||
|
||||
public abstract UUID auth(AuthProviderResult authResult) throws IOException;
|
||||
|
||||
|
||||
public abstract UUID checkServer(String username, String serverID) throws IOException;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -293,7 +293,8 @@ function updateProfilesList(profiles) {
|
|||
index++;
|
||||
});
|
||||
LogHelper.debug("Load selected %d profile",settings.profile);
|
||||
serverHolder.set(serverList.getChildren().get(settings.profile));
|
||||
if(profiles.length > 0)
|
||||
serverHolder.set(serverList.getChildren().get(settings.profile));
|
||||
}
|
||||
|
||||
function pingServer(btn) {
|
||||
|
@ -422,4 +423,4 @@ launcher.loadScript("dialog/overlay/debug/debug.js");
|
|||
launcher.loadScript("dialog/overlay/processing/processing.js");
|
||||
launcher.loadScript("dialog/overlay/settings/settings.js");
|
||||
launcher.loadScript("dialog/overlay/options/options.js");
|
||||
launcher.loadScript("dialog/overlay/update/update.js");
|
||||
launcher.loadScript("dialog/overlay/update/update.js");
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import javafx.scene.shape.Arc;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.util.Duration;
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
/**
|
||||
* Skin of the ring progress indicator where an arc grows and by the progress value up to 100% where the arc becomes a ring.
|
||||
|
|
Loading…
Reference in a new issue