Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ scribe.db
*.sqlite
*.sqlite3

# Dossier des données
data/*

# ── Configuration générée (contient clés API et données établissement) ──
app/static/config.js

# ── State persistant des collecteurs (runtime, ne JAMAIS committer) ──
# Sinon on pollue les nouveaux déploiements avec des résidus
collecteur/collecteur_admin.json
collecteur/collecteur_transferts.json
collecteur/collecteur_incidents.json
collecteur/collecteur_decisions.json
collecteur/collecteur_sessions.json
collecteur_exercice/collecteur_exo_admin.json
collecteur_exercice/collecteur_exo_transferts.json
collecteur_exercice/collecteur_exo_incidents.json
collecteur_exercice/collecteur_exo_decisions.json
collecteur_exercice/collecteur_exo_prets.json
collecteur_exercice/collecteur_exo_sessions.json
collecteur/*.json
collecteur_exercice/*.json

# marquers divers
master/.onboarding_done
master/*.json
master/profil_base.xlsx

# ── Pièces jointes des incidents ──
uploads/*
Expand Down Expand Up @@ -62,3 +61,4 @@ logs/
# ── v2321 — Config IA persistée (contient clé API en clair, NE JAMAIS COMMITTER) ──
instance/ia_config.json
instance/

4 changes: 2 additions & 2 deletions app/static/css/scribe.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ header{display:flex;flex-direction:column;align-items:stretch;background:linear-

/* ══ INCIDENTS TAB ══ */
#tab-veille{flex-direction:row}
.entry-col{width:320px;min-width:260px;display:flex;flex-direction:column;border-right:1px solid var(--border);overflow-y:auto;flex-shrink:0;max-height:calc(100vh - 90px)}
.entry-col{width:480px;min-width:320px;display:flex;flex-direction:column;border-right:1px solid var(--border);overflow-y:auto;flex-shrink:0;max-height:calc(100vh - 90px)}
.view-col{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}

/* MAP */
Expand Down Expand Up @@ -1448,4 +1448,4 @@ body.exo-mode{padding-top:36px}
/* ═══════════════════ SCRIBE v2.3.65 */>


<!-- ══ JS ANALYSE ═══════════════════════════════════════════════════ -->
<!-- ══ JS ANALYSE ═══════════════════════════════════════════════════ -->
25 changes: 17 additions & 8 deletions app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h3>🚨 Déclaration d'incident</h3>
oninput="filterUFList()" onfocus="showUFDropdown()" onkeydown="ufKeyNav(event)"
style="padding-right:26px;width:100%;box-sizing:border-box">
<span onclick="clearUF()" style="position:absolute;right:7px;top:50%;transform:translateY(-50%);color:var(--muted);cursor:pointer;font-size:12px">✕</span>
<div id="uf-dropdown" style="display:none;position:absolute;z-index:500;top:100%;left:0;right:0;max-height:180px;overflow-y:auto;background:var(--surface2);border:1px solid var(--border2);border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,.4)"></div>
<div id="uf-dropdown" style="display:none;position:absolute;z-index:500;top:100%;left:0;right:0;max-height:200px;width:234px;overflow-y:auto;background:var(--surface2);border:1px solid var(--border2);border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,.4)"></div>
</div>
<button type="button" onclick="ufAddCurrent()" title="Ajouter cette UF"
style="flex-shrink:0;width:26px;height:26px;border-radius:4px;border:1px solid var(--border2);background:var(--surface2);color:var(--muted2);cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;line-height:1">+</button>
Expand Down Expand Up @@ -285,14 +285,14 @@ <h3>🚨 Déclaration d'incident</h3>
<div class="jalons-form">
<div class="jalons-form-title">⏱ Jalons de résolution</div>
<div class="jalon-presets">
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Passé d'ordinateur">Passé d'ordi</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="DSI contacté">DSI contacté</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="RSSI alerté">RSSI alerté</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Cellule activée">Cellule activée</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="CERT Santé notifié">CERT Santé</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Ordi plus utilisé">Ordi plus utilisé</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Contacter DSI">Contacter DSI</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Alerter RSSI">Alerter RSSI</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Activer Cellule de crise">Activer Cellule de crise</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Notifier CERT Santé">Notifier CERT Santé</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Isolation réseau">Isolation réseau</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Sauvegarde vérifiée">Sauvegarde OK</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Retour à la normale">Retour normal</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Vérifier Sauvegarde">Vérifier Sauvegarde</button>
<button class="jalon-preset-btn" onclick="togglePreset(this)" data-label="Retour à la normale">Retour normale</button>
</div>
<div class="jalon-custom-input">
<input type="text" id="jalon-custom" placeholder="Jalon personnalisé...">
Expand Down Expand Up @@ -2241,3 +2241,12 @@ <h2 style="font-family:var(--mono);font-size:14px;font-weight:700;margin:0 0 4px

</body>
</html>









