```
✨ feat(Devis.php): Ajoute adresses de facturation et de livraison au devis. 🔒️ fix(IntranetLocked.php): Autorise l'accès à la route st_control en mode debug. ✨ feat(CustomerAddress.php): Gère les adresses de facturation et livraison. ✨ feat: Ajoute la console superadmin pour le contrôle système. ✨ feat(DevisController.php): Supprime la génération PDF temporaire. ✨ feat(st_control.js): Ajoute la logique de contrôle système via JS. ✨ feat: Crée les templates CGV, Cookies, Hébergement et RGPD. 🎨 style(app.scss): Ajoute un style de fond pour la console. ✨ feat: Ajoute le template pour les informations d'hébergement. ✨ feat: Crée un template de mail d'alerte pour les accès root. ✨ feat: Crée le template RGPD (données personnelles). 🐛 fix(ErrorListener.php): Gère les erreurs 404 en prod (JSON/HTML). ✨ feat: Ajoute les mentions légales. ✨ feat(DevisPdfService.php): Améliore la génération PDF du devis. ✨ feat(admin.js): Charge dynamiquement les produits dans le select. ✨ feat(add.twig): Ajoute un sélecteur de produit et d'autres champs. ✅ chore(config): Ajoute INTRANET_LOCK à l'env. ```
This commit is contained in:
78
public/st_control.js
Normal file
78
public/st_control.js
Normal file
@@ -0,0 +1,78 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const btnSuspend = document.getElementById('btn-suspend');
|
||||
const btnEnable = document.getElementById('btn-enable');
|
||||
const terminal = document.getElementById('terminal-logs');
|
||||
|
||||
const appendLog = (message, colorClass) => {
|
||||
const now = new Date().toLocaleTimeString('fr-FR');
|
||||
const p = document.createElement('p');
|
||||
p.className = `${colorClass} font-bold mt-2`;
|
||||
p.innerHTML = `[${now}] ${message}`;
|
||||
terminal.appendChild(p);
|
||||
terminal.scrollTop = terminal.scrollHeight;
|
||||
};
|
||||
|
||||
const sendAction = (disableValue, logMessage, color) => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const secret = urlParams.get('secret');
|
||||
|
||||
fetch(`${window.location.pathname}?secret=${secret}&disable=${disableValue}`, {
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Ligne d'action principale
|
||||
appendLog(`>> EXEC: ${logMessage}`, color);
|
||||
|
||||
// Ligne de confirmation d'alerte
|
||||
setTimeout(() => {
|
||||
appendLog(`[SYSTEM] SECURITY ALERT SENT TO ADMIN... OK`, 'text-slate-500 italic text-[10px]');
|
||||
}, 400);
|
||||
})
|
||||
.catch(error => {
|
||||
appendLog(`>> ERROR: SECURITY BREACH OR DISCONNECT`, 'text-orange-500');
|
||||
});
|
||||
};
|
||||
|
||||
// Bouton Suspendre (disable=1 -> INTRANET_LOCK=true)
|
||||
btnSuspend.addEventListener('click', () => {
|
||||
sendAction('1', 'DISABLE ACCESS INTRANET (LOCK: TRUE)', 'text-red-500');
|
||||
});
|
||||
|
||||
// Bouton Réactiver (disable=0 -> INTRANET_LOCK=false)
|
||||
btnEnable.addEventListener('click', () => {
|
||||
sendAction('0', 'RESTORE ACCESS INTRANET (LOCK: FALSE)', 'text-blue-400');
|
||||
});
|
||||
|
||||
// ... Dans votre script existant ...
|
||||
|
||||
const btnCache = document.getElementById('btn-cache');
|
||||
const btnLiip = document.getElementById('btn-liip');
|
||||
|
||||
const executeSystemCommand = (action, logName, color) => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const secret = urlParams.get('secret');
|
||||
|
||||
appendLog(`>> STARTING: ${logName}...`, 'text-slate-400 italic');
|
||||
|
||||
fetch(`${window.location.pathname}?secret=${secret}&action=${action}`, {
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
appendLog(`>> SUCCESS: ${data.message}`, color);
|
||||
appendLog(`[SYSTEM] NOTIFICATION SENT`, 'text-slate-500 text-[9px]');
|
||||
})
|
||||
.catch(() => {
|
||||
appendLog(`>> ERROR: EXECUTION FAILED`, 'text-red-500');
|
||||
});
|
||||
};
|
||||
|
||||
btnCache.addEventListener('click', () => {
|
||||
executeSystemCommand('cache_clear', 'php bin/console cache:clear', 'text-blue-400');
|
||||
});
|
||||
|
||||
btnLiip.addEventListener('click', () => {
|
||||
executeSystemCommand('liip_clear', 'liip:imagine:cache:remove', 'text-purple-400');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user