mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Merge branch 'release/5.3.3'
This commit is contained in:
commit
ec222aed6f
7 changed files with 32 additions and 21 deletions
|
@ -28,10 +28,7 @@
|
||||||
import pro.gravit.utils.helper.JVMHelper;
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
|
@ -148,23 +145,33 @@ public LaunchServerRuntimeConfig readRuntimeConfig() throws IOException {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeConfig(LaunchServerConfig config) throws IOException {
|
public void writeConfig(LaunchServerConfig config) throws IOException {
|
||||||
try (Writer writer = IOHelper.newWriter(configFile)) {
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
|
try (Writer writer = IOHelper.newWriter(output)) {
|
||||||
|
if (Launcher.gsonManager.configGson != null) {
|
||||||
|
Launcher.gsonManager.configGson.toJson(config, writer);
|
||||||
|
} else {
|
||||||
|
logger.error("Error writing LaunchServer config file. Gson is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
byte[] bytes = output.toByteArray();
|
||||||
|
if(bytes.length > 0) {
|
||||||
|
IOHelper.write(configFile, bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeRuntimeConfig(LaunchServerRuntimeConfig config) throws IOException {
|
||||||
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
|
try (Writer writer = IOHelper.newWriter(output)) {
|
||||||
if (Launcher.gsonManager.configGson != null) {
|
if (Launcher.gsonManager.configGson != null) {
|
||||||
Launcher.gsonManager.configGson.toJson(config, writer);
|
Launcher.gsonManager.configGson.toJson(config, writer);
|
||||||
} else {
|
} else {
|
||||||
logger.error("Error writing LaunchServer runtime config file. Gson is null");
|
logger.error("Error writing LaunchServer runtime config file. Gson is null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
byte[] bytes = output.toByteArray();
|
||||||
|
if(bytes.length > 0) {
|
||||||
@Override
|
IOHelper.write(runtimeConfigFile, bytes);
|
||||||
public void writeRuntimeConfig(LaunchServerRuntimeConfig config) throws IOException {
|
|
||||||
try (Writer writer = IOHelper.newWriter(runtimeConfigFile)) {
|
|
||||||
if (Launcher.gsonManager.configGson != null) {
|
|
||||||
Launcher.gsonManager.configGson.toJson(config, writer);
|
|
||||||
} else {
|
|
||||||
logger.error("Error writing LaunchServer runtime config file. Gson is null");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,8 +28,8 @@ public final class PostgreSQLSourceConfig implements AutoCloseable, SQLSourceCon
|
||||||
private String database;
|
private String database;
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
private DataSource source;
|
private transient DataSource source;
|
||||||
private boolean hikari;
|
private transient boolean hikari;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
|
|
|
@ -238,7 +238,7 @@ public void close() throws IOException {
|
||||||
getSQLConfig().close();
|
getSQLConfig().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLUser constructUser(ResultSet set) throws SQLException {
|
protected SQLUser constructUser(ResultSet set) throws SQLException {
|
||||||
return set.next() ? new SQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
|
return set.next() ? new SQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
|
||||||
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn))) : null;
|
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn))) : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ public void init(LaunchServer server) {
|
||||||
sqlUpdateUsers = String.format("UPDATE %s SET `%s` = ? WHERE `%s` = ?", table, hardwareIdColumn, uuidColumn);
|
sqlUpdateUsers = String.format("UPDATE %s SET `%s` = ? WHERE `%s` = ?", table, hardwareIdColumn, uuidColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MySQLUser constructUser(ResultSet set) throws SQLException {
|
@Override
|
||||||
|
protected MySQLUser constructUser(ResultSet set) throws SQLException {
|
||||||
return set.next() ? new MySQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
|
return set.next() ? new MySQLUser(UUID.fromString(set.getString(uuidColumn)), set.getString(usernameColumn),
|
||||||
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn)), set.getLong(hardwareIdColumn)) : null;
|
set.getString(accessTokenColumn), set.getString(serverIDColumn), set.getString(passwordColumn), requestPermissions(set.getString(uuidColumn)), set.getLong(hardwareIdColumn)) : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
} else {
|
} else {
|
||||||
try (Reader reader = IOHelper.newReader(configPath)) {
|
try (Reader reader = IOHelper.newReader(configPath)) {
|
||||||
targetConfig = Launcher.gsonManager.configGson.fromJson(reader, clazz);
|
targetConfig = Launcher.gsonManager.configGson.fromJson(reader, clazz);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error when reading config {} in module {}: {}", configPath, file, e);
|
||||||
|
return super.visitFile(file, attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity.propertyMap == null) entity.propertyMap = new HashMap<>();
|
if (entity.propertyMap == null) entity.propertyMap = new HashMap<>();
|
||||||
|
|
|
@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
|
||||||
|
|
||||||
public static final int MAJOR = 5;
|
public static final int MAJOR = 5;
|
||||||
public static final int MINOR = 3;
|
public static final int MINOR = 3;
|
||||||
public static final int PATCH = 2;
|
public static final int PATCH = 3;
|
||||||
public static final int BUILD = 1;
|
public static final int BUILD = 1;
|
||||||
public static final Version.Type RELEASE = Type.STABLE;
|
public static final Version.Type RELEASE = Type.STABLE;
|
||||||
public final int major;
|
public final int major;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
id 'org.openjfx.javafxplugin' version '0.0.10' apply false
|
id 'org.openjfx.javafxplugin' version '0.0.10' apply false
|
||||||
}
|
}
|
||||||
group = 'pro.gravit.launcher'
|
group = 'pro.gravit.launcher'
|
||||||
version = '5.3.2'
|
version = '5.3.3'
|
||||||
|
|
||||||
apply from: 'props.gradle'
|
apply from: 'props.gradle'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue