Skip to content

Commit 0e257ef

Browse files
committed
Updated update notification system
Made NOTIFY_UPDATES=all and NOTIFY_UPDATES=major use the same version source file to prevent GitHub API limit from being reached.
1 parent 9a99d85 commit 0e257ef

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

config/self-update.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
declare(strict_types=1);
44

5-
$Vgit = file_get_contents("https://julianprieber.github.io/littlelink-custom/version.json");
5+
if (env('JOIN_BETA') === true) {
6+
$Vgit = file_get_contents("https://julianprieber.github.io/littlelink-custom/version.json");
7+
} else {
8+
$Vgit = '0';
9+
}
610

711
if ($Vgit > $Vlocal) {
812
$userver = 'https://update.littlelink-custom.com/';

resources/views/layouts/sidebar.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,26 +194,26 @@ function has_sslsb( $domain ) {
194194
<div class="row">
195195
196196
<! –– #### begin update detection #### ––>
197-
@if(env('NOTIFY_UPDATES') == 'all' or env('NOTIFY_UPDATES') == 'true')
197+
@if(env('NOTIFY_UPDATES') == 'old')
198198
<! –– Checks if file version.json exists to continue (without this PHP will throw ErrorException ) ––>
199199
@if(file_exists(base_path("version.json")))
200200
201201
<?php // Requests newest version from server and sets it as variable
202202
ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0)');
203-
$json = file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest") ;
203+
$json = file_get_contents("https://api.github.com/repos/julianprieber/littlelink-custom/releases/latest");
204204
$myObj = json_decode($json);
205-
$Vgit = $myObj->tag_name;
205+
$Vgit = $myObj->tag_name;
206206
207207
// Requests current version from the local version file and sets it as variable
208-
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
208+
$Vlocal = 'v' . file_get_contents(base_path("version.json"));
209209
?>
210210
211211
<! –– If user has role admin AND newest GitHub release version is higher than the local one an update notice will be displayed ––>
212212
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal)
213213
<a style="color:#007bff" class="nav-link" href="{{ url('update') }}" title="Click here to learn more about how to update">An update is available</a>
214214
@endif
215215
@endif
216-
@elseif(env('NOTIFY_UPDATES') == 'major')
216+
@else
217217
<?php // Checks if URL exists
218218
try {
219219
function URL_exists(string $url): bool

0 commit comments

Comments
 (0)