Skip to content

Commit f416d58

Browse files
author
ComputerElite
committed
Add login via facebook, add change port option, update downgrading to OculusDB
1 parent d60cc70 commit f416d58

12 files changed

Lines changed: 159 additions & 641 deletions

Assets/html/downgrade.html

Lines changed: 0 additions & 594 deletions
This file was deleted.

Assets/html/index.html

Lines changed: 94 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</div>
6161
</div>
6262
<div class="contentItem hidden" id="downgrade" style="padding: 0px;">
63-
<iframe src="downgrade.html" style="width: 100%; height: 100%; border: none; overflow-y: visible;"></iframe>
63+
<iframe src="https://oculusdb.rui2015.me/search?query=Beat+Saber&headsets=MONTEREY%2CHOLLYWOOD" style="width: 100%; height: 100%; border: none; overflow-y: visible;"></iframe>
6464
</div>
6565
<div class="contentItem hidden" id="download">
6666
<div id="progressBarContainers" style="width: 95%;">
@@ -88,18 +88,27 @@
8888
<div class="contentHeaderDescription">Set your token for downgrading games</div>
8989
</div>
9090
<div class="buttonContainer">
91-
<div>Oculus Token <a style="text-weight: bold;" href="https://computerelite.github.io/tools/Oculus/ObtainToken.html">Guide to get the token</a></div>
92-
<input type="password" placeholder="Token" id="token" class="buttonLabel" style="width: 600px;">
91+
<div class="button" id="login">Login</div>
92+
<div class="buttonLabel">Log in with your Oculus/Facebook account to downgrade games (<b>ONLY WORKS ON QUEST, NOT ON PC</b>)</div>
93+
</div>
94+
<div id="tokenTextBox" class="textBox"></div>
95+
</div>
96+
97+
<div class="space">
98+
<div class="contentHeader">
99+
Server control
100+
<div class="contentHeaderDescription">Configure the QuestAppVersionSwitcher WebServer</div>
93101
</div>
94102
<div class="buttonContainer">
95-
<div>Password for encryption (This password will encrypt your token. Make sure you've used it nowhere else)</div>
96-
<input type="password" placeholder="Password" id="password" class="buttonLabel" style="width: 600px;">
103+
<div class="button" id="exit">Exit</div>
104+
<div class="buttonLabel">Exists QuestAppVersionSwitcher</div>
97105
</div>
98106
<div class="buttonContainer">
99-
<div class="button" id="saveToken">Save Token</div>
100-
<div class="buttonLabel">Saves the token so you can downgrade games</div>
107+
<input type="number" placeholder="50001" id="port" class="buttonLabel" value="50001" style="width: 100px;">
108+
<div class="button" id="confirmPort">Change port</div>
109+
<div class="buttonLabel">Changes the WebServer port</div>
101110
</div>
102-
<div id="tokenTextBox" class="textBox"></div>
111+
<div id="serverTextBox" class="textBox"></div>
103112
</div>
104113

105114
<div class="space">
@@ -138,6 +147,22 @@
138147
</div>
139148
</div>
140149

150+
<div class="listContainer darken hidden" id="tokenPasswordContainer">
151+
<div class="restoreStep" id="step8">
152+
<div class="contentHeader headerMargin">
153+
Password needed
154+
</div>
155+
Please enter a password to encrypt your login information (token). You can change this password any time by simply pressing the login button again in the tools & options tab.
156+
<input type="password" id="passwordToken" placeholder="password">
157+
<div id="step8box" class="textBox"></div>
158+
<div class="buttonSelectionContainer">
159+
<div class="buttonContainer buttonMargin">
160+
<div class="button" id="tokenPassword">Confirm password</div>
161+
</div>
162+
</div>
163+
</div>
164+
</div>
165+
141166
<div class="listContainer darken hidden" id="deleteContainer">
142167
<div class="restoreStep" id="step6">
143168
<div class="contentHeader headerMargin">
@@ -246,6 +271,7 @@
246271
</div>
247272
<script>
248273
UpdateUI()
274+
const params = new URLSearchParams(window.location.search)
249275
var config = {}
250276
var selectedBackup = ""
251277

@@ -299,30 +325,12 @@
299325

300326
}
301327

