Made update notification optional / Added Event notification
Added optional event notification that can be enabled in the config (is disabled by default). You can read more about this feature on the Blog here: https://blog.littlelink-custom.com/event-notifications/
This commit is contained in:
parent
87515a96cc
commit
4babe1fe2e
9
.env
9
.env
|
@ -2,13 +2,16 @@
|
|||
#=Register_auth either auth or verified. If auth is selected, no verification is required. Default is verified.
|
||||
Register_auth=verified
|
||||
|
||||
#Internal notifications=Notify if update is available or and event is happening such as a poll about the future of this project.
|
||||
Notify_events=false
|
||||
Notify_updates=true
|
||||
|
||||
#App Settings=Changes settings regarding your LittleLink Custom installation. You probably only want to change the App Name setting.
|
||||
#=App_Name changes the displayed name for the App in the title, for example.
|
||||
App_Name="LittleLink Custom"
|
||||
APP_KEY=
|
||||
App_URL=
|
||||
|
||||
|
||||
#Debug Settings=Changes if your page should display a full error description instead of a generic error 500
|
||||
#=App_debug either true or false. You might want to change this to false after you're done installing, but it's very useful for troubleshooting.
|
||||
App_debug=true
|
||||
|
@ -17,11 +20,9 @@ App_env=local
|
|||
Log_channel=stack
|
||||
Log_level=debug
|
||||
|
||||
|
||||
#Database Settings=Should be left alone. If you wish to use mysql you'd have to seed the database again.
|
||||
DB_connection=sqlite
|
||||
|
||||
|
||||
#Mail Settings=LittleLink Custom comes with a free to use built-in SMTP server for sending mail. You can leave this setting as is, if you wish to use this service please read our terms and conditions at llc-mail.tru.io. If you do not wish to use the built-in SMTP server, change the setting below
|
||||
#=Mail_mailer either smtp or built-in. Make sure to change this setting if you want to add a custom SMTP server.
|
||||
Mail_mailer=built-in
|
||||
|
@ -33,14 +34,12 @@ Mail_encryption=
|
|||
Mail_from_address=
|
||||
Mail_from_name="${app_name}"
|
||||
|
||||
|
||||
#Cache Settings=Completely optional
|
||||
Memcached_host=127.0.0.1
|
||||
Redis_host=127.0.0.1
|
||||
Redis_password=null
|
||||
Redis_port=6379
|
||||
|
||||
|
||||
#Miscellaneous Settings=Should be left alone if you don't know what you're doing.
|
||||
Broadcast_driver=log
|
||||
Cache_driver=file
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<?php // loads dark mode CSS if dark mode detected
|
||||
$color_scheme = isset($_COOKIE["color_scheme"]) ? $_COOKIE["color_scheme"] : false; ?>
|
||||
@if ($color_scheme == 'dark')
|
||||
<!-- switch the two <link> Tags below to default to dark mode if cookie detection fails -->
|
||||
<!-- switch the two <link> Tags below to default to dark mode if cookie detection fails -->
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/bootstrap.min-dark.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('/studio/css/style-dashboard-dark.css') }}">
|
||||
@else
|
||||
|
@ -138,7 +138,7 @@
|
|||
<div class="row">
|
||||
|
||||
<! –– #### begin update detection #### ––>
|
||||
|
||||
@if(env('Notify_updates') === true)
|
||||
<?php // Checks if URL exists
|
||||
try {
|
||||
function URL_exists(string $url): bool
|
||||
|
@ -169,16 +169,53 @@
|
|||
<a style="color:#007bff" class="nav-link" href="https://littlelink-custom.com/how-to-update.html" target="_blank" title="Click here to learn more about how to update">An update is available</a>
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
<! –– #### end update detection #### ––>
|
||||
|
||||
<a class="nav-link" href="{{ url('') }}/@<?= Auth::user()->littlelink_name ?>" target="_blank">Watch Page</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<! –– #### begin event detection #### ––>
|
||||
<?php
|
||||
try {
|
||||
function URL_event_exists(string $url): bool
|
||||
{
|
||||
return str_contains(get_headers($url)[0], "200 OK");
|
||||
}
|
||||
if (URL_event_exists("https://julianprieber.github.io/littlelink-custom-events/event.json")){
|
||||
$EventServerExists = "true";
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$EventServerExists = "false";
|
||||
}
|
||||
?>
|
||||
@if(env('Notify_events') === true and $EventServerExists == 'true')
|
||||
<?php
|
||||
$GetEventJson = file_get_contents("https://julianprieber.github.io/littlelink-custom-events/event.json");
|
||||
$EventJson = json_decode($GetEventJson, true);
|
||||
?>
|
||||
@if(auth()->user()->role == 'admin' and strtotime(date("d-m-Y")) < strtotime($EventJson['enddate']))
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="nav-link" href="{{ $EventJson['link'] }}" target="{{ $EventJson['target'] }}"><mark onMouseOver="{{ $EventJson['hoveron'] }}" onMouseOut="{{ $EventJson['hoveroff'] }}" style="{{ $EventJson['style'] }}" title="{{ $EventJson['hover'] }}">{{ $EventJson['title'] }}</mark></a>
|
||||
</div>
|
||||
</nav>
|
||||
@endif
|
||||
@endif
|
||||
@if(env('Notify_events') === false and auth()->user()->role == 'admin')
|
||||
<a href="{{ url('env-editor') }}" id="notify" style="color:#F75D59; font-weight:600; font-size:120%; background-color:#F5FFFA;"></a>
|
||||
<script>
|
||||
if(localStorage.getItem("firstTime")==null){
|
||||
document.getElementById("notify").innerHTML = "➡️ Click here to get notified about important events or security vulnerabilities";
|
||||
localStorage.setItem("firstTime","done");
|
||||
}
|
||||
</script>
|
||||
@endif
|
||||
<! –– #### end event detection #### ––>
|
||||
@yield('content')
|
||||
|
||||
</div>
|
||||
|
@ -189,4 +226,4 @@
|
|||
<script src="{{ asset('/studio/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('/studio/js/main-dashboard.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -27,6 +27,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
@if(env('Notify_events') === false)
|
||||
<br><br>
|
||||
<a style="color:#ffbb39; font-weight:300; font-size:120%;">You currently have Event Notifications disabled. To get notified about polls, possible security vulnerabilities or important news, change the setting <code>Notify_events</code> below to <code>true</code>. If you enable this and an event is happening, a small text will pop up on your Admin Panel which will only be visible for admins.</a>
|
||||
@endif
|
||||
|
||||
<div class="tab-content" id="nav-tabContent">
|
||||
<div class="tab-pane fade show active p-3" id="current-env" role="tabpanel" aria-labelledby="nav-home-tab">
|
||||
<env-main-tab></env-main-tab>
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
#=Register_auth either auth or verified. If auth is selected, no verification is required. Default is verified.
|
||||
Register_auth=verified
|
||||
|
||||
#Internal notifications=Notify if update is available or and event is happening such as a poll about the future of this project.
|
||||
Notify_events=false
|
||||
Notify_updates=true
|
||||
|
||||
#App Settings=Changes settings regarding your LittleLink Custom installation. You probably only want to change the App Name setting.
|
||||
#=App_Name changes the displayed name for the App in the title, for example.
|
||||
App_Name="LittleLink Custom"
|
||||
APP_KEY=base64:YOU+MUST+CHANGE+THIS+YUFukELiN6Bk9gQ19+9zwk=
|
||||
App_URL=
|
||||
|
||||
|
||||
#Debug Settings=Changes if your page should display a full error description instead of a generic error 500
|
||||
#=App_debug either true or false. You might want to change this to false after you're done installing, but it's very useful for troubleshooting.
|
||||
App_debug=true
|
||||
|
@ -17,11 +20,9 @@ App_env=local
|
|||
Log_channel=stack
|
||||
Log_level=debug
|
||||
|
||||
|
||||
#Database Settings=Should be left alone. If you wish to use mysql you'd have to seed the database again.
|
||||
DB_connection=sqlite
|
||||
|
||||
|
||||
#Mail Settings=LittleLink Custom comes with a free to use built-in SMTP server for sending mail. You can leave this setting as is, if you wish to use this service please read our terms and conditions at llc-mail.tru.io. If you do not wish to use the built-in SMTP server, change the setting below
|
||||
#=Mail_mailer either smtp or built-in. Make sure to change this setting if you want to add a custom SMTP server.
|
||||
Mail_mailer=built-in
|
||||
|
@ -33,14 +34,12 @@ Mail_encryption=
|
|||
Mail_from_address=
|
||||
Mail_from_name="${app_name}"
|
||||
|
||||
|
||||
#Cache Settings=Completely optional
|
||||
Memcached_host=127.0.0.1
|
||||
Redis_host=127.0.0.1
|
||||
Redis_password=null
|
||||
Redis_port=6379
|
||||
|
||||
|
||||
#Miscellaneous Settings=Should be left alone if you don't know what you're doing.
|
||||
Broadcast_driver=log
|
||||
Cache_driver=file
|
||||
|
|
Loading…
Reference in New Issue