Skip to content

Commit 6624bbd

Browse files
committed
Updated version and event detection
1 parent 2377f0b commit 6624bbd

File tree

2 files changed

+16
-32
lines changed

2 files changed

+16
-32
lines changed

resources/views/layouts/sidebar.blade.php

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -236,29 +236,24 @@ function getUrlSatusCodesb($urlsb, $timeoutsb = 3)
236236
@endif
237237
@endif
238238
@elseif(env('NOTIFY_UPDATES') == 'true' or env('NOTIFY_UPDATES') === 'major' or env('NOTIFY_UPDATES') === 'all')
239-
<?php // Checks if URL exists
240-
try {
241-
function URL_exists(string $urlsb): bool
242-
{
243-
return str_contains(get_headers($urlsb)[0], "200 OK");
244-
}
245-
// Sets $ServerExists to true if URL exists
246-
if (URL_exists("https://julianprieber.github.io/littlelink-custom/version.json")){
247-
$ServerExists = "true";
248-
}
249-
} catch (exception $e) {
250-
$ServerExists = "false";
251-
}
252-
?>
253239
254240
<! –– Checks if file version.json exists AND if version.json exists on server to continue (without this PHP will throw ErrorException ) ––>
255-
@if(file_exists(base_path("version.json")) and $ServerExists == 'true')
241+
@if(file_exists(base_path("version.json")))
256242
257243
<?php // Requests newest version from server and sets it as variable
258-
$Vgit = file_get_contents("https://julianprieber.github.io/littlelink-custom/version.json");
244+
245+
try{
246+
$Vgit = file_get_contents("https://version.littlelink-custom.com/");
259247
260248
// Requests current version from the local version file and sets it as variable
261249
$Vlocal = file_get_contents(base_path("version.json"));
250+
}
251+
252+
catch (Exception $e){
253+
$Vgit = "0";
254+
$Vlocal = "0";
255+
}
256+
262257
?>
263258
264259
<! –– If user has role admin AND newest GitHub release version is higher than the local one an update notice will be displayed ––>
@@ -317,22 +312,10 @@ function URL_exists(string $urlsb): bool
317312
@endif
318313
319314
<! –– #### begin event detection #### ––>
320-
<?php
321-
try {
322-
function URL_event_exists(string $urlsb): bool
323-
{
324-
return str_contains(get_headers($urlsb)[0], "200 OK");
325-
}
326-
if (URL_event_exists("https://julianprieber.github.io/littlelink-custom-events/event.json")){
327-
$EventServerExists = "true";
328-
}
329-
} catch (exception $e) {
330-
$EventServerExists = "false";
331-
}
332-
?>
333-
@if(env('NOTIFY_EVENTS') === true and $EventServerExists == 'true')
315+
@if(env('NOTIFY_EVENTS') === true)
334316
<?php
335-
$GetEventJson = file_get_contents("https://julianprieber.github.io/littlelink-custom-events/event.json");
317+
try{
318+
$GetEventJson = file_get_contents("https://event.littlelink-custom.com/");
336319
$EventJson = json_decode($GetEventJson, true);
337320
if(isset($_COOKIE['HideEvent']) == NULL) {
338321
setcookie("HideEvent",$_COOKIE['ID'] = "0", time()+60*60*24*5, "/");
@@ -367,6 +350,7 @@ function URL_event_exists(string $urlsb): bool
367350
}
368351
</script>
369352
@endif
353+
<?php } catch (Exception $e){} ?>
370354
@endif
371355
<! –– #### end event detection #### ––>
372356
@yield('content')

resources/views/update.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="container">
55

66
<?php // Requests newest version from server and sets it as variable
7-
$Vgit = file_get_contents("https://julianprieber.github.io/littlelink-custom/version.json");
7+
$Vgit = file_get_contents("https://version.littlelink-custom.com/");
88
99
// Requests current version from the local version file and sets it as variable
1010
$Vlocal = file_get_contents(base_path("version.json"));

0 commit comments

Comments
 (0)