Skip to content

Commit b50e7be

Browse files
committed
Update launch method (may still not work) add try catch around unity index check
1 parent f3aa630 commit b50e7be

7 files changed

Lines changed: 45 additions & 17 deletions

File tree

QuestAppVersionSwitcher/Assets/html/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<div style="font-size: 80%; width: 100%;">
1414
Managing <div class="inline packageName">some game</div>
1515
</div>
16+
<div class="button" style="margin-top: 5px;" onclick="LaunchApp()">Launch Game</div>
1617
</div>
1718
<div class="menuItem selected" section="backup">Backup</div>
1819
<div class="menuItem" section="downgrade">Downgrade

QuestAppVersionSwitcher/Assets/html/script.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,12 @@ function CheckStartParams() {
797797
GotoStep(18)
798798
document.getElementById("loginerror").innerText = params.get("loginerror")
799799
}
800+
801+
if(params.get("loginsuccess")) {
802+
alert("logged in")
803+
location = location.href.split('?')[0]
804+
return
805+
}
800806

801807
if(params.get("token")) {
802808
//OpenTokenPasswordPopup()

QuestAppVersionSwitcher/PatchingManager.cs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,25 +189,37 @@ public static void PatchAPK(ApkZip apkArchive, string appLocation, bool forcePat
189189
public static bool AttemptDownloadUnstrippedUnity(string version)
190190
{
191191
Logger.Log("Checking index for unstrippedUnity");
192-
WebClient c = new WebClient();
193-
string libUnityIndexString = c.DownloadString("https://raw.githubusercontent.com/Lauriethefish/QuestUnstrippedUnity/main/index.json");
194-
Dictionary<string, Dictionary<string, string>> index = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, string>>>(libUnityIndexString);
195-
string appId = CoreService.coreVars.currentApp;
196-
if (index.ContainsKey(appId))
192+
try
197193
{
198-
if (index[appId].ContainsKey(version))
194+
WebClient c = new WebClient();
195+
string libUnityIndexString =
196+
c.DownloadString(
197+
"https://raw.githubusercontent.com/Lauriethefish/QuestUnstrippedUnity/main/index.json");
198+
Dictionary<string, Dictionary<string, string>> index =
199+
JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, string>>>(libUnityIndexString);
200+
string appId = CoreService.coreVars.currentApp;
201+
if (index.ContainsKey(appId))
199202
{
200-
c.DownloadFile("https://raw.githubusercontent.com/Lauriethefish/QuestUnstrippedUnity/main/versions/" + index[appId][version] + ".so", CoreService.coreVars.QAVSTmpPatchingDir + "libunity.so");
201-
return true;
203+
if (index[appId].ContainsKey(version))
204+
{
205+
c.DownloadFile(
206+
"https://raw.githubusercontent.com/Lauriethefish/QuestUnstrippedUnity/main/versions/" +
207+
index[appId][version] + ".so", CoreService.coreVars.QAVSTmpPatchingDir + "libunity.so");
208+
return true;
209+
}
210+
else
211+
{
212+
Logger.Log("No unstripped libunity found. It does exist for another version of the app");
213+
}
202214
}
203215
else
204216
{
205-
Logger.Log("No unstripped libunity found. It does exist for another version of the app");
217+
Logger.Log("No unstripped libunity found.", LoggingType.Warning);
206218
}
207219
}
208-
else
220+
catch (Exception e)
209221
{
210-
Logger.Log("No unstripped libunity found.", LoggingType.Warning);
222+
Logger.Log("Failed to check index for unstripped libunity: " + e, LoggingType.Warning);
211223
}
212224
return false;
213225
}

QuestAppVersionSwitcher/Properties/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.15.6" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="127">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.15.7" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="128">
33
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="32" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />

QuestAppVersionSwitcher/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
// Minor Version
2323
// Build Number
2424
// Revision
25-
[assembly: AssemblyVersion("1.15.6.0")]
26-
[assembly: AssemblyFileVersion("1.15.6.0")]
25+
[assembly: AssemblyVersion("1.15.7.0")]
26+
[assembly: AssemblyFileVersion("1.15.7.0")]

QuestAppVersionSwitcher/QAVSWebViewClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest
135135
try
136136
{
137137
string token = QAVSWebserver.loginClient.UriCallback(request.Url.ToString());
138-
view.LoadUrl("http://127.0.0.1:" + CoreService.coreVars.serverPort + "?token=" + token);
138+
QAVSWebserver.SaveToken(token);
139+
view.LoadUrl("http://127.0.0.1:" + CoreService.coreVars.serverPort + "?loginsuccess=true");
139140
}
140141
catch (Exception e)
141142
{

QuestAppVersionSwitcher/WebServer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ public static void BroadcastUIConfig()
137137
public static BackupStatus backupStatus = new BackupStatus();
138138
public static LoginClient loginClient = new LoginClient();
139139

140+
public static void SaveToken(string token)
141+
{
142+
string password = AndroidService.GetDeviceID();
143+
CoreService.coreVars.token = PasswordEncryption.Encrypt(token, password);
144+
CoreService.coreVars.password = GetSHA256OfString(password);
145+
CoreService.coreVars.Save();
146+
}
147+
140148
public void Start()
141149
{
142150
wsServer.OnMessage = (socket, msg) =>
@@ -551,13 +559,13 @@ public void Start()
551559
});
552560
server.AddRoute("GET", "/api/android/installedappsandbackups", serverRequest =>
553561
{
554-
List<App> apps = AndroidService.GetInstalledApps();
562+
List<AndroidApp> apps = AndroidService.GetInstalledApps();
555563

556564
foreach (string f in Directory.GetDirectories(CoreService.coreVars.QAVSBackupDir))
557565
{
558566
if (apps.FirstOrDefault(x => x.PackageName == Path.GetFileName(f)) == null)
559567
{
560-
apps.Add(new App("unknown", Path.GetFileName(f)));
568+
apps.Add(new AndroidApp("unknown", Path.GetFileName(f)));
561569
}
562570
}
563571
serverRequest.SendString(JsonSerializer.Serialize(apps), "application/json");

0 commit comments

Comments
 (0)