Skip to content

Commit c21db40

Browse files
committed
Added beta support to updater
1 parent d414c1c commit c21db40

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

config/self-update.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
declare(strict_types=1);
44

5+
6+
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
7+
$json = file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest") ;
8+
$myObj = json_decode($json);
9+
$Vgit = $myObj->tag_name;
10+
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
11+
12+
13+
if ($Vgit > $Vlocal) {
14+
$userver = 'https://update.littlelink-custom.com/';
15+
} elseif (env('JOIN_BETA') === true) {
16+
$userver = 'https://update.littlelink-custom.com/beta/';
17+
} else {
18+
$userver = 'https://update.littlelink-custom.com/';
19+
}
20+
521
return [
622

723
/*

resources/views/update.blade.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// Requests current version from the local version file and sets it as variable
1313
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
1414
?>
15-
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal)
15+
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal or env('JOIN_BETA') === true)
1616

1717
@if($_SERVER['QUERY_STRING'] === '')
1818
<?php //landing page ?>
@@ -26,7 +26,13 @@
2626
<h4 class="">The updater only works on Linux based systems.</h4>
2727
<a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a>
2828
@else
29+
@if(env('JOIN_BETA') === true)
30+
<p><?php echo "latest beta version= " . file_get_contents("https://update.littlelink-custom.com/beta/vbeta.json"); ?></p>
31+
<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>
32+
<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>
33+
@else
2934
<h4 class="">You can update your installation automatically or download the update and install it manually:</h4>
35+
@endif
3036
<br><div class="row">
3137
&ensp;<a class="btn" href="{{url()->current()}}/?backup"><button style=""><i class="fa-solid fa-user-gear btn"></i> Update automatically</button></a>&ensp;
3238
&ensp;<a class="btn" href="https://littlelink-custom.com/update"><button style=""><i class="fa-solid fa-download btn"></i> Update manually</button></a>&ensp;
@@ -82,7 +88,8 @@
8288
<?php
8389
8490
//run before finishing:
85-
// EnvEditor::addKey('MY_VALUE', 'truefalse'); // Adds key to .env file
91+
if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */
92+
} else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file
8693
8794
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
8895
?>

0 commit comments

Comments
 (0)