302-
document.getElementById("saveToken").onclick = () => {
303-
if (!document.getElementById("token").value.startsWith("OC")) {
304-
TextBoxError("tokenTextBox", "Please copy your token again. It is not valid")
305-
return
306-
}
307-
if (document.getElementById("password").value.length < 8) {
308-
TextBoxError("tokenTextBox", "Password must be at least 8 characters long")
309-
return
310-
}
311-
fetch("/token", {
312-
method: "POST",
313-
body: JSON.stringify({
314-
token: document.getElementById("token").value,
315-
password: document.getElementById("password").value
316-
})
317-
}).then(res => {
318-
res.text().then(text => {
319-
if(res.status == 200) {
320-
TextBoxGood("tokenTextBox", text)
321-
} else {
322-
TextBoxError("tokenTextBox", text)
323-
}
324-
})
325-
})
328+
if(params.get("token")) {
329+
OpenTokenPasswordPopup()
330+
}
331+
332+
document.getElementById("login").onclick = () => {
333+
location = "https://auth.oculus.com/login/?redirect_uri=https%3A%2F%2Fwww.oculus.com%2Fexperiences%2Fquest%2F"
326334
}
327335

328336
setInterval(() => {
@@ -381,6 +389,26 @@
381389
UpdateUI(true)
382390
}
383391

392+
document.getElementById("exit").onclick = () => {
393+
fetch("questappversionswitcher/kill", {
394+
method: "POST"
395+
})
396+
}
397+
document.getElementById("confirmPort").onclick = () => {
398+
fetch("questappversionswitcher/changeport", {
399+
method: "POST",
400+
body: document.getElementById("port").value
401+
}).then(res => {
402+
res.text().then(text => {
403+
if(res.status == 200) {
404+
TextBoxGood("serverTextBox", text)
405+
} else {
406+
TextBoxError("serverTextBox", text)
407+
}
408+
})
409+
})
410+
}
411+
384412
document.getElementById("appListContainer").onclick = (event) => {
385413
if (event.target.id == 'appListContainer') UpdateUI(true)
386414
}
@@ -590,6 +618,16 @@
590618
document.getElementById("deleteContainer").className = "listContainer darken"
591619
}
592620

621+
function CloseTokenPasswordPopup() {
622+
document.getElementById("tokenPasswordContainer").className = "listContainer darken hidden"
623+
GotoStep(8)
624+
}
625+
626+
function OpenTokenPasswordPopup() {
627+
CloseTokenPasswordPopup()
628+
document.getElementById("tokenPasswordContainer").className = "listContainer darken"
629+
}
630+
593631
function CloseGetPasswordPopup() {
594632
document.getElementById("getPasswordContainer").className = "listContainer darken hidden"
595633
HideTextBox("step7box")
@@ -610,6 +648,7 @@
610648
}
611649
document.getElementById("confirmPassword").onclick = () => {
612650
options.password = document.getElementById("passwordConfirm").value
651+
options.app = options.parentName
613652
fetch("/download", {
614653
method: "POST",
615654
body: JSON.stringify(options)
@@ -627,6 +666,29 @@
627666
})
628667
}
629668

669+
document.getElementById("tokenPassword").onclick = () => {
670+
options.password = document.getElementById("passwordConfirm").value
671+
options.app = options.parentName
672+
fetch("/token", {
673+
method: "POST",
674+
body: JSON.stringify({
675+
token: params.get("token"),
676+
password: document.getElementById("passwordToken").value
677+
})
678+
}).then(res => {
679+
res.text().then(text => {
680+
if (res.status == 403) {
681+
TextBoxError("step8box", text)
682+
} else if (res.status == 200) {
683+
TextBoxGood("step8box", text)
684+
setTimeout(() => {
685+
CloseGetPasswordPopup()
686+
}, 5000)
687+
}
688+
})
689+
})
690+
}
691+
630692
document.getElementById("delete").onclick = () => {
631693
CloseDeletePopup()
632694
TextBoxText("restoreTextBox", "Deleting Backup. Please wait.")

ClientModels.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class TokenRequest
4242

4343
public class DownloadRequest
4444
{
45-
public long binaryId { get; set; } = 0;
45+
public string binaryId { get; set; } = "";
4646
public string password { get; set; } = "";
4747
public string version { get; set; } = "";
4848
public string app { get; set; } = "";

CoreService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public void Start()
4141
browser.Focusable = true;
4242
browser.Settings.MediaPlaybackRequiresUserGesture = false;
4343
browser.Settings.DomStorageEnabled = true;
44+
browser.Settings.UserAgentString = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.47";
4445
browser.Settings.DatabaseEnabled = true;
4546
browser.Settings.DatabasePath = "/data/data/" + browser.Context.PackageName + "/databases/";
4647
browser.Settings.LoadWithOverviewMode = true;
4748
browser.Settings.UseWideViewPort = true;
48-
4949
// Create all directories and files
5050
FileManager.CreateDirectoryIfNotExisting(coreVars.QAVSDir);
5151
FileManager.CreateDirectoryIfNotExisting(coreVars.QAVSBackupDir);

CoreVars.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace QuestAppVersionSwitcher.Core
66
public class CoreVars // aka config
77
{
88
public string currentApp { get; set; } = "";
9+
public int serverPort { get; set; } = 50001;
910
public string token { get; set; } = "";
1011
public string password { get; set; } = "";
1112
public readonly string QAVSDir = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/QuestAppVersionSwitcher/";

DownloadManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class DownloadManager : DownloadProgress
1717
public event DownloadFinished DownloadFinishedEvent;
1818
public string tmpPath = "";
1919

20-
public void StartDownload(long binaryid, string password, string version, string app)
20+
public void StartDownload(string binaryid, string password, string version, string app)
2121
{
2222
string decodedToken = PasswordEncryption.Decrypt(CoreService.coreVars.token, password);
2323
WebClient downloader = new WebClient();

Properties/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1.6" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="10">
3-
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="29" />
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="11">
3+
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="27" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
66
<uses-feature android:name="oculus.software.handtracking" android:required="false" />

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.1.6.0")]
26-
[assembly: AssemblyFileVersion("1.1.6.0")]
25+
[assembly: AssemblyVersion("1.2.0.0")]
26+
[assembly: AssemblyFileVersion("1.2.0.0")]

QuestAppVersionSwitcher.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@
132132
<PackageReference Include="System.IO.Compression">
133133
<Version>4.3.0</Version>
134134
</PackageReference>
135+
<PackageReference Include="System.Net.Http">
136+
<Version>4.3.4</Version>
137+
</PackageReference>
138+
<PackageReference Include="System.Net.Sockets">
139+
<Version>4.3.0</Version>
140+
</PackageReference>
135141
<PackageReference Include="System.Text.Json">
136142
<Version>6.0.1</Version>
137143
</PackageReference>
@@ -153,7 +159,6 @@
153159
</ItemGroup>
154160
<ItemGroup>
155161
<Content Include=".gitignore" />
156-
<AndroidAsset Include="Assets\html\downgrade.html" />
157162
</ItemGroup>
158163
<ItemGroup>
159164
<ProjectReference Include="..\..\ComputerUtils\ComputerUtils.Android\ComputerUtils.Android.csproj">
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<SelectedDevice>pixel_5_q_10_0_-_api_29</SelectedDevice>
5-
<ActiveDebugProfile>pixel_5_q_10_0_-_api_29</ActiveDebugProfile>
6-
<DefaultDevice>pixel_5_q_10_0_-_api_29</DefaultDevice>
4+
<SelectedDevice>Samsung SM-A202F</SelectedDevice>
5+
<ActiveDebugProfile>Samsung SM-A202F</ActiveDebugProfile>
6+
<DefaultDevice>q1</DefaultDevice>
77
<AndroidDesignerPreferredTheme>AppTheme</AndroidDesignerPreferredTheme>
88
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
9+
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
910
</PropertyGroup>
1011
</Project>

0 commit comments

Comments
 (0)