Add RFID page, change order
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>NinjaCross Timer</title>
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
|
||||
<title>NinjaCross Timer</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a href="/about" class="logo" title="Über NinjaCross Timer">
|
||||
|
||||
239
data/rfid.css
Normal file
239
data/rfid.css
Normal file
@@ -0,0 +1,239 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
padding: 40px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
animation: slideIn 0.5s ease-out;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
color: #333;
|
||||
font-size: 2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.header p {
|
||||
color: #666;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 25px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
border: 2px solid #e1e5e9;
|
||||
border-radius: 10px;
|
||||
font-size: 1em;
|
||||
transition: all 0.3s ease;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.form-group input:hover {
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.btn-container {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
padding: 15px 25px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 1.1em;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #f8f9fa;
|
||||
color: #666;
|
||||
border: 2px solid #e1e5e9;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: #e9ecef;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.data-table {
|
||||
margin-top: 30px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.data-table h3 {
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.data-entry {
|
||||
background: white;
|
||||
padding: 15px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 8px;
|
||||
border-left: 4px solid #667eea;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.data-entry strong {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.data-entry span {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.success-message {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #c3e6cb;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.counter {
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
color: #666;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.read-uid-btn {
|
||||
background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 15px 20px;
|
||||
border-radius: 10px;
|
||||
font-size: 0.9em;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
white-space: nowrap;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.read-uid-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 16px rgba(40, 167, 69, 0.3);
|
||||
}
|
||||
|
||||
.read-uid-btn:disabled {
|
||||
background: #6c757d;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.read-uid-btn.reading {
|
||||
background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%);
|
||||
animation: pulse 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.05); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
.container {
|
||||
padding: 30px 20px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.btn-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
406
data/rfid.html
Normal file
406
data/rfid.html
Normal file
@@ -0,0 +1,406 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="rfid.css" />
|
||||
|
||||
<title>RFID Daten Eingabe</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>🏷️ RFID Daten Eingabe</h1>
|
||||
<p>Erfassen Sie RFID-Tag Informationen</p>
|
||||
</div>
|
||||
|
||||
<div id="successMessage" class="success-message" style="display: none;">
|
||||
✅ Daten erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<form id="rfidForm">
|
||||
<div class="form-group">
|
||||
<label for="uid">RFID UID <span class="required">*</span></label>
|
||||
<div style="display: flex; gap: 10px; align-items: stretch;">
|
||||
<input type="text" id="uid" name="uid" placeholder="z.B. A1:B2:C3:D4" required style="flex: 1;">
|
||||
<button type="button" id="readUidBtn" class="read-uid-btn" onclick="readRFIDUID()">
|
||||
📡 Read UID
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="vorname">Vorname <span class="required">*</span></label>
|
||||
<input type="text" id="vorname" name="vorname" placeholder="Vorname eingeben" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="nachname">Nachname <span class="required">*</span></label>
|
||||
<input type="text" id="nachname" name="nachname" placeholder="Nachname eingeben" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="alter">Alter <span class="required">*</span></label>
|
||||
<input type="number" id="alter" name="alter" placeholder="Alter eingeben" min="1" max="120" required>
|
||||
</div>
|
||||
|
||||
<div class="btn-container">
|
||||
<button type="submit" class="btn btn-primary">💾 Speichern</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="clearForm()">🗑️ Zurücksetzen</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="data-table">
|
||||
<h3>📋 Gespeicherte Einträge</h3>
|
||||
<div class="counter">
|
||||
<span id="entryCounter">0 Einträge gespeichert</span>
|
||||
</div>
|
||||
<div id="dataEntries"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// API Base URL - anpassen an Ihre Backend-URL
|
||||
const API_BASE_URL = 'http://localhost:3000/api';
|
||||
|
||||
// Globale Variablen
|
||||
let rfidData = [];
|
||||
let isLoading = false;
|
||||
|
||||
// Form Submit Handler
|
||||
document.getElementById('rfidForm').addEventListener('submit', async function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (isLoading) return;
|
||||
|
||||
// Daten aus dem Formular holen
|
||||
const uid = document.getElementById('uid').value.trim();
|
||||
const vorname = document.getElementById('vorname').value.trim();
|
||||
const nachname = document.getElementById('nachname').value.trim();
|
||||
const alter = parseInt(document.getElementById('alter').value);
|
||||
|
||||
// Validierung
|
||||
if (!uid || !vorname || !nachname || !alter) {
|
||||
showErrorMessage('Bitte füllen Sie alle Pflichtfelder aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Loading State
|
||||
setLoadingState(true);
|
||||
|
||||
try {
|
||||
// API Aufruf zum Erstellen des Benutzers
|
||||
const response = await fetch(`${API_BASE_URL}/users`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
uid: uid,
|
||||
vorname: vorname,
|
||||
nachname: nachname,
|
||||
alter: alter
|
||||
})
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
// Erfolg anzeigen
|
||||
showSuccessMessage('Benutzer erfolgreich gespeichert!');
|
||||
|
||||
// Formular zurücksetzen
|
||||
clearForm();
|
||||
|
||||
// Daten neu laden
|
||||
await loadUserData();
|
||||
|
||||
// UID Feld fokussieren für nächsten Eintrag
|
||||
setTimeout(() => {
|
||||
document.getElementById('uid').focus();
|
||||
}, 100);
|
||||
} else {
|
||||
// Fehler anzeigen
|
||||
showErrorMessage(result.error || 'Fehler beim Speichern der Daten');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern:', error);
|
||||
showErrorMessage('Verbindungsfehler zum Server. Bitte versuchen Sie es später erneut.');
|
||||
} finally {
|
||||
setLoadingState(false);
|
||||
}
|
||||
});
|
||||
|
||||
// Benutzer laden
|
||||
async function loadUserData() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/users?limit=50`);
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
rfidData = result.data;
|
||||
updateDataTable();
|
||||
} else {
|
||||
console.error('Fehler beim Laden der Daten:', result.error);
|
||||
showErrorMessage('Fehler beim Laden der Daten');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden der Daten:', error);
|
||||
showErrorMessage('Verbindungsfehler beim Laden der Daten');
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccessMessage(message = 'Daten erfolgreich gespeichert!') {
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.textContent = `✅ ${message}`;
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function showErrorMessage(message) {
|
||||
// Fehlermeldung dynamisch erstellen
|
||||
let errorDiv = document.getElementById('errorMessage');
|
||||
if (!errorDiv) {
|
||||
errorDiv = document.createElement('div');
|
||||
errorDiv.id = 'errorMessage';
|
||||
errorDiv.className = 'error-message';
|
||||
errorDiv.style.cssText = `
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #f5c6cb;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
display: none;
|
||||
`;
|
||||
document.querySelector('.container').insertBefore(errorDiv, document.getElementById('rfidForm'));
|
||||
}
|
||||
|
||||
errorDiv.textContent = `❌ ${message}`;
|
||||
errorDiv.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
errorDiv.style.display = 'none';
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function setLoadingState(loading) {
|
||||
isLoading = loading;
|
||||
const submitBtn = document.querySelector('.btn-primary');
|
||||
const form = document.getElementById('rfidForm');
|
||||
|
||||
if (loading) {
|
||||
submitBtn.textContent = '⏳ Speichern...';
|
||||
submitBtn.disabled = true;
|
||||
form.style.opacity = '0.7';
|
||||
} else {
|
||||
submitBtn.textContent = '💾 Speichern';
|
||||
submitBtn.disabled = false;
|
||||
form.style.opacity = '1';
|
||||
}
|
||||
}
|
||||
|
||||
function clearForm() {
|
||||
document.getElementById('rfidForm').reset();
|
||||
document.getElementById('uid').focus();
|
||||
}
|
||||
|
||||
function updateDataTable() {
|
||||
const container = document.getElementById('dataEntries');
|
||||
const counter = document.getElementById('entryCounter');
|
||||
|
||||
// Counter aktualisieren
|
||||
counter.textContent = `${rfidData.length} Einträge gespeichert`;
|
||||
|
||||
// Tabelle leeren
|
||||
container.innerHTML = '';
|
||||
|
||||
// Einträge anzeigen (neueste zuerst)
|
||||
rfidData.forEach((entry, index) => {
|
||||
const entryDiv = document.createElement('div');
|
||||
entryDiv.className = 'data-entry';
|
||||
|
||||
// Datum formatieren
|
||||
const createdAt = new Date(entry.created_at).toLocaleString('de-DE', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
|
||||
entryDiv.innerHTML = `
|
||||
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
|
||||
<div style="flex: 1;">
|
||||
<div><strong>UID:</strong> <span>${entry.uid}</span></div>
|
||||
<div><strong>Name:</strong> <span>${entry.vorname} ${entry.nachname}</span></div>
|
||||
<div><strong>Alter:</strong> <span>${entry.alter} Jahre</span></div>
|
||||
<div><strong>Erfasst:</strong> <span>${createdAt}</span></div>
|
||||
</div>
|
||||
<div style="margin-left: 10px;">
|
||||
<button onclick="deleteUser('${entry.uid}')"
|
||||
style="background: #dc3545; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 12px;"
|
||||
title="Benutzer löschen">
|
||||
🗑️
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(entryDiv);
|
||||
});
|
||||
|
||||
if (rfidData.length === 0) {
|
||||
container.innerHTML = '<div style="text-align: center; color: #999; padding: 20px;">Noch keine Daten erfasst</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Benutzer löschen
|
||||
async function deleteUser(uid) {
|
||||
if (!confirm(`Möchten Sie den Benutzer mit UID "${uid}" wirklich löschen?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/users/${encodeURIComponent(uid)}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
showSuccessMessage('Benutzer erfolgreich gelöscht!');
|
||||
await loadUserData();
|
||||
} else {
|
||||
showErrorMessage(result.error || 'Fehler beim Löschen des Benutzers');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Löschen:', error);
|
||||
showErrorMessage('Verbindungsfehler beim Löschen des Benutzers');
|
||||
}
|
||||
}
|
||||
|
||||
// Server Status prüfen
|
||||
async function checkServerStatus() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/health`);
|
||||
const result = await response.json();
|
||||
|
||||
if (result.status === 'OK') {
|
||||
console.log('✅ Server ist erreichbar');
|
||||
// Daten laden
|
||||
await loadUserData();
|
||||
} else {
|
||||
throw new Error('Server nicht verfügbar');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ Server nicht erreichbar:', error);
|
||||
showErrorMessage('Server nicht erreichbar. Bitte stellen Sie sicher, dass das Backend läuft.');
|
||||
}
|
||||
}
|
||||
|
||||
// Beim Laden der Seite
|
||||
window.addEventListener('load', function() {
|
||||
document.getElementById('uid').focus();
|
||||
checkServerStatus();
|
||||
});
|
||||
|
||||
// Enter-Taste in UID Feld zum nächsten Feld springen
|
||||
document.getElementById('uid').addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
document.getElementById('vorname').focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Automatische UID Formatierung
|
||||
document.getElementById('uid').addEventListener('input', function(e) {
|
||||
let value = e.target.value.toUpperCase();
|
||||
// Entfernen aller nicht-hexadezimalen Zeichen außer Doppelpunkt
|
||||
value = value.replace(/[^0-9A-F:]/g, '');
|
||||
e.target.value = value;
|
||||
});
|
||||
|
||||
// RFID UID lesen
|
||||
async function readRFIDUID() {
|
||||
const readBtn = document.getElementById('readUidBtn');
|
||||
const uidInput = document.getElementById('uid');
|
||||
|
||||
// Button Status ändern
|
||||
readBtn.disabled = true;
|
||||
readBtn.className = 'read-uid-btn reading';
|
||||
readBtn.innerHTML = '📡 Lese UID...';
|
||||
|
||||
try {
|
||||
// API Aufruf zum RFID Reader
|
||||
const response = await fetch(`${API_BASE_URL}/rfid/read`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success && result.uid) {
|
||||
// UID in das Eingabefeld setzen
|
||||
uidInput.value = result.uid.toUpperCase();
|
||||
uidInput.focus();
|
||||
|
||||
// Visuelles Feedback
|
||||
uidInput.style.borderColor = '#28a745';
|
||||
setTimeout(() => {
|
||||
uidInput.style.borderColor = '#e1e5e9';
|
||||
}, 2000);
|
||||
|
||||
showSuccessMessage('UID erfolgreich gelesen!');
|
||||
|
||||
// Automatisch zum nächsten Feld springen
|
||||
setTimeout(() => {
|
||||
document.getElementById('vorname').focus();
|
||||
}, 500);
|
||||
|
||||
} else {
|
||||
// Fehler beim Lesen
|
||||
const errorMsg = result.error || 'Keine UID gefunden';
|
||||
showErrorMessage(`RFID Fehler: ${errorMsg}`);
|
||||
|
||||
// UID Feld rot markieren
|
||||
uidInput.style.borderColor = '#dc3545';
|
||||
setTimeout(() => {
|
||||
uidInput.style.borderColor = '#e1e5e9';
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Lesen der UID:', error);
|
||||
showErrorMessage('Verbindungsfehler zum RFID Reader. Bitte prüfen Sie die Verbindung.');
|
||||
|
||||
// UID Feld rot markieren
|
||||
uidInput.style.borderColor = '#dc3545';
|
||||
setTimeout(() => {
|
||||
uidInput.style.borderColor = '#e1e5e9';
|
||||
}, 3000);
|
||||
|
||||
} finally {
|
||||
// Button Status zurücksetzen
|
||||
readBtn.disabled = false;
|
||||
readBtn.className = 'read-uid-btn';
|
||||
readBtn.innerHTML = '📡 Read UID';
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const refreshBtn = document.createElement('button');
|
||||
refreshBtn.innerHTML = '🔄 Aktualisieren';
|
||||
refreshBtn.className = 'btn btn-secondary';
|
||||
refreshBtn.style.cssText = 'margin-top: 10px; width: 100%;';
|
||||
refreshBtn.onclick = loadUserData;
|
||||
|
||||
document.querySelector('.data-table').appendChild(refreshBtn);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,8 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ninjacross Timer - Einstellungen</title>
|
||||
<link rel="stylesheet" href="settings.css" />
|
||||
|
||||
<title>Ninjacross Timer - Einstellungen</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
@@ -234,6 +236,7 @@
|
||||
// Einstellungen laden beim Seitenaufruf
|
||||
window.onload = function () {
|
||||
loadSettings();
|
||||
loadWifiSettings();
|
||||
loadSystemInfo();
|
||||
loadCurrentTime();
|
||||
updateCurrentTimeDisplay();
|
||||
|
||||
@@ -156,6 +156,20 @@ void loadSettings() {
|
||||
preferences.end();
|
||||
}
|
||||
|
||||
void saveWifiSettings() {
|
||||
preferences.begin("wifi", false);
|
||||
preferences.putString("ssid", ssidSTA);
|
||||
preferences.putString("password", passwordSTA);
|
||||
preferences.end();
|
||||
}
|
||||
|
||||
void loadWifiSettings() {
|
||||
preferences.begin("wifi", true);
|
||||
ssidSTA = preferences.getString("ssid", "").c_str();
|
||||
passwordSTA = preferences.getString("password", "").c_str();
|
||||
preferences.end();
|
||||
}
|
||||
|
||||
int checkLicence() {
|
||||
loadLicenceFromPrefs();
|
||||
String id = getUniqueDeviceID();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "master.h"
|
||||
#include "licenceing.h"
|
||||
|
||||
String ssidAP;
|
||||
const char* ssidAP;
|
||||
const char* passwordAP = nullptr;
|
||||
|
||||
const char* ssidSTA = "Obiwlankenobi";
|
||||
@@ -20,10 +20,10 @@ PrettyOTA OTAUpdates;
|
||||
|
||||
void setupWifi() {
|
||||
|
||||
ssidAP = getUniqueSSID();
|
||||
ssidAP = getUniqueSSID().c_str();
|
||||
|
||||
WiFi.mode(WIFI_MODE_APSTA);
|
||||
WiFi.softAP(ssidAP.c_str(), passwordAP);
|
||||
WiFi.softAP(ssidAP, passwordAP);
|
||||
WiFi.begin(ssidSTA, passwordSTA);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
|
||||
Reference in New Issue
Block a user