mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Удаление whitelist профиля
This commit is contained in:
parent
0ddf04b6aa
commit
58a208a3f5
5 changed files with 0 additions and 34 deletions
|
@ -74,7 +74,6 @@ public AuthProviderPair getAuthProviderPair() {
|
||||||
public ExeConf launch4j;
|
public ExeConf launch4j;
|
||||||
public NettyConfig netty;
|
public NettyConfig netty;
|
||||||
|
|
||||||
public String whitelistRejectString;
|
|
||||||
public LauncherConf launcher;
|
public LauncherConf launcher;
|
||||||
public CertificateConf certificate;
|
public CertificateConf certificate;
|
||||||
public JarSignerConf sign;
|
public JarSignerConf sign;
|
||||||
|
@ -282,7 +281,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
|
||||||
newConfig.auth.put("std", a);
|
newConfig.auth.put("std", a);
|
||||||
newConfig.protectHandler = new StdProtectHandler();
|
newConfig.protectHandler = new StdProtectHandler();
|
||||||
newConfig.binaryName = "Launcher";
|
newConfig.binaryName = "Launcher";
|
||||||
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
|
||||||
|
|
||||||
newConfig.netty = new NettyConfig();
|
newConfig.netty = new NettyConfig();
|
||||||
newConfig.netty.fileServerEnabled = true;
|
newConfig.netty.fileServerEnabled = true;
|
||||||
|
|
|
@ -82,15 +82,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
||||||
AuthProvider.authError(String.format("Illegal result: '%s'", aresult.username));
|
AuthProvider.authError(String.format("Illegal result: '%s'", aresult.username));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Collection<ClientProfile> profiles = server.getProfiles();
|
|
||||||
for (ClientProfile p : profiles) {
|
|
||||||
if (p.getTitle().equals(client)) {
|
|
||||||
if (!p.isWhitelistContains(login)) {
|
|
||||||
throw new AuthException(server.config.whitelistRejectString);
|
|
||||||
}
|
|
||||||
clientData.profile = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//if (clientData.profile == null) {
|
//if (clientData.profile == null) {
|
||||||
// throw new AuthException("You profile not found");
|
// throw new AuthException("You profile not found");
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -31,10 +31,6 @@ public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
Collection<ClientProfile> profiles = server.getProfiles();
|
Collection<ClientProfile> profiles = server.getProfiles();
|
||||||
for (ClientProfile p : profiles) {
|
for (ClientProfile p : profiles) {
|
||||||
if (p.getTitle().equals(this.client)) {
|
if (p.getTitle().equals(this.client)) {
|
||||||
if (!p.isWhitelistContains(client.username)) {
|
|
||||||
sendError(server.config.whitelistRejectString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client.profile = p;
|
client.profile = p;
|
||||||
sendResult(new SetProfileRequestEvent(p));
|
sendResult(new SetProfileRequestEvent(p));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,15 +24,6 @@ public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
sendError("Access denied");
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!client.permissions.canAdmin) {
|
|
||||||
for (ClientProfile p : server.getProfiles()) {
|
|
||||||
if (!client.profile.getTitle().equals(p.getTitle())) continue;
|
|
||||||
if (!p.isWhitelistContains(client.username)) {
|
|
||||||
sendError("You don't download this folder");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashedDir dir = server.updatesDirMap.get(dirName);
|
HashedDir dir = server.updatesDirMap.get(dirName);
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
sendError(String.format("Directory %s not found", dirName));
|
sendError(String.format("Directory %s not found", dirName));
|
||||||
|
|
|
@ -120,8 +120,6 @@ public enum ClassLoaderConfig
|
||||||
private final Set<OptionalFile> updateOptional = new HashSet<>();
|
private final Set<OptionalFile> updateOptional = new HashSet<>();
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private boolean updateFastCheck;
|
private boolean updateFastCheck;
|
||||||
@LauncherNetworkAPI
|
|
||||||
private boolean useWhitelist;
|
|
||||||
// Client launcher
|
// Client launcher
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private String mainClass;
|
private String mainClass;
|
||||||
|
@ -132,8 +130,6 @@ public enum ClassLoaderConfig
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final List<String> clientArgs = new ArrayList<>();
|
private final List<String> clientArgs = new ArrayList<>();
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final List<String> whitelist = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public SecurityManagerConfig securityManagerConfig = SecurityManagerConfig.CLIENT;
|
public SecurityManagerConfig securityManagerConfig = SecurityManagerConfig.CLIENT;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public ClassLoaderConfig classLoaderConfig = ClassLoaderConfig.LAUNCHER;
|
public ClassLoaderConfig classLoaderConfig = ClassLoaderConfig.LAUNCHER;
|
||||||
|
@ -383,12 +379,6 @@ public boolean isUpdateFastCheck() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isWhitelistContains(String username) {
|
|
||||||
if (!useWhitelist) return true;
|
|
||||||
return whitelist.stream().anyMatch(profileCaseSensitive ? e -> e.equals(username) : e -> e.equalsIgnoreCase(username));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue