|
18 | 18 | <img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo">
|
19 | 19 | <div class="logo-centered">l</div>
|
20 | 20 | </div>
|
21 |
| - <h1>Updater</h1> |
| 21 | + <h1>Windows Updater</h1> |
22 | 22 | @if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
|
23 |
| - <h4 class="">The updater only works on Linux based systems.</h4> |
24 |
| - <a class="btn" href="https://littlelink-custom.com/update"><button><i class="fa-solid fa-download btn"></i> Update manually</button></a> |
| 23 | + @if(env('JOIN_BETA') === true) |
| 24 | + <p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p> |
| 25 | + <p><?php if(file_exists(base_path("vbeta.json"))) {echo "Installed beta version= " . file_get_contents(base_path("vbeta.json"));} else {echo "Installed beta version= none";} ?></p> |
| 26 | + <p><?php if($Vgit > $Vlocal) {echo "You need to update to the latest mainline release";} else {echo "You're running the latest mainline release";} ?></p> |
| 27 | + @else |
| 28 | + <h4 class="">You can update your installation automatically or download the update and install it manually:</h4> |
| 29 | + <h5 class="">Windows users can use the alternative updater. This updater won't create a backup. Use at your own discretion.</h5> |
| 30 | + @endif |
| 31 | + <br><div class="row"> |
| 32 | +  <a class="btn" href="{{url()->current()}}/?updating-windows"><button><i class="fa-solid fa-user-gear btn"></i> Update automatically</button></a>  |
| 33 | +  <a class="btn" href="https://littlelink-custom.com/update" target="_blank"><button><i class="fa-solid fa-download btn"></i> Update manually</button></a>  |
| 34 | + </div> |
25 | 35 | @else
|
26 | 36 | @if(env('JOIN_BETA') === true)
|
27 | 37 | <p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
|
|
42 | 52 |
|
43 | 53 | @endif
|
44 | 54 |
|
| 55 | + |
| 56 | +@if($_SERVER['QUERY_STRING'] === 'updating-windows' and strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') |
| 57 | +<?php //updating on Windows ?> |
| 58 | + <div class="logo-container fadein"> |
| 59 | + <img class="logo-img loading" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo"> |
| 60 | + <div class="logo-centered">l</div> |
| 61 | + </div> |
| 62 | + <h1 class="loadingtxt">Updating</h1> |
| 63 | + @Push('updater-head') |
| 64 | + <meta http-equiv="refresh" content="2; URL={{url()->current()}}/?updating-windows-bat" /> |
| 65 | + @endpush |
| 66 | +@endif |
| 67 | + |
| 68 | +@if($_SERVER['QUERY_STRING'] === 'updating-windows-bat' and strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') |
| 69 | +<?php //updating on Windows ?> |
| 70 | +<?php |
| 71 | +
|
| 72 | +
|
| 73 | +// Download the zip file |
| 74 | +
|
| 75 | +$latestversion = trim(file_get_contents("https://raw.githubusercontent.com/JulianPrieber/littlelink-custom/main/version.json")); |
| 76 | +
|
| 77 | +if(env('JOIN_BETA') === true){ |
| 78 | + $fileUrl = 'https://update.littlelink-custom.com/beta/'. $latestversion . '.zip'; |
| 79 | +} else { |
| 80 | + $fileUrl = 'https://update.littlelink-custom.com/'. $latestversion . '.zip'; |
| 81 | +} |
| 82 | +
|
| 83 | +$curl = curl_init(); |
| 84 | +curl_setopt($curl, CURLOPT_URL, $fileUrl); |
| 85 | +curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
| 86 | +curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
| 87 | +$result = curl_exec($curl); |
| 88 | +curl_close($curl); |
| 89 | +
|
| 90 | +file_put_contents(base_path('storage/update.zip'), $result); |
| 91 | +
|
| 92 | +
|
| 93 | +$zip = new ZipArchive; |
| 94 | +$zip->open(base_path() . '/storage/update.zip'); |
| 95 | +$zip->extractTo(base_path()); |
| 96 | +$zip->close(); |
| 97 | +unlink(base_path() . '/storage/update.zip'); |
| 98 | +
|
| 99 | +echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "/?finishing\" />"; |
| 100 | +
|
| 101 | +?> |
| 102 | + |
| 103 | + |
| 104 | +@endif |
| 105 | + |
45 | 106 | @if($_SERVER['QUERY_STRING'] === 'backup')
|
46 | 107 | <?php //creating backup... ?>
|
47 | 108 | @Push('updater-head')
|
|
0 commit comments