mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Merge tag 'v5.1.10' into dev
5.1.10 Stable
This commit is contained in:
commit
8ff31888e9
10 changed files with 62 additions and 23 deletions
9
.github/workflows/push.yml
vendored
9
.github/workflows/push.yml
vendored
|
@ -1,9 +1,6 @@
|
|||
name: push
|
||||
on:
|
||||
push:
|
||||
create:
|
||||
tags:
|
||||
- v*
|
||||
jobs:
|
||||
launcher:
|
||||
name: Launcher
|
||||
|
@ -55,7 +52,7 @@ jobs:
|
|||
- name: Create release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
if: github.event_name == 'create'
|
||||
if: github.event.ref == 'refs/tags/*'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
|
@ -65,13 +62,13 @@ jobs:
|
|||
prerelease: false
|
||||
|
||||
- name: Pack release
|
||||
if: github.event_name == 'create'
|
||||
if: github.event.ref == 'refs/tags/*'
|
||||
run: |
|
||||
cd artifacts/
|
||||
zip -r -9 ../Release.zip *
|
||||
|
||||
- name: Upload release
|
||||
if: github.event_name == 'create'
|
||||
if: github.event.ref == 'refs/tags/*'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -293,6 +293,15 @@ public void invoke(String... args) throws Exception {
|
|||
}
|
||||
};
|
||||
commands.put("reload", reload);
|
||||
SubCommand save = new SubCommand() {
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
launchServerConfigManager.writeConfig(config);
|
||||
launchServerConfigManager.writeRuntimeConfig(runtime);
|
||||
LogHelper.info("LaunchServerConfig saved");
|
||||
}
|
||||
};
|
||||
commands.put("save", save);
|
||||
return commands;
|
||||
}
|
||||
|
||||
|
@ -319,7 +328,8 @@ public void buildLauncherBinaries() throws IOException {
|
|||
}
|
||||
|
||||
public void close() throws Exception {
|
||||
|
||||
LogHelper.info("Close server socket");
|
||||
nettyServerSocketHandler.close();
|
||||
// Close handlers & providers
|
||||
config.close(ReloadType.FULL);
|
||||
modulesManager.invokeEvent(new ClosePhase());
|
||||
|
@ -368,8 +378,14 @@ public void run() {
|
|||
}
|
||||
if (config.netty != null)
|
||||
rebindNettyServerSocket();
|
||||
modulesManager.fullInitializedLaunchServer(this);
|
||||
modulesManager.invokeEvent(new LaunchServerFullInitEvent(this));
|
||||
try {
|
||||
modulesManager.fullInitializedLaunchServer(this);
|
||||
modulesManager.invokeEvent(new LaunchServerFullInitEvent(this));
|
||||
LogHelper.info("LaunchServer started");
|
||||
} catch (Throwable e) {
|
||||
LogHelper.error(e);
|
||||
JVMHelper.RUNTIME.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncLauncherBinaries() throws IOException {
|
||||
|
|
|
@ -61,7 +61,13 @@ public static void main(String[] args) throws Exception {
|
|||
Path privateKeyFile = dir.resolve("private.key");
|
||||
ECPublicKey publicKey;
|
||||
ECPrivateKey privateKey;
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
try {
|
||||
Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
} catch (ClassNotFoundException ex) {
|
||||
LogHelper.error("Library BouncyCastle not found! Is directory 'libraries' empty?");
|
||||
return;
|
||||
}
|
||||
CertificateManager certificateManager = new CertificateManager();
|
||||
try {
|
||||
certificateManager.readTrustStore(dir.resolve("truststore"));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MemorySessionStorage extends SessionStorage implements NeedGarbageCollection {
|
||||
public class MemorySessionStorage extends SessionStorage implements NeedGarbageCollection, AutoCloseable {
|
||||
|
||||
private transient final Map<UUID, Entry> clientSet = new ConcurrentHashMap<>(128);
|
||||
private transient final Map<UUID, Set<Entry>> uuidIndex = new ConcurrentHashMap<>(32);
|
||||
|
@ -90,10 +90,6 @@ public boolean deleteSessionsByUserUUID(UUID userUUID) {
|
|||
public void clear() {
|
||||
clientSet.clear();
|
||||
uuidIndex.clear();
|
||||
if(autoDump) {
|
||||
garbageCollection();
|
||||
dumpSessionsData();
|
||||
}
|
||||
}
|
||||
|
||||
public void dumpSessionsData() {
|
||||
|
@ -161,6 +157,14 @@ public void garbageCollection() {
|
|||
to_delete.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
if(autoDump) {
|
||||
garbageCollection();
|
||||
dumpSessionsData();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Entry {
|
||||
public byte[] data;
|
||||
public UUID sessionUuid;
|
||||
|
@ -174,8 +178,8 @@ public Entry(byte[] data, UUID sessionUuid) {
|
|||
}
|
||||
|
||||
private static class DumpedData {
|
||||
private transient final Map<UUID, Entry> clientSet;
|
||||
private transient final Map<UUID, Set<Entry>> uuidIndex;
|
||||
private final Map<UUID, Entry> clientSet;
|
||||
private final Map<UUID, Set<Entry>> uuidIndex;
|
||||
|
||||
private DumpedData(Map<UUID, Entry> clientSet, Map<UUID, Set<Entry>> uuidIndex) {
|
||||
this.clientSet = clientSet;
|
||||
|
|
|
@ -235,6 +235,13 @@ public void close(LaunchServer.ReloadType type) {
|
|||
}
|
||||
if(sessions != null) {
|
||||
server.unregisterObject("sessions", sessions);
|
||||
if (sessions instanceof AutoCloseable) {
|
||||
try {
|
||||
((AutoCloseable) sessions).close();
|
||||
} catch (Exception e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dao != null) {
|
||||
server.unregisterObject("dao", dao);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LauncherNettyServer implements AutoCloseable {
|
||||
private static final String WEBSOCKET_PATH = "/api";
|
||||
|
@ -77,7 +78,9 @@ public ChannelFuture bind(InetSocketAddress address) {
|
|||
|
||||
@Override
|
||||
public void close() {
|
||||
workerGroup.shutdownGracefully();
|
||||
bossGroup.shutdownGracefully();
|
||||
workerGroup.shutdownGracefully(2, 5, TimeUnit.SECONDS);
|
||||
bossGroup.shutdownGracefully(2, 5, TimeUnit.SECONDS);
|
||||
//workerGroup.shutdownGracefully();
|
||||
//bossGroup.shutdownGracefully();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public class AsyncDownloader {
|
|||
public final Callback callback;
|
||||
@LauncherInject("launcher.certificatePinning")
|
||||
private static boolean isCertificatePinning;
|
||||
private static volatile SSLSocketFactory sslSocketFactory;
|
||||
|
||||
public AsyncDownloader(Callback callback) {
|
||||
this.callback = callback;
|
||||
|
@ -71,9 +72,11 @@ public void downloadFile(URL url, Path target) throws IOException {
|
|||
}
|
||||
|
||||
public SSLSocketFactory makeSSLSocketFactory() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, KeyManagementException {
|
||||
if(sslSocketFactory != null) return sslSocketFactory;
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, CertificatePinningTrustManager.getTrustManager().getTrustManagers(), new SecureRandom());
|
||||
return sslContext.getSocketFactory();
|
||||
sslSocketFactory = sslContext.getSocketFactory();
|
||||
return sslSocketFactory;
|
||||
}
|
||||
|
||||
public void downloadListInOneThread(List<SizedFile> files, String baseURL, Path targetDir) throws URISyntaxException, IOException {
|
||||
|
|
|
@ -21,6 +21,7 @@ public final class CertificatePinningTrustManager {
|
|||
@LauncherInject("launchercore.certificates")
|
||||
private static List<byte[]> secureConfigCertificates;
|
||||
private static X509Certificate[] certs = null;
|
||||
private volatile static TrustManagerFactory INSTANCE;
|
||||
private static X509Certificate[] getInternalCertificates() {
|
||||
CertificateFactory certFactory = null;
|
||||
try {
|
||||
|
@ -45,6 +46,7 @@ public static X509Certificate[] getCertificates() {
|
|||
}
|
||||
|
||||
public static TrustManagerFactory getTrustManager() throws KeyStoreException, NoSuchAlgorithmException, IOException, CertificateException {
|
||||
if(INSTANCE != null) return INSTANCE;
|
||||
if(certs == null) certs = getInternalCertificates();
|
||||
TrustManagerFactory factory = TrustManagerFactory.getInstance("X.509");
|
||||
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
|
@ -57,6 +59,7 @@ public static TrustManagerFactory getTrustManager() throws KeyStoreException, No
|
|||
i++;
|
||||
}
|
||||
factory.init(keystore);
|
||||
INSTANCE = factory;
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ public final class Version {
|
|||
public static final int MAJOR = 5;
|
||||
public static final int MINOR = 1;
|
||||
public static final int PATCH = 10;
|
||||
public static final int BUILD = 1;
|
||||
public static final Version.Type RELEASE = Type.DEV;
|
||||
public static final int BUILD = 2;
|
||||
public static final Version.Type RELEASE = Type.STABLE;
|
||||
public final int major;
|
||||
public final int minor;
|
||||
public final int patch;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
|
||||
}
|
||||
group = 'pro.gravit.launcher'
|
||||
version = '5.1.10-SNAPSHOT'
|
||||
version = '5.1.10'
|
||||
|
||||
apply from: 'props.gradle'
|
||||
|
||||
|
|
Loading…
Reference in a new issue