22
33@Push (' updater-body' )
44
5- @if ($_SERVER [' QUERY_STRING' ] === ' updating' and (file_exists (base_path (" backups/CANUPDATE" ))) )
6- <?php // updating... ? >
5+
6+ <?php // Requests newest version from server and sets it as variable
7+ ini_set (' user_agent' , ' Mozilla/4.0 (compatible; MSIE 6.0)' );
8+ $json = file_get_contents (" https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest" ) ;
9+ $myObj = json_decode ($json );
10+ $Vgit = $myObj -> tag_name ;
11+
12+ // Requests current version from the local version file and sets it as variable
13+ $Vlocal = ' v' . file_get_contents (base_path (" version.json" ));
14+ ? >
15+ @if (auth ()-> user ()-> role == ' admin' and $Vgit > $Vlocal )
16+
17+ @if ($_SERVER [' QUERY_STRING' ] === ' ' )
18+ <?php // landing page ? >
19+ <style >.logo-container {padding-top :23vh ;}.logo-centered {top :37vh ;} </style >
720 <div class =" logo-container fadein" >
8- <img class =" logo-img loading " src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
21+ <img class =" logo-img" src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
922 <div class =" logo-centered" >l</div >
1023 </div >
11- <center ><h1 class =" loadingtxt" >Updating</h1 ></center >
12- @Push (' updater-head' )
13- <meta http-equiv =" refresh" content =" 2; URL={{ url ()-> current ()} } /?updating-done" />
14- @endpush
24+ <center ><h1 >Updater</h1 >
25+ <h4 class =" " >You can update your installation automatically or download the update and install it manually:</h4 >
26+ <br ><div class =" row" >
27+ &ensp ; <button style =" " ><i class =" fa-solid fa-user-gear btn" ></i ><a class =" btn" href =" {{ url ()-> current ()} } /?backup" > Update automatically</a ></button >&ensp ;
28+ &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 ;
29+ </div >
30+ </center >
1531@endif
1632
1733@if ($_SERVER [' QUERY_STRING' ] === ' backup' )
3147$tst = base_path (' backups/' );
3248file_put_contents ($tst . ' CANUPDATE' , ' ' );
3349$URL = Route:: current ()-> getName ();
34- header (" Location: " . $URL . " ?backup-created " );
50+ header (" Location: " . $URL . " ?updating " );
3551exit (); ? >
36-
3752@endif
3853
39- @if ($_SERVER [' QUERY_STRING' ] === ' ' )
40- <?php // landing page ? >
41- <style >.logo-container {padding-top :23vh ;}.logo-centered {top :37vh ;} </style >
54+ @if ($_SERVER [' QUERY_STRING' ] === ' updating' and (file_exists (base_path (" backups/CANUPDATE" ))) )
55+ <?php // updating... ? >
4256 <div class =" logo-container fadein" >
43- <img class =" logo-img" src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
57+ <img class =" logo-img loading " src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
4458 <div class =" logo-centered" >l</div >
4559 </div >
46- <center ><h1 >Updater</h1 >
47- <h4 class =" " >You can update your installation automatically or download the update and install it manually:</h4 >
48- <br ><div class =" row" >
49- &ensp ; <button style =" " ><i class =" fa-solid fa-user-gear btn" ></i ><a class =" btn" href =" {{ url ()-> current ()} } /?backup" > Update automatically</a ></button >&ensp ;
50- &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 ;
51- </div >
52- </center >
60+ <center ><h1 class =" loadingtxt" >Updating</h1 ></center >
61+ @Push (' updater-head' )
62+ <meta http-equiv =" refresh" content =" 2; URL={{ url ()-> current ()} } /../updating" />
63+ @endpush
64+ @endif
65+
5366@endif
5467
5568
56- @if ($_SERVER [' QUERY_STRING' ] === ' success' and (file_exists (base_path (" backups/CANUPDATE" ))) )
57- <?php // download backup ? >
69+
70+ @if ($_SERVER [' QUERY_STRING' ] === ' success' )
71+ <?php // success ? >
5872 <style >.logo-container {padding-top :23vh ;}.logo-centered {top :37vh ;} </style >
5973 <div class =" logo-container fadein" >
6074 <img class =" logo-img" src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
6983@endif
7084
7185
72- @if ($_SERVER [' QUERY_STRING' ] === ' error' )
73- <?php // download backup ? >
74- <style >.logo-container {padding-top :23vh ;}.logo-centered {top :37vh ;} </style >
75- <div class =" logo-container fadein" >
76- <img class =" logo-img" src =" {{ asset (' littlelink/images/just-gear.svg' ) } }" alt =" Logo" style =" " >
77- <div class =" logo-centered" >l</div >
78- </div >
79- <center ><h1 >Something went wrong</h1 >
80- <h4 class =" " >Something went wrong during the update process, you can try again or update manually:</h4 >
81- <br ><div class =" row" >
82- &ensp ; <button style =" " ><i class =" fa-solid fa-user-gear btn" ></i ><a class =" btn" href =" {{ url ()-> current ()} } /?backup" > Try again</a ></button >&ensp ;
83- &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 ;
84- </div >
85- </center >
86- @endif
87-
88-
8986@endpush
0 commit comments