Skip to content

Commit 9c99610

Browse files
ComputerEliteComputerElite
authored andcommitted
add get mods button to installed mods tab
1 parent d822c13 commit 9c99610

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

QuestAppVersionSwitcher/Assets/html/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ <h2>Patching options</h2>
8282
<b>Please note that mod installation is in early access and there may be issues. If you experience issues please report them on the OculusDB Discord Server at <code>discord.gg/zwRfHQN2UY</code></b>
8383
<div class="button topMargin" onclick="LaunchApp()">Launch Game</div>
8484
<div class="button topButtonMargin" id="installModButton" onclick="UploadMod()">Install a Mod from Disk</div>
85+
<div class="button topButtonMargin" onclick="OpenTab('getMods')">Get mods</div>
8586
<div id="operations">
8687
<h2 id="ongoingCount">Ongoing operations:</h2>
8788
<div class="loaderContainer" style="margin-bottom: 10px;">
@@ -123,8 +124,8 @@ <h2>Cosmetics type</h2>
123124
<div class="contentItem hidden" id="getMods">
124125
<h2>You can download mods and cosmetics from the following sites. Only QMods are supported by QuestAppVersionSwitcher + any cosmetics formats of the currently selected game</h2>
125126
<div style="display: flex; flex-direction: column;" class="buttonsContainer">
126-
<div class="button labelMargin" onclick="OpenSite(`https://computerelite.github.io/tools/Beat_Saber/questmods.html?version=${currentGameVersion}`)">Open Beat Saber Mods page</div>
127-
<div class="button labelMargin" onclick="OpenSite(`https://computerelite.github.io/tools/Oculus/QAVSHome.html?version=${currentGameVersion}`)">Open website hub</div>
127+
<div class="button labelMargin" onclick="OpenSite(`https://computerelite.github.io/tools/Beat_Saber/questmods.html?version=${currentGameVersion}&isqavs=true`)">Open Beat Saber Mods page</div>
128+
<div class="button labelMargin" onclick="OpenSite(`https://computerelite.github.io/tools/Oculus/QAVSHome.html?version=${currentGameVersion}&isqavs=true`)">Open website hub</div>
128129
<div class="button labelMargin" onclick="OpenSite(`https://www.google.com/search?q=computerelite`)">Open Google</div>
129130
</div>
130131
</div>

QuestAppVersionSwitcher/Assets/html/script.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,20 @@ document.getElementById("appListContainer").onclick = (event) => {
671671
setInterval(() => {
672672
Array.prototype.forEach.call(document.getElementsByClassName("menuItem"), i => {
673673
i.onclick = function () {
674-
Array.prototype.forEach.call(document.getElementsByClassName("menuItem"), e => {
675-
e.className = "menuItem" + (e.getAttribute("section") == this.getAttribute("section") ? " selected" : "")
676-
})
677-
Array.prototype.forEach.call(document.getElementsByClassName("contentItem"), e => {
678-
e.className = "contentItem" + (e.id == this.getAttribute("section") ? "" : " hidden")
679-
})
674+
OpenTab(this.getAttribute("section"))
680675
}
681676
})
682677
}, 500)
683678

679+
function OpenTab(section) {
680+
Array.prototype.forEach.call(document.getElementsByClassName("menuItem"), e => {
681+
e.className = "menuItem" + (e.getAttribute("section") == section ? " selected" : "")
682+
})
683+
Array.prototype.forEach.call(document.getElementsByClassName("contentItem"), e => {
684+
e.className = "contentItem" + (e.id == section ? "" : " hidden")
685+
})
686+
}
687+
684688

685689
var backupInProgress = false
686690

@@ -803,7 +807,7 @@ document.getElementById("install").onclick = () => {
803807
if(j.isPatchedApk) {
804808
GotoStep("4.2")
805809
} else {
806-
if (j.containsAppData) {
810+
if (j.containsAppData || j.containsObbs) {
807811
GotoStep(4)
808812
} else {
809813
GotoStep(5)
@@ -831,7 +835,7 @@ document.getElementById("grantManageAccess").onclick = () => {
831835
if (j.success) {
832836
fetch("/api/backupinfo?package=" + config.currentApp + "&backupname=" + selectedBackup).then(res => {
833837
res.json().then(j => {
834-
if (j.containsAppData) {
838+
if (j.containsAppData || j.containsObbs) {
835839
GotoStep(4)
836840
} else {
837841
GotoStep(5)
@@ -862,7 +866,7 @@ document.getElementById("grantAccess").onclick = () => {
862866
if(j.isPatchedApk) {
863867
GotoStep("4.2")
864868
} else {
865-
if (j.containsAppData) {
869+
if (j.containsAppData || j.containsObbs) {
866870
GotoStep(4)
867871
} else {
868872
GotoStep(5)

QuestAppVersionSwitcher/ClientModels.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public class About
4747

4848
public enum BackupInfoVersion
4949
{
50-
V1
50+
V1,
51+
V2
5152
}
5253

5354
public class BackupList

QuestAppVersionSwitcher/WebServer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,12 +1207,13 @@ public BackupInfo GetBackupInfo(string path, bool loadAnyway = false)
12071207
if (File.Exists(pathWithoutSlash + "/info.json") && !loadAnyway)
12081208
{
12091209
info = JsonSerializer.Deserialize<BackupInfo>(File.ReadAllText(pathWithoutSlash + "/info.json"));
1210-
if (info.BackupInfoVersion < BackupInfoVersion.V1) return GetBackupInfo(path, true);
1210+
if (info.BackupInfoVersion < BackupInfoVersion.V2) return GetBackupInfo(path, true);
12111211
return info;
12121212
}
12131213

12141214
info.backupName = Path.GetFileName(pathWithoutSlash);
12151215
info.containsAppData = Directory.Exists(pathWithoutSlash + "/" + Directory.GetParent(pathWithoutSlash).Name);
1216+
info.containsObbs = Directory.Exists(pathWithoutSlash + "/obb/" + Directory.GetParent(pathWithoutSlash).Name);
12161217
info.backupLocation = path;
12171218
info.backupSize = FileManager.GetDirSize(pathWithoutSlash);
12181219
info.backupSizeString = SizeConverter.ByteSizeToString(info.backupSize);
@@ -1269,10 +1270,11 @@ public List<string> GetIPs()
12691270

12701271
public class BackupInfo
12711272
{
1272-
public BackupInfoVersion BackupInfoVersion { get; set; } = BackupInfoVersion.V1;
1273+
public BackupInfoVersion BackupInfoVersion { get; set; } = BackupInfoVersion.V2;
12731274
public string backupName { get; set; } = "";
12741275
public string backupLocation { get; set; } = "";
12751276
public bool containsAppData { get; set; } = false;
1277+
public bool containsObbs { get; set; } = false;
12761278
public bool isPatchedApk { get; set; } = false;
12771279
public bool containsApk { get; set; } = false;
12781280
public string gameVersion { get; set; } = "unknown";

0 commit comments

Comments
 (0)