mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
Fix #89.
This commit is contained in:
parent
d6049e71c0
commit
f879c98995
9 changed files with 44 additions and 106 deletions
|
@ -18,6 +18,7 @@
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -245,12 +246,14 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
|
|
||||||
public static class PostBuildTransformConf extends ConfigObject {
|
public static class PostBuildTransformConf extends ConfigObject {
|
||||||
public final boolean enabled;
|
public final boolean enabled;
|
||||||
public String script;
|
public List<String> script;
|
||||||
|
|
||||||
private PostBuildTransformConf(BlockConfigEntry block, Path coredir) {
|
private PostBuildTransformConf(BlockConfigEntry block, Path coredir) {
|
||||||
super(block);
|
super(block);
|
||||||
enabled = block.getEntryValue("enabled", BooleanConfigEntry.class);
|
enabled = block.getEntryValue("enabled", BooleanConfigEntry.class);
|
||||||
script = enabled && block.hasEntry("script") ? block.getEntryValue("script", StringConfigEntry.class) : null;
|
script = new ArrayList<>(1);
|
||||||
|
if (block.hasEntry("script"))
|
||||||
|
block.getEntry("script", ListConfigEntry.class).stream(StringConfigEntry.class).forEach(script::add);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ru.gravit.launchserver.auth.hwid;
|
package ru.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class MysqlHWIDHandler extends HWIDHandler {
|
||||||
private final String banMessage;
|
private final String banMessage;
|
||||||
private final String isBannedName;
|
private final String isBannedName;
|
||||||
private final String loginName;
|
private final String loginName;
|
||||||
private final String hwidName, cpuName, biosName;
|
private final String hwidName;
|
||||||
private final String[] queryParams;
|
private final String[] queryParams;
|
||||||
private final String queryUpd;
|
private final String queryUpd;
|
||||||
private final String[] queryParamsUpd;
|
private final String[] queryParamsUpd;
|
||||||
|
@ -49,10 +49,6 @@ public MysqlHWIDHandler(BlockConfigEntry block) {
|
||||||
banMessage = block.hasEntry("banMessage") ? block.getEntryValue("banMessage", StringConfigEntry.class) : "You HWID Banned";
|
banMessage = block.hasEntry("banMessage") ? block.getEntryValue("banMessage", StringConfigEntry.class) : "You HWID Banned";
|
||||||
hwidName = VerifyHelper.verify(block.getEntryValue("hwidName", StringConfigEntry.class),
|
hwidName = VerifyHelper.verify(block.getEntryValue("hwidName", StringConfigEntry.class),
|
||||||
VerifyHelper.NOT_EMPTY, "hwidName can't be empty");
|
VerifyHelper.NOT_EMPTY, "hwidName can't be empty");
|
||||||
cpuName = VerifyHelper.verify(block.getEntryValue("cpuName", StringConfigEntry.class),
|
|
||||||
VerifyHelper.NOT_EMPTY, "cpuName can't be empty");
|
|
||||||
biosName = VerifyHelper.verify(block.getEntryValue("biosName", StringConfigEntry.class),
|
|
||||||
VerifyHelper.NOT_EMPTY, "biosName can't be empty");
|
|
||||||
|
|
||||||
queryUpd = VerifyHelper.verify(block.getEntryValue("queryUpd", StringConfigEntry.class),
|
queryUpd = VerifyHelper.verify(block.getEntryValue("queryUpd", StringConfigEntry.class),
|
||||||
VerifyHelper.NOT_EMPTY, "MySQL queryUpd can't be empty");
|
VerifyHelper.NOT_EMPTY, "MySQL queryUpd can't be empty");
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipException;
|
import java.util.zip.ZipException;
|
||||||
|
@ -22,7 +23,6 @@
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.CommonHelper;
|
||||||
import ru.gravit.utils.helper.EnvHelper;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
@ -68,6 +68,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: new native security wrapper and library...
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final class GuardDirVisitor extends SimpleFileVisitor<Path> {
|
private final class GuardDirVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final ZipOutputStream output;
|
private final ZipOutputStream output;
|
||||||
private final Map<String, byte[]> guard;
|
private final Map<String, byte[]> guard;
|
||||||
|
@ -178,20 +180,17 @@ public void build() throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (server.config.buildPostTransform.enabled)
|
if (server.config.buildPostTransform.enabled)
|
||||||
// transformedBuild();
|
transformedBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transformedBuild() throws IOException {
|
private void transformedBuild() throws IOException {
|
||||||
String cmd = CommonHelper.replace(server.config.buildPostTransform.script, "launcher-output", IOHelper.toAbsPathString(syncBinaryFile), "launcher-obf", IOHelper.toAbsPathString(obfJar), "launcher-nonObf", IOHelper.toAbsPathString(binaryFile));
|
List<String> cmd = new ArrayList<>(1);
|
||||||
|
server.config.buildPostTransform.script.forEach(v -> CommonHelper.replace(v, "launcher-output", IOHelper.toAbsPathString(syncBinaryFile), "launcher-obf", IOHelper.toAbsPathString(obfJar), "launcher-nonObf", IOHelper.toAbsPathString(binaryFile)));
|
||||||
ProcessBuilder builder = new ProcessBuilder();
|
ProcessBuilder builder = new ProcessBuilder();
|
||||||
builder.directory(IOHelper.toAbsPath(server.dir).toFile());
|
builder.directory(IOHelper.toAbsPath(server.dir).toFile());
|
||||||
builder.inheritIO();
|
builder.inheritIO();
|
||||||
StringTokenizer st = new StringTokenizer(cmd);
|
builder.command(cmd);
|
||||||
String[] cmdarray = new String[st.countTokens()];
|
|
||||||
for (int i = 0; st.hasMoreTokens(); i++)
|
|
||||||
cmdarray[i] = st.nextToken();
|
|
||||||
builder.command(cmdarray);
|
|
||||||
Process proc = builder.start();
|
Process proc = builder.start();
|
||||||
try {
|
try {
|
||||||
LogHelper.debug("Transformer process return code: " + proc.waitFor());
|
LogHelper.debug("Transformer process return code: " + proc.waitFor());
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.auth.AuthException;
|
import ru.gravit.launchserver.auth.AuthException;
|
||||||
import ru.gravit.launcher.HWID;
|
|
||||||
import ru.gravit.launchserver.auth.hwid.HWIDException;
|
import ru.gravit.launchserver.auth.hwid.HWIDException;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
|
|
|
@ -42,10 +42,17 @@ textureProviderConfig: {
|
||||||
cloaksURL: "http://skins.minecraft.net/MinecraftCloaks/%username%.png";
|
cloaksURL: "http://skins.minecraft.net/MinecraftCloaks/%username%.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Jar signing
|
# Build operation
|
||||||
buildExtendedOperation: {
|
buildExtendedOperation: {
|
||||||
enabled: false;
|
enabled: false;
|
||||||
script: "java -jar myTransformer.jar %launcher-obf% %launcher-output% %launcher-nonObf%";
|
script: [
|
||||||
|
"java",
|
||||||
|
"-jar",
|
||||||
|
"myTransformer.jar",
|
||||||
|
"%launcher-obf%",
|
||||||
|
"%launcher-output%,
|
||||||
|
"%launcher-nonObf%"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Binaries name
|
# Binaries name
|
||||||
|
|
|
@ -78,7 +78,7 @@ function offlineUpdateRequest(dirName, dir, matcher, digest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify dir with matcher using ClientLauncher's API
|
// Verify dir with matcher using ClientLauncher's API
|
||||||
ClientLauncher.verifyHDir(dir, hdir.object, matcher, digest);
|
ClientLauncher.verifyOffline(dir, hdir.object, matcher, digest);
|
||||||
return hdir;
|
return hdir;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -546,7 +546,19 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
|
||||||
matcher = matcher.verifyOnly();
|
matcher = matcher.verifyOnly();
|
||||||
|
|
||||||
// Hash directory and compare (ignore update-only matcher entries, it will break offline-mode)
|
// Hash directory and compare (ignore update-only matcher entries, it will break offline-mode)
|
||||||
HashedDir currentHDir = new HashedDir(dir, matcher, false, digest);
|
HashedDir currentHDir = new HashedDir(dir, matcher, true, digest);
|
||||||
|
if (!hdir.diff(currentHDir, matcher).isSame())
|
||||||
|
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hack: this will break patcher because there are 2 functions with one body...
|
||||||
|
@LauncherAPI
|
||||||
|
public static void verifyOffline(Path dir, HashedDir hdir, FileNameMatcher matcher, boolean digest) throws IOException {
|
||||||
|
if (matcher != null)
|
||||||
|
matcher = matcher.verifyOnly();
|
||||||
|
|
||||||
|
// Hash directory and compare (ignore update-only matcher entries, it will break offline-mode)
|
||||||
|
HashedDir currentHDir = new HashedDir(dir, matcher, true, digest);
|
||||||
if (!hdir.diff(currentHDir, matcher).isSame())
|
if (!hdir.diff(currentHDir, matcher).isSame())
|
||||||
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
||||||
}
|
}
|
||||||
|
@ -554,81 +566,3 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
|
||||||
private ClientLauncher() {
|
private ClientLauncher() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's here since first commit, there's no any reasons to remove :D
|
|
||||||
// ++oyyysssssssssssooooooo++++++++/////:::::-------------................----:::----::+osssso+///+++++ooys/:/+ssssyyssyooooooo+++////:::::::::-::///++ossyhdddddddhhys/----::::::::::::::/:////////////
|
|
||||||
// ++oyyssssssssssoooooooo++++++++//////:::::--------------------------------:::::-:::/+oo+//://+oo+//syysssssyyyyyhyyyssssssoo+++///::--:----:--:://++osyyhdddmddmdhys/------:::::::::::::::///////////
|
|
||||||
// ++syyssssssssssoooooooo++++++++///////:::::::::::::::-----------------------::--::/++++/:--::/+++//osysshhhhyhhdyyyyyssyssoo++//::-------------::/+++oyhyhdddmddmdhy+--------::::::::::::::://///////
|
|
||||||
// ++ssssssssssssooooooooo++++++///////::::::::-------------------------------------::/+//:----://+//+oyhhhddhhdhhhyhyyyyhysoo+//::----------------://++oshhhhmddmddmhhs:---------:::::::::::::::///////
|
|
||||||
// ++sssssssssssooooooooo++++////::::::::::------------------------------------:---:::///:-----://++osyhddddhdddhhhhhyyhdysso+/::-------------------://+ooyhhddmddmdmdhy/----------::::::::::::::://////
|
|
||||||
// ++sssssssssoooooooo+++////::::::::::-------------------------------------::///::::///::--::/++osyhhddmmdhddddhhhhhyhdhyso+/:----------------------::/++oyhdhdmmmmmddho-------------::::::::::::://///
|
|
||||||
// /+ssssssssosooo+++/////::::::::::----------------------------------:::::://+++ooossso////++oosyhddddmmdhddddhhhhhhhdhyddhs+:-----------------------::/++syhddmmmmdddho--------------::::::::::::::///
|
|
||||||
// /+sssssssooo+++//////::::::::::-------------------------------:::://++++ooooooooooooo+/+oosyyhhddddmmddddddhhhhhhhdhyyssyyhs+::-------------::://++/+/o++shddddmmmddh+----------------::::::::::::://
|
|
||||||
// /+sssooso++++/////::::::::::::------------------------::::::///++o++//:--...............-/osyyhddmmmmddddhhhhhyyhdhhdmddhysoso::--------::/osyyyssyyssssoosdmddddddy+:-------------------:::::::::::/
|
|
||||||
// /+sssooso+++////::::::::::::--------------------:::::////++o+//:-......................--+ossydddmmdmmdddhhhhyyhddyyydmhhooo++/:-------::/+oshhhyso+/://++ohmmmdhhy+:---------------------:::::::::::
|
|
||||||
// /+sooooso++/////:::::::::::--------------:::::///+++oo+//:-............................-/+oyydddmmddddddhhhyyyhhhyysosss+:/+///:--.---://+o/ohhdhoyyo+/://+ymmdhsyo:------------------------:::::::::
|
|
||||||
// /+ooooooso+////:::::::::------------:::::///++oooo/:-..................................:/oyyyhdmdddddddhhhhyyhyss++///:::/::::/:-...--::://-/shy+-:+s+/::/+hdhysos/--------------------------::::::::
|
|
||||||
// /+oooooooo++///::::::::::-:----:::::::///+oosyy/-.....................................-/+syhhddddddddhhhhhhhysso+/::::-----:::::-..------:::::////:::::::/sdysso+o:..----.--------------------:::::::
|
|
||||||
// /+ooooooooo++///:::::::::::::::::::///++osyhmmdo:-...................................-/+syyhdddddddddhdddmmhys+/::----------:::--..---------::::::-----::+dhsoso++:....--.--..----------------:::::::
|
|
||||||
// /ooooooooooo++///::::::://///++oooosssyydddhdhs+so/+++:-............................./+syyhdddddddddddddmmmhs+//:------------:--..---------------------:/hdsooso+/-....--.....------------------:::::
|
|
||||||
// /oooooooo++++o++//:::::::///++ossso+ooosysos++o/so//////--..........................:yhddhdddmmdddmmmdddmddhs+/::----------:::---.--------------------:/hdhsooso+/-.....-........----------------::::
|
|
||||||
// /ooooooo+++++++++//:::::::::/+o+ooooyyso+oo/++o/oo///://////::--...................-sdhddhddmmdhdmmmddhhdmNds+/:::--------:/:------------------------::sdhyooyso+:-...............---------------::::
|
|
||||||
// /ooooooo+++++++++++//:::://+++++ssyys+/+y+///++/so///:://://::::/---://............-smdddddmmhyhhdddhhsydmNmyo//:::------://:--------:::------------::odhysshyo++-................---------------::::
|
|
||||||
// /oooooo+++++++++++/+o+/++++++++ohhoo+//yo//:/+//so:/:////::+////+///+so/++/:--------:hdddmdhyssyhhddhsosdmNmho+/:::------////:------::::-----------::+hdhhhyyo+o/-................----------------:::
|
|
||||||
// /ooo++o++++++++++//+oooooo++++oyyoo+//os+////+//so/://::////+///+//+ssooo+++++++/++//odhhhyoooosyhhhysoodmmNds+//:::-----:++o+/:::/+//:----------::/+ydhyyyyo+oo:...................--------------:::
|
|
||||||
// /oooo+++++++++++/////+ossoooooss++////+so/::++//os://:/::://////++/os+++++++/++++++++osyso++++osyyyyssoodmmmmyo+/::::-----::/++++////:--------::::/+shhysoso+ss/.....................------------:::/
|
|
||||||
// +ooo++++++++++/////////+oooosso////:::+oso/:/+//oy+//:///://////+//o+/++////////++++ooooo++++ossyhhsoosodmmmmds+//////::::::::::::---------::::://+shhyso+++ss:........................----------:://
|
|
||||||
// +ooo++++++++++///////////////++++//:::/++o////+/+yo//////////////:/o:/+//////////+oooo+oooo++ooyyyyysssshmmmmmds+//////+++++///:::::::::::::::://+syhhso+++oo/..........................---------::/+
|
|
||||||
// +o+o+++++++++///////////////::///++//:::/+///////oy+///://///////-++:+/://://::/++so++ooooooossysyyhhssyhmmmmNmds+//:::/++++oooooooo+++//:::::/+oosyys++oso+/-..........................--------:://+
|
|
||||||
// +oo+++++++++/////////////////:::://++//////:/+/:/+ss+//////++///:://///::://:://++o++ossssyyssosyyhhyssydmmmmNNmmyo//////++///////////::::::/+oooosossssyyo/-...........................--------://++
|
|
||||||
// +++++++++++//////////////::/::::::::///++/:///:://oss//:////++//::+/////:::/:://+so++ssyyhhhoosyyyysoosydmmmNNmmmmho+//::////+++++///:::::/+osssssshmdssyyo-............................-------::/+++
|
|
||||||
// +oo++++++++++/////////////:/::::::::::://+/////:/:+oso+:////++/://+++++++/::///+oooosyyyhhhsossssso+osshmmmmNmmmmmdys+/::::---:::::::::/+osyyyssyddmmhsyhy+-.............................-----:://+++
|
|
||||||
// +o++++++++++///////////:/::::::::::::---::/+++/::::+oso/::/://:://++++o+:::+//++ssooyyyhhyyssssoo++sssymmmmNmmmmmmhysso/:::::-----:::/+yhhhyyyhddmmdhhyhys+:-............................-----://+++/
|
|
||||||
// ++++++++++++/////////////::::::::----------://////:/+oso+/:::::://+++o+//+ooooo+++oshyhhhysssso++ososhmNNNNNmmmmhhyoooooo+/////://+oyhmmdhhyhdddddhyyysssoo+:--.........................-----://++//:
|
|
||||||
// o++++++++++/////////////:::::::::-------------:////::/ooo/:::::///+os++ssyyyyssssssyhhhysssssoooooosdmNNNNNmmmdhsss+++ooooooossyyhdmmmmdhyysyhhyssooooossooys+//:--.....................----::/+++/::
|
|
||||||
// o+++++++++//////////////::::::::----------.....-://////+oo+:://://ooooyhhhhdddhhhyhhhhyssssssssooshmNNNNNNNmmmdooo++//++oooossshddmmmddys++ooo+/+++ossyhhyyyyysoo+//:--.................----://++/:::
|
|
||||||
// ++++++++++//////////////:::::::--------..........-::///:/+++::::/+o+/ohhhhhhyyyyyyhhhysyyysyyyyhdmNNNNNNNNmmmhso++//:///+ooossydddmmmddhyysso+/++ossshddddddhyyso++++////::::::--.......---://++/:-::
|
|
||||||
// o+++++++++///////////////:::::::------..............-:////++/:///+osoyhhhhyssssyhhdddhhhyyhhdmmmmmmmmmmmmmmmho+oo+/::::///+++oyhhdmmmddhhysoo+oosyhhdmmmddddhhyssoo+++++++++++///:-....---://++//-:::
|
|
||||||
// +++++++++//+///////////:/::::::------.................-://////////+ossyyyyyhhhhddddhhhhddmmmmddddmmmmmmmmmdyo+++os/::::::://+ydhhmmmddddddddddmmmmmmmmmmmmddhyyysoo+o+++//++////::::-----::/++//--::+
|
|
||||||
// +++++++++///////////////:::::::------....................-:///++/::+syyyhhhhhhhhhhhhddmmmddddddddmmmmmmmmdso++++++++/:::://ohdhydmmddddhdmmmmmmhhdmmmmmmmmmhhyyyysooso+/+////////////:::::/+++/:-::++
|
|
||||||
// ++++++++++//////////////:/:::::------......................-:/+/:::+shhdhhhhhhhhhdddmmmddddhhhhhddmmmmmmdyo+++++/+/++++++oydmdhyhdddhhsssydmdmmddddddmmmmmdhhsyysoso++++///+//////://+//////+/:-::/o:
|
|
||||||
// ++++++++++/////////////://:::::------.........................::::/osdmmmmmddddddddddhhysssooosyhdmmmmmdsooo+o++/+++++++shmmddhyyhmhso/+shhdmddhhhdmmmmddhhyyysoooo//+++/://///:/+//+///////::-::/o/:
|
|
||||||
// +++++++++++////////////:/::::::-----..........................-:://+oymmmmmddddhhhhhhhhyysoo+osyhhdmdhyoo/++so++++oooooohmmmmdhhyhdh+//+ydhyssshddmmdhhhyyssso+/+o+//+////:////+//+////+////+++////:-
|
|
||||||
// +++++++++//////////////://:::::-----.........................-::::///oyddddhhhhhdmdddhddhhysssyhhdmdyo++o/+/+oooo+++o+osdmmmmdhhyhdd+/+syo++oshddhyyhhyssooo+///+/++/+++/://:/+/++++o++oooooso++oo++/
|
|
||||||
// o+++++++++///////////////::::::-----.........................::::::++o+shmdyhhsyhdddmmddddhsosyhhmmh++/+o+/+/++++ooososhmddddhyyso++oosso++osyyhhddmdysooo+//+/o+++/+/o//o+/++++/+ooosssooooo+++++/++
|
|
||||||
// o+++++++++///////////////:::::------........................-::::::+ossyyhyo+++shddmmdyyhyo//osysdds//++++o+/++o+o++oosdhdddhhyyysoooysoosyyyhdddhmmss+o+o++//+/+++//+++++oo++/oossssssssoooooooo++++
|
|
||||||
// o++++++++++/////////////:/::::-----.........................:::::/oyysyysooo+oyhdddmdhhddh+++osyhdh//////++o+///++ooooyshdmmmmdddhdhssshhysydmmysshyoo++++++/+++////+o+ooso+++ssyyyyyyyyysssooooo+o++
|
|
||||||
// ooo+++++++++//////////////::::-----.........................:-:::ohdhhhhysssssyhhhyhhhdmmd+++oyddho////:/++++++/+/+++oshmmmmmdhyyyssyhdysshmmmdhyysoo+/+o+//++/+//++ososso++syhyyyhyyyyyyyysssysssyss
|
|
||||||
// ooo+++++++++////////////::::::------.......................---::+hddhhyysoosoooosssooosyyyssyhdhho+///////////+/+++++symmmdys+//+oyhhyssyhdmmmmmhyo+++++++/+++++oo++ohssoooyhhhhhhhyyyhyhhyyhyyhyyyyy
|
|
||||||
// ooo++++++/++/////////////::::::-----.......................:::/:/+sssyyysssyo++oosyhhhhyyssoo+oooo+///////////+++++oyhddhysssyyhdddhysoshmNNNNmmyoo+++++++/+/++++o+osdyssoyhhhhhhhhhhhhhhyhhhhhhhhhhh
|
|
||||||
// oooo++++++++/////////////::::::-----.......................:::::///++ooooo++/:/+syhhddys++/:/+++o+++////++////+++osysydhydmddddyshysoshmmmmmNNmyooo+oo+++++/++oooooshdyoyyhhhhhhhhhhdhhhhhdhhhhdhhhhd
|
|
||||||
// ooo+++++++++/////////////::::::----.......................-://::::://////:///://ooooo+////////++oo++++////++//oosyhyyyyshddmmhyhyysyhmNmdddmNdysooooosooooooooooso+shdysyhdhhhhhhhdddhdhdddddddhhhddd
|
|
||||||
// oooo+++++++++////////////::::::----.......................::/:::::///////://::::::::::://:/::/++oo+++////++++oohyhhhhhhsydmdhhhyyhhyymmmdddmmyssoooosysossosoo+ssossddysydhhddhhddhhddddddddddddhdddd
|
|
||||||
// oooo+++++++++/++//////////::::-----......................-:::::::///////::/:::::::::::::::::/:/++oo++++++/++ssyhhddddhyyohmddhhddhyhhmmmddmmdsssoosssosssossooossoyhmhyyhdhddddhhhdhhddddddddhddddmdd
|
|
||||||
// oooo+++++++++//+//////////::::----.......................-:::::///:/::::::/::::-::::/:-:::::///++ooooo+++++shhdddddhhyyhysdddhdmdhhddmdhhydmhssosssysssssssoosssssyhmysyddddddhdhdddddddddddddddmdddd
|
|
||||||
// ooooo+++++++++++//////////::::----.......................::::::://://:::://::-:::-::::::::::////++oosoo+o+oyhhdddddhhhhddyyhyhddhhhdmmmhyyddhssssssyyysssssssssysyyddyyhddddddddhhhhhddddddddmddddddm
|
|
||||||
// ooooo+o++++++++++/////////::::----.......................::::::/:///::::::::::::::::::::/:::::///++osssososssyhddddhhhhdddssoossyhdmmmmhyyhhhyssyyyyysyyyssyssssshhmhyhdddddddddddhdhhddmddmdddddhdmm
|
|
||||||
// ooooooo++++++++++/////////:::-----......................-:::::/::::/:/::://::::/::::::::::::::/:://+ooosssyysyyyyyyyhddmmysssssyyhhddmdhysyhhyyyyyyyysyyyyysssyysyydhydddddddhddddhddddddddddddhddmmm
|
|
||||||
// ooooooo+++++++++++////////:::-----......................:::::/:::://:-::/:://::/::::-:::::::::/:/::/++oosssyyysssssyhdddhsyysssyyhhddhhyssyyyyyyyyysyyssyyyyyyyyyhhdyhdddhddddhddddddmmddddddhdddmmmm
|
|
||||||
// ooooooo+o+++++++++++//////:::-----.....................-::::::/:///:::::::::/::/::::::::::/::/:///::////+oosyysssyssyyyysssyhyyhddmmdyysoossyssyyysssyyssysyyyyshyddhddhhhddhdddddddddmddhdddhhdhhdmm
|
|
||||||
// ooooooooo++++++++++///////:::-----.....................-::::////:::::::::::::::::::://::::/-:::::/:://::///+osyyssosossssssysyhdddddhysoosssyyssssyssyyyyyysssyshddddddhddddddddddmddddhdhhhddddmmmmm
|
|
||||||
// oooooooooo+o++++++++++////::::----.....................::://::::/::::::::::::::/:://::::::::::/::::::///////++ooooosoo+ososssshddhhysssooossssssssyssysyyyyyysysyhddddddddddddddddddddhddhhhddddmmmmd
|
|
||||||
// soooooooooo+++++++++++////::::----....................-:::::////:::/:::::::/::://///:/::::::::/:///://:/://+//+++++++oo+ooooooshdyyyssossoosssyssyysssssyyyyysssshdddddddddddddddddddhhhdhhhddmmmmdmd
|
|
||||||
// sssooooooooo++++++++++////::::----....................-:::/:://///:::::::::::::/://:/::://::::::://:::/://///++/+++/+++o+oosssyyysssyysosoososysssyysyyyyhysyssyyhdddddddddddddddddhddhddhddmmmmmdmmm
|
|
||||||
// ssssoooooooo++++++++++////:::::----...................:::::://::::::::::::-::://///:////::/:/:::://///:://://+o++++++oooosoosoossoososssooososssssyyyyyssyyyssyyyhmmdddhhhhhhhddhdddddddddmmmmmmddmmm
|
|
||||||
// sssoooooooooooo+++++++/////::::----...................:://///:/:::::::::::::::://///////////+/:/://://::////+++++++ooossoossososososssoososossssssyssyyyyyyyyyysyhdhhhhhhhhhhhdhhhhhdddddmmmmmmddmmNN
|
|
||||||
// ssssoooooooooooo+++++++////::::----..................-::::/:/:::::::::::::://:::://///:/:///////////:://+/++++++oooooooosssssoosssssssosooosooossssyyysyyysyyyysoyyooossssyyhhhddhddhhhhhddmmmmmmmmmm
|
|
||||||
// ssssssoooooooooooo++++++///:::------.................::::::://:::::::-:::::/::://////:///////////////////++o++oo+ooooosoossossosssossssoosoosoosssyysyyyysyyssysoyo+oooo//+osossosyhhhhhhddmmddmmmmdm
|
|
||||||
// sssssssosooooooooooo++++///::::-----................./::::/:/:::::::::-::/:::/://///////////+//++/++//+oo+oo++ooo+ooooosssosoossssysosssssooooossysyyyyysyyyyyssoo++ooo+//+s/:---::/+oosyyyhhhhdmmmmm
|
|
||||||
// yssssssssssoooooooo+++++///::::-----................://::::::/:/::::::-::/::::://///////////////+/++++++oo+++oooooo+oooosssossosysosssosssoooosssyyyyyyyyyyyysso++++++//:/o/:--::::::::::/++oossymmmm
|
|
||||||
// yysssssssssssooooooo++++////:::------..............-///:::/:::/:::/::::://:::::::///////////////++++++o++++o++oo+ooooooooosysosssssoosssssosoossyyyyyssyyyyysss++oooo+///oo/::::-::::::::::::////sdmm
|
|
||||||
// yyysssssssssssooooooo++++///:::-------.............:/:::/:/:::::::::://://::/::::/:////////+/////++++++oo+ooo++oooo+oooossssssssssoossoooooossssyyyyyyyyyyyysso++ooo/--:/:.::::..::::-..-::://////ohm
|
|
||||||
// yyyssssssssssssoooooo++++///::::------............-/:::/://///:::::::::://::/::::::////:///+/+++/++++++/++++++o+o++oooooooosssssoossssssssosssssyyyyyyyyyyyyso++ooo:./.-+-.---...--:::.--::::://////o
|
|
||||||
// yyyysyssssssssssoooooo+++///::::--------.........-/:::::////::/::::::::::/:://:/:::///////////+/+++++//++++++++oo+++ooosoooossssssossoosssssssssyyyyyyyyyyysoo+oooo`:+.+.--.--.-::.-.----::-:.///////
|
|
||||||
// yyyyyyyyyssssssssooooo+++///:::::----------......:///:::://///:::::::::::://:/:::://///////+////++++////+++++++++o++oooosssososossossososssssysyyysyyyyyyysso+oooo+--:-+-.-.-------::----:--:-://////
|
|
||||||
// yyyyyyyyyyssssssssoooo++++//:::::-------------.--////://::/:::::/::::/:::://:/::::/:/:///////+//+++///+//++/++++o++++ooooooosssossssosoossssssssssyyyyyyyyso++ooso++/o+/::::::::::::::://////////////
|
|
||||||
// yyyyyyyyyyyssssssssoooo+++///::::---------------:////////////:/:///::::://////::::::://///////+/++////+//+/++++++++ooosooooooososoosososssosyyyssyysyyyyysso+oso+//+oo/:::::::::::::/:::///////////++
|
|
||||||
// yyyyyyyyyyyyysssssssooo+++///:::::---------------+////:///:///:::::///::://///:::/:::///////////++/++++///++++/++o+oooooooooosoososoossssssssysssyyyyyyysoo+ooso+++ss/::::::::::::::://///////////+++
|
|
||||||
// hhyyyyyyyyyyyyyssssssooo++///:::::---------------/////////:////://:///::://///://::://////////++////+///+///++o++++ooooooooooooooooooooososososssyssssysooo+oso+++os+:::::///////////////////////++++
|
|
||||||
// hhhyyyyyyyyyyyyyyssssooo+++///::::---------------:////////////:////////:://///::://////////++/+++//////+++++++++++++++oo+++o+ooososooosssoossssssssssssooo+osso+oos+:::////////////////////////++++++
|
|
||||||
// hhhhhhyyyyyyyyyyyyssssoo+++////:::::--------------:///////////:///://///:///////:///://///++/++++//++/++++/++++++++++++++o+oooooooosoosssssoosssssssssso++ossooooyo/:///////////////////////++++++++o
|
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
import ru.gravit.launcher.serialize.config.entry.*;
|
import ru.gravit.launcher.serialize.config.entry.*;
|
||||||
|
|
||||||
@SuppressWarnings("ComparableImplementedButEqualsNotOverridden")
|
@SuppressWarnings("ComparableImplementedButEqualsNotOverridden")
|
||||||
public final class
|
public final class ClientProfile extends ConfigObject implements Comparable<ClientProfile> {
|
||||||
ClientProfile extends ConfigObject implements Comparable<ClientProfile> {
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public enum Version {
|
public enum Version {
|
||||||
MC147("1.4.7", 51),
|
MC147("1.4.7", 51),
|
||||||
|
@ -63,6 +62,8 @@ public String toString() {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static final StreamObject.Adapter<ClientProfile> RO_ADAPTER = input -> new ClientProfile(input, true);
|
public static final StreamObject.Adapter<ClientProfile> RO_ADAPTER = input -> new ClientProfile(input, true);
|
||||||
|
|
||||||
|
public static final boolean profileCaseSensitive = Boolean.getBoolean("launcher.clientProfile.caseSensitive");
|
||||||
|
|
||||||
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
|
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
|
||||||
new String[0], new String[]{"indexes", "objects"}, new String[0]);
|
new String[0], new String[]{"indexes", "objects"}, new String[0]);
|
||||||
// Version
|
// Version
|
||||||
|
@ -278,8 +279,8 @@ public boolean isUpdateFastCheck() {
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public boolean isWhitelistContains(String username) {
|
public boolean isWhitelistContains(String username) {
|
||||||
if (!useWhitelist.getValue()) return true;
|
if (!useWhitelist) return true;
|
||||||
return whitelist.stream().anyMatch(e -> e.equalsIgnoreCase(username)); // TODO case sensitive on/off
|
return whitelist.stream().anyMatch(profileCaseSensitive ? e -> e.equals(username) : e -> e.equalsIgnoreCase(username));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
|
Loading…
Reference in a new issue