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 22
33declare (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+
521return [
622
723 /*
Original file line number Diff line number Diff line change 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 ? >
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 ;
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 ? >
You can’t perform that action at this time.
0 commit comments