@@ -162,7 +162,7 @@ function setAppVersion(arch, version) {
162
162
/**
163
163
* @param {boolean } isRooted
164
164
*/
165
- function getAppVersions ( isRooted ) {
165
+ function getAppVersions ( isRooted , page = 1 ) {
166
166
document . getElementsByTagName ( 'header' ) [ 0 ] . innerHTML = `
167
167
<h1><i class="fa-solid fa-file-arrow-down"></i>Select the version you want to download</h1>
168
168
<span>Versions marked as beta might have bugs or can be unstable, unless marked as recommended<span>
@@ -181,7 +181,9 @@ function getAppVersions(isRooted) {
181
181
backButton . innerHTML = 'Back' ;
182
182
backButton . onclick = ( ) => history . back ( ) ;
183
183
184
- sendCommand ( { event : 'getAppVersion' , checkVer : true } ) ;
184
+ if ( page < 1 ) page = 1 ;
185
+
186
+ sendCommand ( { event : 'getAppVersion' , checkVer : true , page } ) ;
185
187
}
186
188
187
189
function buildReVanced ( ) {
@@ -370,6 +372,21 @@ ws.onmessage = (msg) => {
370
372
const len = message . versionList . length ;
371
373
372
374
const versionsElement = document . getElementById ( 'versions' ) ;
375
+ versionsElement . innerHTML = '' ;
376
+
377
+ versionsElement . innerHTML += `
378
+ <li>
379
+ ${
380
+ message . page != 1
381
+ ? `<button id="prevPage" onclick="getAppVersions(${
382
+ message . isRooted
383
+ } , ${ message . page - 1 } )">Previous Page</button>`
384
+ : ''
385
+ }
386
+ <button id="nextPage" onclick="getAppVersions(${ message . isRooted } , ${
387
+ message . page + 1
388
+ } )">Next Page</button>
389
+ </li>` ;
373
390
374
391
for ( let i = 0 ; i < len ; i ++ ) {
375
392
const version = message . versionList [ i ] ;
@@ -422,36 +439,38 @@ ws.onmessage = (msg) => {
422
439
} ;
423
440
}
424
441
break ;
425
- case 'installingStockApp' : {
426
- if ( message . status === 'DOWNLOAD_STARTED' ) {
427
- document . getElementsByTagName ( 'header' ) [ 0 ] . innerHTML =
428
- '<h1><i class="fa-solid fa-download"></i>Downloading APK</h1>' ;
429
- document . getElementById ( 'content' ) . innerHTML =
430
- '<span class="log"></span>' ;
431
- document . getElementsByTagName ( 'main' ) [ 0 ] . innerHTML +=
432
- '<progress value="0"></progress>' ;
433
- isDownloading = true ;
434
- document . getElementById ( 'continue' ) . classList . add ( 'disabled' ) ;
435
- } else if ( message . status === 'DOWNLOAD_COMPLETE' ) {
436
- document . getElementById ( 'continue' ) . classList . add ( 'disabled' ) ;
437
- isDownloading = false ;
438
- document . getElementsByClassName (
439
- 'log'
440
- ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Uninstalling the stock app...</span><br>` ;
441
- } else if ( message . status === 'UNINSTALL_COMPLETE' ) {
442
- document . getElementsByClassName (
443
- 'log'
444
- ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Installing the downloaded (stock) APK...</span><br>` ;
445
- } else if ( message . status === 'ALL_DONE' ) {
446
- document . getElementsByClassName (
447
- 'log'
448
- ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Complete.</span><br>` ;
449
- document . getElementById ( 'continue' ) . classList . remove ( 'disabled' ) ;
450
- document . getElementById ( 'continue' ) . onclick = ( ) => {
451
- location . href = '/patch' ;
452
- } ;
442
+ case 'installingStockApp' :
443
+ {
444
+ if ( message . status === 'DOWNLOAD_STARTED' ) {
445
+ document . getElementsByTagName ( 'header' ) [ 0 ] . innerHTML =
446
+ '<h1><i class="fa-solid fa-download"></i>Downloading APK</h1>' ;
447
+ document . getElementById ( 'content' ) . innerHTML =
448
+ '<span class="log"></span>' ;
449
+ document . getElementsByTagName ( 'main' ) [ 0 ] . innerHTML +=
450
+ '<progress value="0"></progress>' ;
451
+ isDownloading = true ;
452
+ document . getElementById ( 'continue' ) . classList . add ( 'disabled' ) ;
453
+ } else if ( message . status === 'DOWNLOAD_COMPLETE' ) {
454
+ document . getElementById ( 'continue' ) . classList . add ( 'disabled' ) ;
455
+ isDownloading = false ;
456
+ document . getElementsByClassName (
457
+ 'log'
458
+ ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Uninstalling the stock app...</span><br>` ;
459
+ } else if ( message . status === 'UNINSTALL_COMPLETE' ) {
460
+ document . getElementsByClassName (
461
+ 'log'
462
+ ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Installing the downloaded (stock) APK...</span><br>` ;
463
+ } else if ( message . status === 'ALL_DONE' ) {
464
+ document . getElementsByClassName (
465
+ 'log'
466
+ ) [ 0 ] . innerHTML += `<span class="log-line info"><strong>[builder]</strong> Complete.</span><br>` ;
467
+ document . getElementById ( 'continue' ) . classList . remove ( 'disabled' ) ;
468
+ document . getElementById ( 'continue' ) . onclick = ( ) => {
469
+ location . href = '/patch' ;
470
+ } ;
471
+ }
453
472
}
454
- }
473
+ break ;
455
474
case 'patchLog' :
456
475
{
457
476
const logLevel = message . log . includes ( 'WARNING' )
@@ -553,25 +572,26 @@ ws.onmessage = (msg) => {
553
572
}
554
573
break ;
555
574
}
556
- case 'askRootVersion' : {
557
- const confirmVer = confirm (
558
- `**Non Recommended Version**\nYour device has a non recommended version. This means you have to let the builder replace the stock YouTube with a recommended version.\nContinue?`
559
- ) ;
560
-
561
- if ( confirmVer )
562
- return sendCommand ( {
563
- event : 'getAppVersion' ,
564
- installLatestRecommended : true
565
- } ) ;
566
- else {
567
- if ( confirm ( 'Alright, proceed with the non-recommended version?' ) )
575
+ case 'askRootVersion' :
576
+ {
577
+ const confirmVer = confirm (
578
+ `**Non Recommended Version**\nYour device has a non recommended version. This means you have to let the builder replace the stock YouTube with a recommended version.\nContinue?`
579
+ ) ;
580
+
581
+ if ( confirmVer )
568
582
return sendCommand ( {
569
583
event : 'getAppVersion' ,
570
- useVer : true
584
+ installLatestRecommended : true
571
585
} ) ;
586
+ else {
587
+ if ( confirm ( 'Alright, proceed with the non-recommended version?' ) )
588
+ return sendCommand ( {
589
+ event : 'getAppVersion' ,
590
+ useVer : true
591
+ } ) ;
592
+ }
572
593
}
573
- }
574
-
594
+ break ;
575
595
case 'appList' : {
576
596
let id = 0 ;
577
597
for ( const app of message . list ) {
0 commit comments