mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 22:37:06 -04:00
crash report uploading system & fix crashing when no version here.
This commit is contained in:
parent
70f0383b1d
commit
f63f888daf
@ -28,7 +28,7 @@ if (!hasProperty('mainClass')) {
|
|||||||
def buildnumber = System.getenv("BUILD_NUMBER") == null ? "" : "."+System.getenv("BUILD_NUMBER")
|
def buildnumber = System.getenv("BUILD_NUMBER") == null ? "" : "."+System.getenv("BUILD_NUMBER")
|
||||||
|
|
||||||
String mavenGroupId = 'HMCL'
|
String mavenGroupId = 'HMCL'
|
||||||
String mavenVersion = '2.3.3' + buildnumber
|
String mavenVersion = '2.3.4' + buildnumber
|
||||||
String bundleName = "Hello Minecraft! Launcher"
|
String bundleName = "Hello Minecraft! Launcher"
|
||||||
|
|
||||||
group = mavenGroupId
|
group = mavenGroupId
|
||||||
|
5565
HMCL/obfuscate_2.3.4.map
Normal file
5565
HMCL/obfuscate_2.3.4.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@ import java.net.PasswordAuthentication;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.Map;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.UnsupportedLookAndFeelException;
|
import javax.swing.UnsupportedLookAndFeelException;
|
||||||
@ -44,6 +45,7 @@ import org.jackhuang.hellominecraft.launcher.views.MainFrame;
|
|||||||
import org.jackhuang.hellominecraft.lookandfeel.HelloMinecraftLookAndFeel;
|
import org.jackhuang.hellominecraft.lookandfeel.HelloMinecraftLookAndFeel;
|
||||||
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||||
|
import org.jackhuang.hellominecraft.utils.system.OS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -52,7 +54,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils;
|
|||||||
public final class Main implements NonConsumer {
|
public final class Main implements NonConsumer {
|
||||||
|
|
||||||
public static String launcherName = "Hello Minecraft! Launcher";
|
public static String launcherName = "Hello Minecraft! Launcher";
|
||||||
public static byte firstVer = 2, secondVer = 3, thirdVer = 3;
|
public static byte firstVer = 2, secondVer = 3, thirdVer = 4;
|
||||||
public static int minimumLauncherVersion = 16;
|
public static int minimumLauncherVersion = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,17 +128,25 @@ public final class Main implements NonConsumer {
|
|||||||
public static void update() {
|
public static void update() {
|
||||||
if (MessageBox.Show(C.i18n("update.newest_version") + Settings.UPDATE_CHECKER.getNewVersion().firstVer + "." + Settings.UPDATE_CHECKER.getNewVersion().secondVer + "." + Settings.UPDATE_CHECKER.getNewVersion().thirdVer + "\n"
|
if (MessageBox.Show(C.i18n("update.newest_version") + Settings.UPDATE_CHECKER.getNewVersion().firstVer + "." + Settings.UPDATE_CHECKER.getNewVersion().secondVer + "." + Settings.UPDATE_CHECKER.getNewVersion().thirdVer + "\n"
|
||||||
+ C.i18n("update.should_open_link"),
|
+ C.i18n("update.should_open_link"),
|
||||||
MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
|
||||||
|
Map<String, String> map = Settings.UPDATE_CHECKER.download_link;
|
||||||
|
String url = C.URL_PUBLISH;
|
||||||
|
if (map != null)
|
||||||
|
if (map.containsKey(OS.os().checked_name))
|
||||||
|
url = map.get(OS.os().checked_name);
|
||||||
|
else if (map.containsKey(OS.UNKOWN.checked_name))
|
||||||
|
url = map.get(OS.UNKOWN.checked_name);
|
||||||
|
if (url == null) url = C.URL_PUBLISH;
|
||||||
try {
|
try {
|
||||||
java.awt.Desktop.getDesktop().browse(new URI(C.URL_PUBLISH));
|
java.awt.Desktop.getDesktop().browse(new URI(url));
|
||||||
} catch (URISyntaxException | IOException e) {
|
} catch (URISyntaxException | IOException e) {
|
||||||
HMCLog.warn("Failed to browse uri: " + C.URL_PUBLISH, e);
|
HMCLog.warn("Failed to browse uri: " + url, e);
|
||||||
|
|
||||||
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
|
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
cb.setContents(new StringSelection(C.URL_PUBLISH), null);
|
cb.setContents(new StringSelection(url), null);
|
||||||
MessageBox.Show(C.i18n("update.no_browser"));
|
MessageBox.Show(C.i18n("update.no_browser"));
|
||||||
}
|
}
|
||||||
else
|
} else
|
||||||
Settings.getInstance().setCheckUpdate(false);
|
Settings.getInstance().setCheckUpdate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +18,12 @@ package org.jackhuang.hellominecraft.launcher.utils;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.jackhuang.hellominecraft.HMCLog;
|
import org.jackhuang.hellominecraft.HMCLog;
|
||||||
import org.jackhuang.hellominecraft.launcher.Main;
|
import org.jackhuang.hellominecraft.launcher.Main;
|
||||||
import org.jackhuang.hellominecraft.launcher.launch.MinecraftCrashAdvicer;
|
import org.jackhuang.hellominecraft.launcher.launch.MinecraftCrashAdvicer;
|
||||||
|
import org.jackhuang.hellominecraft.utils.NetUtils;
|
||||||
import org.jackhuang.hellominecraft.utils.UpdateChecker;
|
import org.jackhuang.hellominecraft.utils.UpdateChecker;
|
||||||
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.utils.StrUtils;
|
import org.jackhuang.hellominecraft.utils.StrUtils;
|
||||||
@ -57,6 +59,8 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
|||||||
if (enableLogger) HMCLog.err(text);
|
if (enableLogger) HMCLog.err(text);
|
||||||
else System.out.println(text);
|
else System.out.println(text);
|
||||||
SwingUtilities.invokeLater(() -> LogWindow.instance.showAsCrashWindow(UpdateChecker.OUT_DATED));
|
SwingUtilities.invokeLater(() -> LogWindow.instance.showAsCrashWindow(UpdateChecker.OUT_DATED));
|
||||||
|
if (!UpdateChecker.OUT_DATED)
|
||||||
|
reportToServer(text);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
try {
|
try {
|
||||||
MessageBox.Show(e.getMessage() + "\n" + ex.getMessage(), "ERROR", MessageBox.ERROR_MESSAGE);
|
MessageBox.Show(e.getMessage() + "\n" + ex.getMessage(), "ERROR", MessageBox.ERROR_MESSAGE);
|
||||||
@ -67,4 +71,12 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reportToServer(String text) {
|
||||||
|
new Thread(() -> {
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("CrashReport", text);
|
||||||
|
System.out.println(NetUtils.post("http://huangyuhui.duapp.com/crash.php", map));
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import com.google.gson.JsonSyntaxException;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -222,6 +223,7 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModInfo> listMods() {
|
public List<ModInfo> listMods() {
|
||||||
|
if (profile.getSelectedMinecraftVersion() == null) return Arrays.asList();
|
||||||
File modsFolder = new File(getRunDirectory(profile.getSelectedMinecraftVersion().id), "mods");
|
File modsFolder = new File(getRunDirectory(profile.getSelectedMinecraftVersion().id), "mods");
|
||||||
ArrayList<ModInfo> mods = new ArrayList<>();
|
ArrayList<ModInfo> mods = new ArrayList<>();
|
||||||
Queue<File> queue = new LinkedList<>();
|
Queue<File> queue = new LinkedList<>();
|
||||||
@ -235,10 +237,9 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
|
|||||||
ModInfo m = ModInfo.readModInfo(f);
|
ModInfo m = ModInfo.readModInfo(f);
|
||||||
if (m != null)
|
if (m != null)
|
||||||
mods.add(m);
|
mods.add(m);
|
||||||
} else if(f.isDirectory()) {
|
} else if (f.isDirectory())
|
||||||
queue.add(f);
|
queue.add(f);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Collections.sort(mods);
|
Collections.sort(mods);
|
||||||
return mods;
|
return mods;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,6 @@ public final class NetUtils {
|
|||||||
}
|
}
|
||||||
sb = new StringBuilder(sb.substring(0, sb.length() - 1));
|
sb = new StringBuilder(sb.substring(0, sb.length() - 1));
|
||||||
}
|
}
|
||||||
System.out.println("send_url:" + url);
|
|
||||||
System.out.println("send_data:" + sb.toString());
|
|
||||||
try {
|
try {
|
||||||
u = new URL(url);
|
u = new URL(url);
|
||||||
con = (HttpURLConnection) u.openConnection();
|
con = (HttpURLConnection) u.openConnection();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hellominecraft.utils;
|
package org.jackhuang.hellominecraft.utils;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
import org.jackhuang.hellominecraft.utils.system.MessageBox;
|
||||||
import org.jackhuang.hellominecraft.C;
|
import org.jackhuang.hellominecraft.C;
|
||||||
import org.jackhuang.hellominecraft.utils.functions.NonConsumer;
|
import org.jackhuang.hellominecraft.utils.functions.NonConsumer;
|
||||||
@ -32,6 +33,7 @@ public final class UpdateChecker extends Thread {
|
|||||||
public String type;
|
public String type;
|
||||||
public boolean continueUpdate;
|
public boolean continueUpdate;
|
||||||
public NonConsumer dl;
|
public NonConsumer dl;
|
||||||
|
public Map<String, String> download_link;
|
||||||
|
|
||||||
public UpdateChecker(VersionNumber base, String type, boolean continueUpdate, NonConsumer dl) {
|
public UpdateChecker(VersionNumber base, String type, boolean continueUpdate, NonConsumer dl) {
|
||||||
super("UpdateChecker");
|
super("UpdateChecker");
|
||||||
@ -46,9 +48,9 @@ public final class UpdateChecker extends Thread {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
String url = "http://huangyuhui.duapp.com/info.php?type=" + type, version;
|
String version;
|
||||||
try {
|
try {
|
||||||
version = NetUtils.doGet(url);
|
version = NetUtils.doGet("http://huangyuhui.duapp.com/info.php?type=" + type);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
HMCLog.warn("Failed to get update url.", e);
|
HMCLog.warn("Failed to get update url.", e);
|
||||||
return;
|
return;
|
||||||
@ -57,6 +59,14 @@ public final class UpdateChecker extends Thread {
|
|||||||
if (!continueUpdate)
|
if (!continueUpdate)
|
||||||
return;
|
return;
|
||||||
process(false);
|
process(false);
|
||||||
|
if (OUT_DATED) {
|
||||||
|
try {
|
||||||
|
download_link = C.gson.fromJson(NetUtils.doGet("http://huangyuhui.duapp.com/update_link.php?type=" + type), Map.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
HMCLog.warn("Failed to get update link.", e);
|
||||||
|
}
|
||||||
|
dl.onDone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(boolean showMessage) {
|
public void process(boolean showMessage) {
|
||||||
@ -67,7 +77,6 @@ public final class UpdateChecker extends Thread {
|
|||||||
} else
|
} else
|
||||||
if (VersionNumber.isOlder(base, value)) {
|
if (VersionNumber.isOlder(base, value)) {
|
||||||
OUT_DATED = true;
|
OUT_DATED = true;
|
||||||
dl.onDone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,15 +25,17 @@ import org.jackhuang.hellominecraft.HMCLog;
|
|||||||
*/
|
*/
|
||||||
public enum OS {
|
public enum OS {
|
||||||
|
|
||||||
LINUX('/'),
|
LINUX('/', "linux"),
|
||||||
WINDOWS('\\'),
|
WINDOWS('\\', "windows"),
|
||||||
OSX('/'),
|
OSX('/', "osx"),
|
||||||
UNKOWN('/');
|
UNKOWN('/', "universal");
|
||||||
|
|
||||||
public final char fileSeparator;
|
public final char fileSeparator;
|
||||||
|
public final String checked_name;
|
||||||
|
|
||||||
private OS(char fileSeparator) {
|
private OS(char fileSeparator, String n) {
|
||||||
this.fileSeparator = fileSeparator;
|
this.fileSeparator = fileSeparator;
|
||||||
|
checked_name = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OS os() {
|
public static OS os() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user