Pass launcher.server system property from Bootstrap to JFXLauncher
This commit is contained in:
@@ -182,9 +182,17 @@ public class Bootstrap {
|
||||
"-Dfile.encoding=UTF-8",
|
||||
"-Dsun.stdout.encoding=UTF-8",
|
||||
"-Dsun.stderr.encoding=UTF-8",
|
||||
"-Dlauncher.server=" + BASE_URL,
|
||||
"--module-path", javafxPath.toAbsolutePath().toString(),
|
||||
"--add-modules", "javafx.controls,javafx.web"
|
||||
);
|
||||
} else {
|
||||
jvmArgs = List.of(
|
||||
"-Dfile.encoding=UTF-8",
|
||||
"-Dsun.stdout.encoding=UTF-8",
|
||||
"-Dsun.stderr.encoding=UTF-8",
|
||||
"-Dlauncher.server=" + BASE_URL
|
||||
);
|
||||
}
|
||||
|
||||
List<String> cmd = new ArrayList<>();
|
||||
@@ -215,7 +223,8 @@ public class Bootstrap {
|
||||
List<String> jvmArgs = List.of(
|
||||
"-Dfile.encoding=UTF-8",
|
||||
"-Dsun.stdout.encoding=UTF-8",
|
||||
"-Dsun.stderr.encoding=UTF-8"
|
||||
"-Dsun.stderr.encoding=UTF-8",
|
||||
"-Dlauncher.server=" + BASE_URL
|
||||
);
|
||||
|
||||
List<String> cmd = new ArrayList<>();
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.sun.net.httpserver.Headers;
|
||||
public class JFXLauncher extends Application {
|
||||
private static final int PORT = 8080;
|
||||
private static final String APP_TITLE = "ZernMC Launcher";
|
||||
private static final String LAUNCHER_SERVER = System.getProperty("launcher.server", "http://87.120.187.36:1582");
|
||||
private final LauncherAPI api = new LauncherAPI();
|
||||
private final Gson gson = new Gson();
|
||||
private HttpServer server;
|
||||
@@ -129,7 +130,7 @@ public class JFXLauncher extends Application {
|
||||
|
||||
private static String getServerVersion() {
|
||||
try {
|
||||
URL url = new URL("http://localhost:1582/launcher/version");
|
||||
URL url = new URL(LAUNCHER_SERVER + "/launcher/version");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(3000);
|
||||
conn.setReadTimeout(3000);
|
||||
@@ -155,7 +156,7 @@ public class JFXLauncher extends Application {
|
||||
|
||||
private static boolean downloadAssetsFromMeta(String version) {
|
||||
try {
|
||||
URL metaUrl = new URL("http://localhost:1582/launcher/meta/" + version);
|
||||
URL metaUrl = new URL(LAUNCHER_SERVER + "/launcher/meta/" + version);
|
||||
HttpURLConnection conn = (HttpURLConnection) metaUrl.openConnection();
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(10000);
|
||||
@@ -174,7 +175,7 @@ public class JFXLauncher extends Application {
|
||||
org.json.JSONObject file = (org.json.JSONObject) fileObj;
|
||||
String path = file.getString("path");
|
||||
if (path.startsWith("assets/")) {
|
||||
String downloadUrl = "http://localhost:1582/launcher/file/" + version + "/" + path;
|
||||
String downloadUrl = LAUNCHER_SERVER + "/launcher/file/" + version + "/" + path;
|
||||
Path outPath = assetsDir.resolve(path.substring(7));
|
||||
Files.createDirectories(outPath.getParent());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user