5 changes: 3 additions & 2 deletions app/static/js/scribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9741,8 +9741,8 @@ async function acvCreateAll() {

// 2. Capacité : cadres déclarants — via capData déjà chargé
try {
if (Array.isArray(window.capData)) {
window.capData.forEach(function(c) {
if (Array.isArray(capData)) {
capData.forEach(function(c) {
var d = c.derniere_declaration;
if (d && d.redacteur) cadres.add(String(d.redacteur).trim());
});
Expand Down Expand Up @@ -10032,3 +10032,4 @@ async function aufBulkActivate(actif) {
setInterval(checkAdminAndShow, 2000);
}
})();

134 changes: 134 additions & 0 deletions launch_scribe.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Définition des encodages
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
$env:PYTHONUTF8 = 1
$env:PYTHONIOENCODING = "utf-8"

# Définir le titre de la fenêtre
$Host.UI.RawUI.WindowTitle = "SCRIBE - Supervision + Pilotage d'instances"

#Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Set-ExecutionPolicy Unrestricted -Scope CurrentUser

# Se placer dans le répertoire du script
Set-Location -Path (Split-Path $MyInvocation.MyCommand.Path)

Write-Host ""
Write-Host " SCRIBE - Lancement avec environnement Python"
Write-Host ""
Write-Host ""
Start-Sleep -Seconds 2

# Définition des chemins :
$parentPath = Split-Path -Path $PSScriptRoot -Parent -Resolve
$source_config_etb = Join-Path $parentPath "SCRIBE_config_etablissement.xlsx"
$collecteurPath = Join-Path $PSScriptRoot "collecteur"
$profilePath = Join-Path $PSScriptRoot "master\profil_base.xlsx"
$masterOnboardingPath = Join-Path $PSScriptRoot "master\.onboarding_done"
$masterInstancesPath = Join-Path $PSScriptRoot "master\master_instances.json"
$masterInstancesExoPath = Join-Path $PSScriptRoot "master\master_instances_exercice.json"
$python_vEnv_name = ".venv"
$python_vEnv_executablePath = Join-Path $PSScriptRoot "$python_vEnv_name\Scripts\python.exe"


# Vérifier la présence de Python
if (!(Get-Command "python" -ErrorAction SilentlyContinue)) {
Write-Host " X Python non trouve. Installez Python 3.10+."
Pause
Exit 1
}
# Activation du vEnv pour Python - Windows
Write-Host "Activation du vEnv Python"
$activateScript = Join-Path $PSScriptRoot "$python_vEnv_name\Scripts\Activate.ps1"
if (Test-Path $activateScript) {
. $activateScript
"Activation du vEnv Python - OK"
} else {
Write-Warning "Environnement virtuel non trouvé. Lancement 'python -m venv $python_vEnv_name'."
python -m venv $python_vEnv_name
. $activateScript
"Creation et activation du vEnv Python OK"
}


if (!(Test-Path $python_vEnv_executablePath)) {
Write-Host "Executable Python introuvable dans le vEnv. Utilisation du python par defaut"
$python_vEnv_executablePath = "python"
Start-Sleep -Seconds 2
}


# Afficher l'en-tête
Write-Host ""
Write-Host " ==============================================================="
Write-Host " SCRIBE - Supervision avec pilotage d'instances"
Write-Host ""
Write-Host " http://localhost:9000 -- Onglet `"INSTANCES`""
Write-Host ""
Write-Host " Lancez/configurez vos instances depuis l'admin web."
Write-Host " Ctrl+C pour arreter (toutes les instances filles aussi)."
Write-Host " ==============================================================="
Write-Host ""

# Vérifier et installer les dépendances
Write-Host " [info] Verification des dependances..."
if (Test-Path "requirements.txt") {
#python -m pip install -q -r requirements.txt 2>$null
Start-Process -FilePath $python_vEnv_executablePath -ArgumentList "-m pip install -q -r requirements.txt" -NoNewWindow -Wait -RedirectStandardError (Join-Path $PSScriptRoot "pip_install_error.log")
Write-Host " [info] Dependance Python - main : OK"
}
if (Test-Path "collecteur\collecteur_requirements.txt") {
#$python_vEnv_executablePath -m pip install -q -r collecteur\collecteur_requirements.txt 2>$null
Start-Process -FilePath $python_vEnv_executablePath -ArgumentList "-m pip install -q -r collecteur\collecteur_requirements.txt" -NoNewWindow -Wait -RedirectStandardError (Join-Path $PSScriptRoot "pip_install_error.log")
Write-Host " [info] Dependance Python - Collecteur : OK"
}

# Copier le profil de base si nécessaire
if ((Test-Path $profilePath)) {
$reponse = Read-Host "Voulez-vous demarrer une nouvelle configuration ? (O/Y/N)"
if ($reponse -eq "O" -or $reponse -eq "o" -or $reponse -eq "Y" -or $reponse -eq "y") {
Remove-Item -Path $profilePath -Force
Remove-Item -Path $masterInstancesPath -Force
Remove-Item -Path $masterInstancesExoPath -Force
if ((Test-Path $masterOnboardingPath)) {
Remove-Item -Path $masterOnboardingPath -Force
}
Remove-Item -Path "data\instances" -Force -Recurse
Write-Host "Donnees supprimees."
} else {
# assurer que le marqueur onboarding est bien créé
if (!(Test-Path $masterOnboardingPath)) {
New-Item -Path $masterOnboardingPath -ItemType File
}
}
} else {
Write-Host " [setup] Copie du profil de base..."
if (Test-Path $source_config_etb) {
Copy-Item $source_config_etb $profilePath -Force
Write-Host " [setup] Copie du profil de base - OK..."
}
}

# Créer les répertoires nécessaires
if (!(Test-Path "data\instances")) {
New-Item -ItemType Directory -Path "data\instances" | Out-Null
}
if (!(Test-Path "logs")) {
New-Item -ItemType Directory -Path "logs" | Out-Null
}


Write-Host ""
Write-Host " >> Demarrage du navigateur en arriere plan"
Write-Host ""

$edgeProcess = Start-Process msedge -ArgumentList "--inprivate", "http://localhost:9000" -PassThru


Write-Host ""
Write-Host " >> Demarrage de la supervision sur :9000..."
Write-Host ""

# Changer de répertoire et lancer le collecteur
Set-Location $collecteurPath
Start-Process $python_vEnv_executablePath -ArgumentList "collecteur.py" -NoNewWindow

Loading