File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
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
+
5
21
return [
6
22
7
23
/*
Original file line number Diff line number Diff line change 12
12
// Requests current version from the local version file and sets it as variable
13
13
$Vlocal = ' v' . file_get_contents (base_path (" version.json" ));
14
14
? >
15
- @if (auth ()-> user ()-> role == ' admin' and $Vgit > $Vlocal )
15
+ @if (auth ()-> user ()-> role == ' admin' and $Vgit > $Vlocal or env ( ' JOIN_BETA ' ) === true )
16
16
17
17
@if ($_SERVER [' QUERY_STRING' ] === ' ' )
18
18
<?php // landing page ? >
26
26
<h4 class =" " >The updater only works on Linux based systems.</h4 >
27
27
<a class =" btn" href =" https://littlelink-custom.com/update" ><button style =" " ><i class =" fa-solid fa-download btn" ></i > Update manually</button ></a >
28
28
@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
29
34
<h4 class =" " >You can update your installation automatically or download the update and install it manually:</h4 >
35
+ @endif
30
36
<br ><div class =" row" >
31
37
&ensp ; <a class =" btn" href =" {{ url ()-> current ()} } /?backup" ><button style =" " ><i class =" fa-solid fa-user-gear btn" ></i > Update automatically</button ></a >&ensp ;
32
38
&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
88
<?php
83
89
84
90
// 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
86
93
87
94
echo " <meta http-equiv=\" refresh\" content=\" 0; " . url ()-> current () . " ?success\" />" ;
88
95
? >
You can’t perform that action at this time.
0 commit comments