Many fixes to admin/trace/UUID system
This commit is contained in:
@@ -11,7 +11,6 @@ import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.ui.dialogs.FileChooser;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.util.OS;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
@@ -23,7 +22,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -113,7 +111,7 @@ public class DesktopPlatform extends Platform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getUUID() {
|
||||
public String getUUID() {
|
||||
try {
|
||||
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
|
||||
NetworkInterface out;
|
||||
@@ -123,22 +121,13 @@ public class DesktopPlatform extends Platform {
|
||||
byte[] result = new byte[8];
|
||||
System.arraycopy(bytes, 0, result, 0, bytes.length);
|
||||
|
||||
if(new String(Base64Coder.encode(result)).equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
||||
String str = new String(Base64Coder.encode(result));
|
||||
|
||||
return result;
|
||||
if(str.equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
||||
|
||||
return str;
|
||||
}catch (Exception e){
|
||||
Settings.defaults("uuid", "");
|
||||
|
||||
String uuid = Settings.getString("uuid");
|
||||
if(uuid.isEmpty()){
|
||||
byte[] result = new byte[8];
|
||||
new Random().nextBytes(result);
|
||||
uuid = new String(Base64Coder.encode(result));
|
||||
Settings.putString("uuid", uuid);
|
||||
Settings.save();
|
||||
return result;
|
||||
}
|
||||
return Base64Coder.decode(uuid);
|
||||
return super.getUUID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user