|
@@ -269,14 +269,6 @@
|
|
|
</a>
|
|
</a>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="flex items-center gap-2">
|
|
<div class="flex items-center gap-2">
|
|
|
- <button
|
|
|
|
|
- id="shutdown-button"
|
|
|
|
|
- class="p-1.5 flex rounded-lg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-red-500 hidden"
|
|
|
|
|
- aria-label="Shutdown system"
|
|
|
|
|
- title="Shutdown Raspberry Pi"
|
|
|
|
|
- >
|
|
|
|
|
- <span class="material-icons text-red-600">power_settings_new</span>
|
|
|
|
|
- </button>
|
|
|
|
|
<button
|
|
<button
|
|
|
id="theme-toggle"
|
|
id="theme-toggle"
|
|
|
class="p-1.5 flex rounded-lg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
class="p-1.5 flex rounded-lg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
@@ -284,6 +276,14 @@
|
|
|
>
|
|
>
|
|
|
<span class="material-icons" id="theme-toggle-icon">dark_mode</span>
|
|
<span class="material-icons" id="theme-toggle-icon">dark_mode</span>
|
|
|
</button>
|
|
</button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ id="shutdown-button"
|
|
|
|
|
+ class="p-1.5 flex rounded-lg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-red-500"
|
|
|
|
|
+ aria-label="Shutdown system"
|
|
|
|
|
+ title="Shutdown System (Raspberry Pi only)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="material-icons text-red-600">power_settings_new</span>
|
|
|
|
|
+ </button>
|
|
|
</div>
|
|
</div>
|
|
|
</header>
|
|
</header>
|
|
|
<main class="flex flex-1 justify-center px-4 sm:px-6 lg:px-8 pt-16 sm:pt-20">
|
|
<main class="flex flex-1 justify-center px-4 sm:px-6 lg:px-8 pt-16 sm:pt-20">
|
|
@@ -694,24 +694,12 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// Shutdown button functionality
|
|
// Shutdown button functionality
|
|
|
- document.addEventListener('DOMContentLoaded', async function() {
|
|
|
|
|
|
|
+ document.addEventListener('DOMContentLoaded', function() {
|
|
|
const shutdownButton = document.getElementById('shutdown-button');
|
|
const shutdownButton = document.getElementById('shutdown-button');
|
|
|
|
|
|
|
|
- // Check if system is a Raspberry Pi
|
|
|
|
|
- try {
|
|
|
|
|
- const response = await fetch('/api/system/check_pi');
|
|
|
|
|
- const data = await response.json();
|
|
|
|
|
-
|
|
|
|
|
- if (data.is_pi) {
|
|
|
|
|
- shutdownButton.classList.remove('hidden');
|
|
|
|
|
- }
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('Error checking Pi status:', error);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// Shutdown button click handler
|
|
// Shutdown button click handler
|
|
|
shutdownButton.addEventListener('click', async () => {
|
|
shutdownButton.addEventListener('click', async () => {
|
|
|
- const confirmed = confirm('Are you sure you want to shutdown the Raspberry Pi?\n\nThis will:\n1. Stop Docker containers\n2. Shut down the system\n\nYou will need physical access to restart it.');
|
|
|
|
|
|
|
+ const confirmed = confirm('Are you sure you want to shutdown the system?\n\nNote: This only works on Raspberry Pi.\n\nThis will:\n1. Stop Docker containers\n2. Shut down the system\n\nYou will need physical access to restart it.');
|
|
|
|
|
|
|
|
if (!confirmed) return;
|
|
if (!confirmed) return;
|
|
|
|
|
|