Update update.blade.php

This commit is contained in:
Julian Prieber 2022-05-25 16:19:20 +02:00
parent 0987c092f1
commit 694ea93d51
1 changed files with 36 additions and 39 deletions

View File

@ -2,16 +2,32 @@
@Push('updater-body') @Push('updater-body')
@if($_SERVER['QUERY_STRING'] === 'updating' and (file_exists(base_path("backups/CANUPDATE"))))
<?php //updating... ?> <?php // Requests newest version from server and sets it as variable
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
$json = file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest") ;
$myObj = json_decode($json);
$Vgit = $myObj->tag_name;
// Requests current version from the local version file and sets it as variable
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
?>
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal)
@if($_SERVER['QUERY_STRING'] === '')
<?php //landing page ?>
<style>.logo-container{padding-top:23vh;}.logo-centered{top:37vh;}</style>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img loading" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style=""> <img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="">
<div class="logo-centered">l</div> <div class="logo-centered">l</div>
</div> </div>
<center><h1 class="loadingtxt">Updating</h1></center> <center><h1>Updater</h1>
@Push('updater-head') <h4 class="">You can update your installation automatically or download the update and install it manually:</h4>
<meta http-equiv="refresh" content="2; URL={{url()->current()}}/?updating-done" /> <br><div class="row">
@endpush &ensp;<button style=""><i class="fa-solid fa-user-gear btn"></i><a class="btn" href="{{url()->current()}}/?backup"> Update automatically</a></button>&ensp;
&ensp;<button style=""><i class="fa-solid fa-download btn"></i><a class="btn" href="https://littlelink-custom.com/how-to-update"> Update manually</a></button>&ensp;
</div>
</center>
@endif @endif
@if($_SERVER['QUERY_STRING'] === 'backup') @if($_SERVER['QUERY_STRING'] === 'backup')
@ -31,30 +47,28 @@
$tst = base_path('backups/'); $tst = base_path('backups/');
file_put_contents($tst.'CANUPDATE', ''); file_put_contents($tst.'CANUPDATE', '');
$URL = Route::current()->getName(); $URL = Route::current()->getName();
header("Location: ".$URL."?backup-created"); header("Location: ".$URL."?updating");
exit(); ?> exit(); ?>
@endif @endif
@if($_SERVER['QUERY_STRING'] === '') @if($_SERVER['QUERY_STRING'] === 'updating' and (file_exists(base_path("backups/CANUPDATE"))))
<?php //landing page ?> <?php //updating... ?>
<style>.logo-container{padding-top:23vh;}.logo-centered{top:37vh;}</style>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style=""> <img class="logo-img loading" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="">
<div class="logo-centered">l</div> <div class="logo-centered">l</div>
</div> </div>
<center><h1>Updater</h1> <center><h1 class="loadingtxt">Updating</h1></center>
<h4 class="">You can update your installation automatically or download the update and install it manually:</h4> @Push('updater-head')
<br><div class="row"> <meta http-equiv="refresh" content="2; URL={{url()->current()}}/../updating" />
&ensp;<button style=""><i class="fa-solid fa-user-gear btn"></i><a class="btn" href="{{url()->current()}}/?backup"> Update automatically</a></button>&ensp; @endpush
&ensp;<button style=""><i class="fa-solid fa-download btn"></i><a class="btn" href="https://littlelink-custom.com/how-to-update"> Update manually</a></button>&ensp; @endif
</div>
</center>
@endif @endif
@if($_SERVER['QUERY_STRING'] === 'success' and (file_exists(base_path("backups/CANUPDATE"))))
<?php //download backup ?> @if($_SERVER['QUERY_STRING'] === 'success')
<?php //success ?>
<style>.logo-container{padding-top:23vh;}.logo-centered{top:37vh;}</style> <style>.logo-container{padding-top:23vh;}.logo-centered{top:37vh;}</style>
<div class="logo-container fadein"> <div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style=""> <img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="">
@ -69,21 +83,4 @@ exit(); ?>
@endif @endif
@if($_SERVER['QUERY_STRING'] === 'error')
<?php //download backup ?>
<style>.logo-container{padding-top:23vh;}.logo-centered{top:37vh;}</style>
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo" style="">
<div class="logo-centered">l</div>
</div>
<center><h1>Something went wrong</h1>
<h4 class="">Something went wrong during the update process, you can try again or update manually:</h4>
<br><div class="row">
&ensp;<button style=""><i class="fa-solid fa-user-gear btn"></i><a class="btn" href="{{url()->current()}}/?backup"> Try again</a></button>&ensp;
&ensp;<button style=""><i class="fa-solid fa-download btn"></i><a class="btn" href="https://littlelink-custom.com/how-to-update"> Update manually</a></button>&ensp;
</div>
</center>
@endif
@endpush @endpush