summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorertopogo <erwin.t.pombett@gmail.com>2025-11-26 04:02:41 +0100
committerertopogo <erwin.t.pombett@gmail.com>2025-11-26 04:02:41 +0100
commitfb7b2389c33bef903f236f4dd0c0b98dfc0bbbe8 (patch)
treeaa61a9026da508e865ab19b38677be523c961891 /scripts
parent0f1ba5af1684cfc64b3ff5374ef95c70df1caac0 (diff)
Feat: Ajout de la configuration Tridactyl (Native Messenger + .tridactylrc) et scripts de maintenance
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cleanup-tridactyl.ps134
-rw-r--r--scripts/install-tridactyl-native.ps149
-rw-r--r--scripts/verify-tridactyl-config.ps1108
3 files changed, 191 insertions, 0 deletions
diff --git a/scripts/cleanup-tridactyl.ps1 b/scripts/cleanup-tridactyl.ps1
new file mode 100644
index 0000000..e1c3c7e
--- /dev/null
+++ b/scripts/cleanup-tridactyl.ps1
@@ -0,0 +1,34 @@
+# Script de nettoyage et consolidation Tridactyl
+$ErrorActionPreference = "Stop"
+
+$sourceDir = "$env:USERPROFILE\.tridactyl"
+$targetDir = "$env:APPDATA\Mozilla\NativeMessagingHosts"
+$exeName = "native_main.exe"
+
+Write-Host "=== Consolidation Tridactyl ===" -ForegroundColor Cyan
+
+# 1. Copier l'exécutable
+if (Test-Path "$sourceDir\$exeName") {
+ Write-Host "Copie de $exeName vers $targetDir..."
+ Copy-Item -Path "$sourceDir\$exeName" -Destination "$targetDir\$exeName" -Force
+ Write-Host "OK" -ForegroundColor Green
+} else {
+ Write-Warning "$exeName non trouvé dans $sourceDir"
+}
+
+# 2. Vérifier que tout est bien là-bas
+if ((Test-Path "$targetDir\$exeName") -and (Test-Path "$targetDir\tridactyl.json")) {
+ Write-Host "Les fichiers nécessaires sont bien dans $targetDir" -ForegroundColor Green
+
+ # 3. Supprimer l'ancien dossier
+ if (Test-Path $sourceDir) {
+ Write-Host "Suppression du dossier inutile $sourceDir..."
+ Remove-Item -Path $sourceDir -Recurse -Force
+ Write-Host "Dossier supprimé." -ForegroundColor Green
+ }
+} else {
+ Write-Error "La copie semble avoir échoué. Le dossier source n'a pas été supprimé par sécurité."
+}
+
+Write-Host "Opération terminée." -ForegroundColor Cyan
+
diff --git a/scripts/install-tridactyl-native.ps1 b/scripts/install-tridactyl-native.ps1
new file mode 100644
index 0000000..fed740b
--- /dev/null
+++ b/scripts/install-tridactyl-native.ps1
@@ -0,0 +1,49 @@
+# Script pour installer le native messenger Tridactyl
+# Copie le fichier tridactyl.json vers l'emplacement attendu par Firefox
+
+$ErrorActionPreference = "Stop"
+
+Write-Host "=== Installation du Native Messenger Tridactyl ===" -ForegroundColor Cyan
+Write-Host ""
+
+$sourcePath = "$env:USERPROFILE\.tridactyl\tridactyl.json"
+$targetPath = "$env:APPDATA\Mozilla\NativeMessagingHosts\tridactyl.json"
+$targetDir = Split-Path $targetPath -Parent
+
+# Verifier que le fichier source existe
+if (-not (Test-Path $sourcePath)) {
+ Write-Host "[ERREUR] Fichier source introuvable: $sourcePath" -ForegroundColor Red
+ Write-Host "Assurez-vous que le native messenger est installe dans: $sourcePath" -ForegroundColor Yellow
+ exit 1
+}
+
+Write-Host "Source: $sourcePath" -ForegroundColor Gray
+Write-Host "Destination: $targetPath" -ForegroundColor Gray
+Write-Host ""
+
+# Creer le repertoire de destination si necessaire
+if (-not (Test-Path $targetDir)) {
+ Write-Host "Creation du repertoire: $targetDir" -ForegroundColor Yellow
+ New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
+ Write-Host "[OK] Repertoire cree" -ForegroundColor Green
+}
+
+# Copier le fichier
+Write-Host "Copie du fichier..." -ForegroundColor Yellow
+Copy-Item -Path $sourcePath -Destination $targetPath -Force
+Write-Host "[OK] Fichier copie avec succes" -ForegroundColor Green
+
+# Verifier que le fichier a ete copie correctement
+if (Test-Path $targetPath) {
+ Write-Host ""
+ Write-Host "[OK] Installation terminee avec succes!" -ForegroundColor Green
+ Write-Host ""
+ Write-Host "Prochaines etapes:" -ForegroundColor Yellow
+ Write-Host "1. Redemarrez Firefox completement" -ForegroundColor Gray
+ Write-Host "2. Ouvrez Firefox et appuyez sur ':' pour ouvrir Tridactyl" -ForegroundColor Gray
+ Write-Host "3. Tapez ':native' pour verifier la connexion" -ForegroundColor Gray
+} else {
+ Write-Host "[ERREUR] Le fichier n'a pas ete copie correctement" -ForegroundColor Red
+ exit 1
+}
+
diff --git a/scripts/verify-tridactyl-config.ps1 b/scripts/verify-tridactyl-config.ps1
new file mode 100644
index 0000000..afa5ccb
--- /dev/null
+++ b/scripts/verify-tridactyl-config.ps1
@@ -0,0 +1,108 @@
+# Script pour verifier la configuration Tridactyl
+# Verifie que les fichiers de configuration sont au bon endroit et accessibles
+
+$ErrorActionPreference = "Continue"
+
+Write-Host "=== Verification de la configuration Tridactyl ===" -ForegroundColor Cyan
+Write-Host ""
+
+# 1. Verifier le fichier tridactyl.json pour le native messenger
+Write-Host "1. Verification du Native Messenger (tridactyl.json)..." -ForegroundColor Yellow
+
+$nativeMessengerPath = "$env:APPDATA\Mozilla\NativeMessagingHosts\tridactyl.json"
+$sourcePath = "$env:USERPROFILE\.tridactyl\tridactyl.json"
+
+if (Test-Path $nativeMessengerPath) {
+ Write-Host " [OK] Fichier trouve: $nativeMessengerPath" -ForegroundColor Green
+
+ # Verifier le contenu
+ try {
+ $content = Get-Content $nativeMessengerPath -Raw | ConvertFrom-Json
+ Write-Host " [OK] Fichier JSON valide" -ForegroundColor Green
+ Write-Host " - Nom: $($content.name)" -ForegroundColor Gray
+ Write-Host " - Type: $($content.type)" -ForegroundColor Gray
+
+ # Verifier que le path pointe vers un executable valide
+ if ($content.path) {
+ $exePath = $content.path
+ # Si c'est un chemin relatif, chercher dans le repertoire .tridactyl
+ if (-not [System.IO.Path]::IsPathRooted($exePath)) {
+ $fullExePath = Join-Path (Split-Path $sourcePath -Parent) $exePath
+ } else {
+ $fullExePath = $exePath
+ }
+
+ if (Test-Path $fullExePath) {
+ Write-Host " [OK] Executable trouve: $fullExePath" -ForegroundColor Green
+ } else {
+ Write-Host " [ERREUR] Executable introuvable: $fullExePath" -ForegroundColor Red
+ }
+ }
+ } catch {
+ Write-Host " [ERREUR] Erreur lors de la lecture du JSON: $_" -ForegroundColor Red
+ }
+} else {
+ Write-Host " [ERREUR] Fichier introuvable: $nativeMessengerPath" -ForegroundColor Red
+ Write-Host " -> Le fichier doit etre copie depuis: $sourcePath" -ForegroundColor Yellow
+
+ if (Test-Path $sourcePath) {
+ Write-Host " -> Voulez-vous creer le lien maintenant? (O/N)" -ForegroundColor Yellow
+ $response = Read-Host
+ if ($response -eq 'O' -or $response -eq 'o') {
+ $nativeDir = Split-Path $nativeMessengerPath -Parent
+ if (-not (Test-Path $nativeDir)) {
+ New-Item -ItemType Directory -Path $nativeDir -Force | Out-Null
+ Write-Host " [OK] Repertoire cree: $nativeDir" -ForegroundColor Green
+ }
+ Copy-Item -Path $sourcePath -Destination $nativeMessengerPath -Force
+ Write-Host " [OK] Fichier copie vers: $nativeMessengerPath" -ForegroundColor Green
+ }
+ } else {
+ Write-Host " [ERREUR] Fichier source introuvable: $sourcePath" -ForegroundColor Red
+ }
+}
+
+Write-Host ""
+
+# 2. Verifier le fichier .tridactylrc
+Write-Host "2. Verification du fichier de configuration (.tridactylrc)..." -ForegroundColor Yellow
+
+$tridactylrcPath = "$env:USERPROFILE\.tridactylrc"
+
+if (Test-Path $tridactylrcPath) {
+ Write-Host " [OK] Fichier trouve: $tridactylrcPath" -ForegroundColor Green
+
+ $lineCount = (Get-Content $tridactylrcPath | Measure-Object -Line).Lines
+ Write-Host " - Nombre de lignes: $lineCount" -ForegroundColor Gray
+
+ # Afficher un apercu
+ $preview = Get-Content $tridactylrcPath -First 5
+ if ($preview) {
+ Write-Host " Apercu (5 premieres lignes):" -ForegroundColor Gray
+ foreach ($line in $preview) {
+ Write-Host " $line" -ForegroundColor DarkGray
+ }
+ }
+} else {
+ Write-Host " [ATTENTION] Fichier introuvable: $tridactylrcPath" -ForegroundColor Yellow
+ Write-Host " -> Ce fichier est optionnel mais recommande pour personnaliser Tridactyl" -ForegroundColor Gray
+ Write-Host " -> Vous pouvez le creer avec des commandes comme:" -ForegroundColor Gray
+ Write-Host " set searchengine google" -ForegroundColor DarkGray
+ Write-Host " bind J tabnext" -ForegroundColor DarkGray
+ Write-Host " bind K tabprev" -ForegroundColor DarkGray
+}
+
+Write-Host ""
+
+# 3. Instructions pour verifier dans Firefox
+Write-Host "3. Instructions pour verifier dans Firefox:" -ForegroundColor Yellow
+Write-Host " a) Ouvrez Firefox" -ForegroundColor Gray
+Write-Host " b) Appuyez sur ':' pour ouvrir la ligne de commande Tridactyl" -ForegroundColor Gray
+Write-Host " c) Tapez ':version' pour voir la version de Tridactyl" -ForegroundColor Gray
+Write-Host " d) Tapez ':native' pour verifier la connexion au native messenger" -ForegroundColor Gray
+Write-Host " e) Tapez ':source' pour recharger la configuration depuis .tridactylrc" -ForegroundColor Gray
+Write-Host " f) Tapez ':get searchengine' pour voir le moteur de recherche configure" -ForegroundColor Gray
+
+Write-Host ""
+Write-Host "=== Verification terminee ===" -ForegroundColor Cyan
+