Added beta support to updater
This commit is contained in:
parent
d414c1c871
commit
c21db40809
|
@ -2,6 +2,22 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
|
||||||
|
|
||||||
|
|
||||||
|
if ($Vgit > $Vlocal) {
|
||||||
|
$userver = 'https://update.littlelink-custom.com/';
|
||||||
|
} elseif (env('JOIN_BETA') === true) {
|
||||||
|
$userver = 'https://update.littlelink-custom.com/beta/';
|
||||||
|
} else {
|
||||||
|
$userver = 'https://update.littlelink-custom.com/';
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// Requests current version from the local version file and sets it as variable
|
// Requests current version from the local version file and sets it as variable
|
||||||
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
|
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
|
||||||
?>
|
?>
|
||||||
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal)
|
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal or env('JOIN_BETA') === true)
|
||||||
|
|
||||||
@if($_SERVER['QUERY_STRING'] === '')
|
@if($_SERVER['QUERY_STRING'] === '')
|
||||||
<?php //landing page ?>
|
<?php //landing page ?>
|
||||||
|
@ -26,7 +26,13 @@
|
||||||
<h4 class="">The updater only works on Linux based systems.</h4>
|
<h4 class="">The updater only works on Linux based systems.</h4>
|
||||||
<a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a>
|
<a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a>
|
||||||
@else
|
@else
|
||||||
|
@if(env('JOIN_BETA') === true)
|
||||||
|
<p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
@else
|
||||||
<h4 class="">You can update your installation automatically or download the update and install it manually:</h4>
|
<h4 class="">You can update your installation automatically or download the update and install it manually:</h4>
|
||||||
|
@endif
|
||||||
<br><div class="row">
|
<br><div class="row">
|
||||||
 <a class="btn" href="{{url()->current()}}/?backup"><button style=""><i class="fa-solid fa-user-gear btn"></i> Update automatically</button></a> 
|
 <a class="btn" href="{{url()->current()}}/?backup"><button style=""><i class="fa-solid fa-user-gear btn"></i> Update automatically</button></a> 
|
||||||
 <a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a> 
|
 <a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a> 
|
||||||
|
@ -82,7 +88,8 @@ exit(); ?>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//run before finishing:
|
//run before finishing:
|
||||||
// EnvEditor::addKey('MY_VALUE', 'truefalse'); // Adds key to .env file
|
if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */
|
||||||
|
} else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file
|
||||||
|
|
||||||
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
|
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue