@@ -47,7 +47,7 @@ function UpdatePatchingStatus() {
4747 document . getElementById ( "modsButton" ) . style . visibility = "hidden"
4848 }
4949
50- if ( ! IsOnQuest ( ) && ! res . isPatched ) {
50+ if ( ! IsOnQuest ( ) && ! res . isPatched && false ) {
5151 patchStatus . innerHTML = "<h2>To mod your game open QuestAppVersionSwitcher on your Quest</h2>"
5252 return ;
5353 }
@@ -63,6 +63,14 @@ var operationsOngoing = false
6363const operationsElement = document . getElementById ( "operations" )
6464const ongoingCount = document . getElementById ( "ongoingCount" )
6565const operationsList = document . getElementById ( "operationsList" )
66+
67+ const externalStorageCheckbox = document . getElementById ( "externalstorage" )
68+ const handTrackingCheckbox = document . getElementById ( "handtracking" )
69+ const handTrackingVersion = document . getElementById ( "handtrackingversion" )
70+ const debugCheckbox = document . getElementById ( "debug" )
71+ const otherContainer = document . getElementById ( "other" )
72+ var otherPermissions = [ ]
73+
6674function UpdateModsAndLibs ( ) {
6775 fetch ( `/mods/mods` ) . then ( res => {
6876 res . json ( ) . then ( res => {
@@ -154,42 +162,78 @@ function FormatMod(mod, active = true) {
154162 `
155163}
156164
165+ function AddPermission ( ) {
166+ otherPermissions . push ( document . getElementById ( "otherName" ) . value )
167+ document . getElementById ( "otherName" ) . value = ""
168+ UpdatePermissions ( )
169+ }
170+
171+ function UpdatePermissions ( ) {
172+ var perms = ""
173+ for ( const p of otherPermissions ) {
174+ perms += `
175+ <div style="padding: 10px; margin-right: 20px; border-radius: 5px; border: 1px #242424 solid;">
176+ ${ p }
177+ <div class="button" style="display: inline" onclick="RemovePermission('${ p } ')">X</div>
178+ </div>`
179+ }
180+ otherContainer . innerHTML = perms
181+ }
182+
183+ function RemovePermission ( name ) {
184+ otherPermissions = otherPermissions . filter ( a => a != name )
185+ UpdatePermissions ( )
186+ }
187+
157188var patchInProgress = false
158189var lastApp = ""
159190function PatchGame ( ) {
160191 patchInProgress = true
161- fetch ( "/patching/patchapk" ) . then ( res => {
162- res . text ( ) . then ( text => {
163- if ( res . status == 202 ) {
164- TextBoxText ( "patchingTextBox" , text )
165- patchStatus . innerHTML = `<h2>Patching game<br><br>${ squareLoader } </h2>`
166- var i = setInterval ( ( ) => {
167- fetch ( "/patching/patchstatus" ) . then ( res => {
168- res . json ( ) . then ( text => {
169- if ( res . status == 202 ) {
170- TextBoxText ( "patchingTextBox" , text . msg )
171- } else if ( res . status == 200 ) {
172- TextBoxGood ( "patchingTextBox" , text . msg )
173- clearInterval ( i )
174- patchInProgress = false
175- if ( text . value ) {
176- // patching returned a backup name to restore so restore the backup
177- selectedBackup = text . value
178- OpenRestorePopup ( ) ;
192+ var patchOptions = {
193+ otherPermissions : otherPermissions ,
194+ debug : debugCheckbox . checked ,
195+ handTracking : handTrackingCheckbox . checked ,
196+ handTrackingVersion : parseInt ( handTrackingVersion . value ) ,
197+ externalStorage : externalStorageCheckbox . checked
198+ }
199+ fetch ( `/patching/setpatchoptions?body=${ JSON . stringify ( patchOptions ) } ` ) . then ( res => {
200+ fetch ( "/patching/patchapk" ) . then ( res => {
201+ res . text ( ) . then ( text => {
202+ if ( res . status == 202 ) {
203+ TextBoxText ( "patchingTextBox" , text )
204+ patchStatus . innerHTML = `<h2>Patching game<br><br>${ squareLoader } </h2>`
205+ var i = setInterval ( ( ) => {
206+ fetch ( "/patching/patchstatus" ) . then ( res => {
207+ res . json ( ) . then ( text => {
208+ if ( res . status == 202 ) {
209+ TextBoxText ( "patchingTextBox" , text . msg )
210+ } else if ( res . status == 200 ) {
211+ TextBoxGood ( "patchingTextBox" , text . msg )
212+ clearInterval ( i )
213+ patchInProgress = false
214+ if ( text . value ) {
215+ if ( ! IsOnQuest ( ) ) {
216+ alert ( "Restore the backup with patched in its name from within your Quest to finalize the patching process" )
217+ return
218+ }
219+ // patching returned a backup name to restore so restore the backup
220+ selectedBackup = text . value
221+ OpenRestorePopup ( ) ;
222+ }
223+ UpdateUI ( )
224+ } else {
225+ TextBoxError ( "patchingTextBox" , text . msg )
226+ clearInterval ( i )
227+ patchInProgress = false
228+ UpdateUI ( )
179229 }
180- UpdateUI ( )
181- } else {
182- TextBoxError ( "patchingTextBox" , text . msg )
183- clearInterval ( i )
184- patchInProgress = false
185- UpdateUI ( )
186- }
230+ } )
187231 } )
188- } )
189- } , 500 ) ;
190- } else {
191- TextBoxError ( "patchingTextBox" , text )
192- }
232+ } , 500 ) ;
233+ } else {
234+ TextBoxError ( "patchingTextBox" , text )
235+ }
236+ } )
193237 } )
194238 } )
195239}
0 commit comments