Skip to content

Commit

Permalink
Various fixes, fix login problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
The Judge committed Sep 15, 2024
1 parent 3657d9e commit 86f2ff7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/main/java/pojlib/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public static void login(Activity activity)
ConnectivityManager connManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkCapabilities capabilities = connManager.getNetworkCapabilities(connManager.getActiveNetwork());

boolean hasWifi = false;
boolean hasWifi = true;

if(capabilities != null) {
hasWifi = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/APIHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static <T> T postFullUrl(String url, HashMap<String, Object> query, T bod
return new Gson().fromJson(postRaw(url + parseQueries(query), body.toString()), tClass);
}

public static final String SUPPORTED_VERSIONS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/QuestCraft/supportedVersions.json";
public static final String SUPPORTED_VERSIONS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/Testing/supportedVersions.json";

public static String[] getQCSupportedVersions() {
File versionsJson = new File(Constants.USER_HOME + "/supportedVersions.json");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pojlib/InstanceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import pojlib.util.json.ModrinthIndexJson;

public class InstanceHandler {
public static final String MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/QuestCraft/mods.json";
public static final String DEV_MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/QuestCraft/devmods.json";
public static final String MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/Testing/mods.json";
public static final String DEV_MODS = "https://raw.githubusercontent.com/QuestCraftPlusPlus/Pojlib/Testing/devmods.json";

public static MinecraftInstances.Instance create(Activity activity, MinecraftInstances instances, String instanceName, String userHome, ModLoader modLoader, String mrpackFilePath, String imageURL) {
File mrpackJson = new File(Constants.USER_HOME + "/instances/" + instanceName.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "/setup/modrinth.index.json");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/account/MinecraftAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MinecraftAccount {

public static MinecraftAccount login(String gameDir, String[] response) throws IOException, JSONException {
String mcToken = Msa.acquireXBLToken(response[0]);
Msa instance = new Msa(false, mcToken);
Msa instance = new Msa();
MinecraftAccount account = instance.performLogin(mcToken);
account.expiresIn = Long.parseLong(response[1]);

Expand Down
11 changes: 1 addition & 10 deletions src/main/java/pojlib/account/Msa.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@


public class Msa {

private final boolean mIsRefresh;
private final String mAuthCode;
private static final Map<Long, String> XSTS_ERRORS;
static {
XSTS_ERRORS = new ArrayMap<>();
Expand All @@ -46,18 +43,12 @@ public class Msa {
}

/* Fields used to fill the account */
public String msRefreshToken;
public static String mcName;
public String mcToken;
public static String mcUuid;
public static boolean doesOwnGame;
public long expiresAt;

public Msa(boolean isRefresh, String authCode){
mIsRefresh = isRefresh;
mAuthCode = authCode;
}

/** Performs a full login, calling back listeners appropriately */
public MinecraftAccount performLogin(String xblToken) {
try {
Expand Down Expand Up @@ -178,9 +169,9 @@ private String acquireMinecraftToken(String xblUhs, String xblXsts) throws IOExc
}

if(conn.getResponseCode() >= 200 && conn.getResponseCode() < 300) {
expiresAt = System.currentTimeMillis() + 86400000;
JSONObject jo = new JSONObject(FileUtil.read(conn.getInputStream()));
conn.disconnect();
expiresAt = System.currentTimeMillis() + (jo.getInt("expires_in") * 1000L);
mcToken = jo.getString("access_token");
return jo.getString("access_token");
}else{
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/pojlib/util/JREUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ public static void initJavaRuntime() {
dlopen(findInLdLibPath("libawt_headless.so"));
dlopen(findInLdLibPath("libfreetype.so"));
dlopen(findInLdLibPath("libfontmanager.so"));
dlopen(findInLdLibPath("libsqlitejdbc.so"));
for(File f : locateLibs(new File(runtimeDir + "/lib"))) {
dlopen(f.getAbsolutePath());
}
dlopen(sNativeLibDir + "/libopenal.so");
dlopen(sNativeLibDir + "/libopuscodec.so");
}

public static void redirectAndPrintJRELog() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/jniLibs/arm64-v8a/libtinywrapper.so
Git LFS file not shown

0 comments on commit 86f2ff7

Please sign in to comment.