[FIX] simulate.html: wrapper pubblico per simulate-nis2.php fuori DocumentRoot
DocumentRoot è public/ → simulate-nis2.php (root progetto) era 404. Aggiunto public/simulate-nis2.php: wrapper che imposta NIS2_SIM env e include il simulatore reale tramite require __DIR__/../simulate-nis2.php. Aggiornato URL in simulate.html: ../simulate-nis2.php → simulate-nis2.php. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e8b74a7cb7
commit
1876798836
22
public/simulate-nis2.php
Normal file
22
public/simulate-nis2.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* NIS2 Agile — Wrapper pubblico per simulate-nis2.php
|
||||||
|
*
|
||||||
|
* DocumentRoot è public/ → il file principale è fuori dalla web root.
|
||||||
|
* Questo wrapper converte il query param ?sim= nell'env var NIS2_SIM
|
||||||
|
* e include il simulatore reale dalla root del progetto.
|
||||||
|
*
|
||||||
|
* URL: https://nis2.agile.software/simulate-nis2.php?sim=all
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Mappa ?sim=sim06 → NIS2_SIM=SIM06 (unico filtro attivo nel simulatore)
|
||||||
|
$simParam = strtolower(trim($_GET['sim'] ?? 'all'));
|
||||||
|
if ($simParam === 'sim06') {
|
||||||
|
putenv('NIS2_SIM=SIM06');
|
||||||
|
}
|
||||||
|
// sim01-sim05 e 'all': SIM_FILTER rimane null → esegue tutti gli scenari
|
||||||
|
|
||||||
|
// Includi il simulatore dalla root del progetto.
|
||||||
|
// __DIR__ nel file incluso punta alla directory di quel file (/var/www/nis2-agile/)
|
||||||
|
// quindi readEnvValue() trova correttamente .env nella root.
|
||||||
|
require __DIR__ . '/../simulate-nis2.php';
|
||||||
@ -473,7 +473,7 @@ function runSimulation() {
|
|||||||
document.getElementById('statsGrid').style.display = 'none';
|
document.getElementById('statsGrid').style.display = 'none';
|
||||||
document.getElementById('consoleTitle').textContent = 'NIS2 Agile Simulator v2.0 — ' + (SIM_LABELS[selectedSim] || selectedSim);
|
document.getElementById('consoleTitle').textContent = 'NIS2 Agile Simulator v2.0 — ' + (SIM_LABELS[selectedSim] || selectedSim);
|
||||||
|
|
||||||
const url = `../simulate-nis2.php?sim=${selectedSim}&t=${Date.now()}`;
|
const url = `simulate-nis2.php?sim=${selectedSim}&t=${Date.now()}`;
|
||||||
evtSource = new EventSource(url);
|
evtSource = new EventSource(url);
|
||||||
|
|
||||||
let phaseCount = 0;
|
let phaseCount = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user