docs(readme): mise à jour de la documentation en anglais
- Traduction du README en anglais pour une meilleure accessibilité - Mise à jour des sections sur les fonctionnalités, l'installation, la configuration et le dépannage - Amélioration de la clarté des instructions et des exemples de configuration - Ajout de détails sur la gestion des erreurs et les meilleures pratiques
This commit is contained in:
352
README.md
352
README.md
@@ -1,49 +1,48 @@
|
||||
# Webhooks Trigger - Stream Deck Plugin
|
||||
|
||||
Un plugin Stream Deck professionnel pour envoyer des requêtes HTTP webhook en appuyant sur un bouton. Construit avec le SDK officiel Elgato et TypeScript avec une architecture modulaire suivant les principes SOLID.
|
||||
A professional Stream Deck plugin for sending HTTP webhook requests with the press of a button. Built with TypeScript and the official Elgato Stream Deck SDK.
|
||||
|
||||
## 🚀 Fonctionnalités
|
||||
## 🚀 Features
|
||||
|
||||
- **Requêtes HTTP complètes** : Support de GET, POST, PUT, PATCH, DELETE
|
||||
- **Configuration flexible** : URL, headers, body, méthode HTTP personnalisables
|
||||
- **Validation JSON intégrée** : Validation en temps réel des headers et body JSON
|
||||
- **Beautification JSON** : Formatage automatique du JSON avec indentation
|
||||
- **Vérification de configuration** : Bouton de validation complète avec détection d'erreurs
|
||||
- **Retour visuel** : Indication de succès/échec sur Stream Deck
|
||||
- **Logging complet** : Logs détaillés pour debugging et monitoring
|
||||
- **Interface utilisateur moderne** : UI propre avec composants SDPI
|
||||
- **Architecture modulaire** : Services séparés suivant les principes DRY et SRP
|
||||
- **Complete HTTP Support**: GET, POST, PUT, PATCH, DELETE methods
|
||||
- **Flexible Configuration**: Customizable URL, headers, body, and HTTP method
|
||||
- **JSON Validation**: Real-time validation of headers and body JSON
|
||||
- **JSON Beautification**: Automatic JSON formatting with proper indentation
|
||||
- **Configuration Verification**: Complete validation with error detection
|
||||
- **Visual Feedback**: Success/failure indication directly on Stream Deck
|
||||
- **Comprehensive Logging**: Detailed logs for debugging and monitoring
|
||||
- **Modern UI**: Clean interface with SDPI components
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
### Prérequis
|
||||
### Prerequisites
|
||||
|
||||
- Stream Deck software officiel installé
|
||||
- Node.js 20+ et npm
|
||||
- Official Stream Deck software installed
|
||||
- Node.js 20+ and npm
|
||||
- Stream Deck CLI (`npm install -g @elgato/cli`)
|
||||
|
||||
### Installation développeur
|
||||
### Developer Installation
|
||||
|
||||
1. **Cloner le repository**
|
||||
1. **Clone the repository**
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd webhooks-trigger
|
||||
```
|
||||
|
||||
2. **Installer les dépendances**
|
||||
2. **Install dependencies**
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **Construire le plugin**
|
||||
3. **Build the plugin**
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
4. **Installer en mode développeur**
|
||||
4. **Install in development mode**
|
||||
|
||||
```bash
|
||||
streamdeck dev
|
||||
@@ -51,36 +50,36 @@ Un plugin Stream Deck professionnel pour envoyer des requêtes HTTP webhook en a
|
||||
streamdeck link
|
||||
```
|
||||
|
||||
5. **Redémarrer le plugin (après modifications)**
|
||||
5. **Restart the plugin (after modifications)**
|
||||
```bash
|
||||
npm run restart
|
||||
```
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
### Champs de configuration
|
||||
### Configuration Fields
|
||||
|
||||
| Champ | Description | Requis | Exemple |
|
||||
| --------------- | ----------------------------- | ------ | -------------------------------------- |
|
||||
| **URL** | URL de destination du webhook | ✅ | `https://webhook.site/abc123` |
|
||||
| **HTTP Method** | Méthode HTTP à utiliser | ✅ | `POST` |
|
||||
| **Headers** | Headers HTTP au format JSON | ❌ | `{"Content-Type": "application/json"}` |
|
||||
| **Body** | Corps de la requête | ❌ | `{"message": "Hello!"}` |
|
||||
| Field | Description | Required | Example |
|
||||
| --------------- | --------------------------- | -------- | -------------------------------------- |
|
||||
| **URL** | Webhook destination URL | ✅ | `https://webhook.site/abc123` |
|
||||
| **HTTP Method** | HTTP method to use | ✅ | `POST` |
|
||||
| **Headers** | HTTP headers in JSON format | ❌ | `{"Content-Type": "application/json"}` |
|
||||
| **Body** | Request body content | ❌ | `{"message": "Hello!"}` |
|
||||
|
||||
> **Note** : Le titre du bouton est géré nativement par Stream Deck via l'interface standard.
|
||||
> **Note**: Button title is managed natively by Stream Deck through the standard interface.
|
||||
|
||||
### Exemples de configuration
|
||||
### Configuration Examples
|
||||
|
||||
#### Webhook simple GET
|
||||
#### Simple GET Webhook
|
||||
|
||||
```
|
||||
URL: https://api.example.com/webhook
|
||||
Method: GET
|
||||
Headers: {"Authorization": "Bearer token123"}
|
||||
Body: (vide)
|
||||
Body: (empty)
|
||||
```
|
||||
|
||||
#### Webhook POST avec JSON
|
||||
#### POST Webhook with JSON
|
||||
|
||||
```
|
||||
URL: https://webhook.site/abc123
|
||||
@@ -89,247 +88,162 @@ Headers: {"Content-Type": "application/json"}
|
||||
Body: {"event": "button_pressed", "timestamp": "now"}
|
||||
```
|
||||
|
||||
#### Notification Discord
|
||||
#### Discord Notification
|
||||
|
||||
```
|
||||
URL: https://discord.com/api/webhooks/your-webhook-url
|
||||
Method: POST
|
||||
Headers: {"Content-Type": "application/json"}
|
||||
Body: {"content": "Message depuis Stream Deck!"}
|
||||
Body: {"content": "Message from Stream Deck!"}
|
||||
```
|
||||
|
||||
## 🛠️ Interface utilisateur
|
||||
## 🛠️ User Interface
|
||||
|
||||
### Boutons de validation
|
||||
### Validation Buttons
|
||||
|
||||
- **Beautify JSON** : Formate automatiquement le JSON avec indentation propre
|
||||
- **Validate JSON** : Vérifie la syntaxe JSON et affiche les erreurs
|
||||
- **Verify Configuration** : Validation complète de toute la configuration
|
||||
- **Beautify JSON**: Automatically formats JSON with proper indentation
|
||||
- **Validate JSON**: Checks JSON syntax and displays errors
|
||||
- **Verify Configuration**: Complete validation of all configuration settings
|
||||
|
||||
### Messages de validation
|
||||
### Validation Messages
|
||||
|
||||
- **Erreurs** : Affichées en rouge sous les champs pendant 5 secondes
|
||||
- **Succès** : Affichées en vert pendant 5 secondes
|
||||
- **Validation automatique** : Vérification en temps réel lors de la saisie
|
||||
- **Timeouts gérés** : Les timeouts précédents sont automatiquement effacés
|
||||
- **Errors**: Displayed in red below fields for 5 seconds
|
||||
- **Success**: Displayed in green for 5 seconds
|
||||
- **Real-time Validation**: Automatic verification during input
|
||||
- **Timeout Management**: Previous timeouts are automatically cleared
|
||||
|
||||
### Retour visuel Stream Deck
|
||||
### Stream Deck Visual Feedback
|
||||
|
||||
- **✅ Checkmark vert** : Requête envoyée avec succès (status 200-299)
|
||||
- **❌ X rouge** : Erreur (URL invalide, JSON malformé, erreur réseau)
|
||||
- **✅ Green Checkmark**: Request sent successfully (status 200-299)
|
||||
- **❌ Red X**: Error occurred (invalid URL, malformed JSON, network error)
|
||||
|
||||
## 📋 Validation et règles
|
||||
## 📋 Validation Rules
|
||||
|
||||
### Validation URL
|
||||
### URL Validation
|
||||
|
||||
- ✅ Protocoles supportés : `http://` et `https://`
|
||||
- ✅ Format URL valide requis
|
||||
- ❌ URLs relatives non supportées
|
||||
- ✅ Supported protocols: `http://` and `https://`
|
||||
- ✅ Valid URL format required
|
||||
- ❌ Relative URLs not supported
|
||||
|
||||
### Validation Headers
|
||||
### Headers Validation
|
||||
|
||||
- ✅ JSON object valide : `{"key": "value"}`
|
||||
- ❌ Arrays non supportés : `["value1", "value2"]`
|
||||
- ❌ Primitives non supportées : `"string"` ou `123`
|
||||
- ✅ Valid JSON object: `{"key": "value"}`
|
||||
- ❌ Arrays not supported: `["value1", "value2"]`
|
||||
- ❌ Primitives not supported: `"string"` or `123`
|
||||
|
||||
### Validation Body
|
||||
### Body Validation
|
||||
|
||||
- ✅ JSON valide ou texte plain
|
||||
- ✅ Vide autorisé (optionnel)
|
||||
- ⚠️ Warning si body vide pour POST/PUT/PATCH
|
||||
- ⚠️ Warning si body présent pour GET
|
||||
- ✅ Valid JSON or plain text
|
||||
- ✅ Empty allowed (optional)
|
||||
- ⚠️ Warning if body is empty for POST/PUT/PATCH
|
||||
- ⚠️ Warning if body is present for GET
|
||||
|
||||
### Bonnes pratiques
|
||||
### Best Practices
|
||||
|
||||
- **Content-Type recommandé** : Ajoutez `{"Content-Type": "application/json"}` pour les requêtes avec body JSON
|
||||
- **Headers d'authentification** : Utilisez `{"Authorization": "Bearer token"}` pour l'auth
|
||||
- **Validation avant utilisation** : Utilisez le bouton "Verify Configuration" avant la première utilisation
|
||||
- **Content-Type Recommended**: Add `{"Content-Type": "application/json"}` for JSON body requests
|
||||
- **Authentication Headers**: Use `{"Authorization": "Bearer token"}` for authentication
|
||||
- **Pre-validation**: Use "Verify Configuration" button before first use
|
||||
|
||||
## 🔧 Développement
|
||||
## 🔧 Development
|
||||
|
||||
### Structure du projet
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
webhooks-trigger/
|
||||
├── src/ # Code source TypeScript
|
||||
├── src/ # TypeScript source code
|
||||
│ ├── actions/
|
||||
│ │ └── send-webhook.ts # Action principale du plugin
|
||||
│ ├── services/ # Services modulaires (SOLID)
|
||||
│ │ ├── validation-service.ts # Service de validation
|
||||
│ │ ├── webhook-request-builder.ts # Construction des requêtes HTTP
|
||||
│ │ ├── webhook-executor.ts # Exécution des requêtes
|
||||
│ │ └── settings-manager.ts # Gestion des paramètres
|
||||
│ │ └── send-webhook.ts # Main plugin action
|
||||
│ ├── services/ # Service modules
|
||||
│ │ ├── validation-service.ts # Validation logic
|
||||
│ │ ├── webhook-request-builder.ts # HTTP request construction
|
||||
│ │ ├── webhook-executor.ts # Request execution
|
||||
│ │ └── settings-manager.ts # Settings management
|
||||
│ ├── types/
|
||||
│ │ └── webhook-settings.ts # Types TypeScript et constantes
|
||||
│ └── plugin.ts # Point d'entrée du plugin
|
||||
├── com.mr-kayjaydee.webhooks-trigger.sdPlugin/ # Plugin Stream Deck
|
||||
│ ├── manifest.json # Métadonnées du plugin
|
||||
│ │ └── webhook-settings.ts # TypeScript types and constants
|
||||
│ └── plugin.ts # Plugin entry point
|
||||
├── com.mr-kayjaydee.webhooks-trigger.sdPlugin/ # Stream Deck plugin
|
||||
│ ├── manifest.json # Plugin metadata
|
||||
│ ├── ui/
|
||||
│ │ ├── send-webhook.html # Interface utilisateur
|
||||
│ │ └── send-webhook.js # JavaScript frontend
|
||||
│ │ ├── send-webhook.html # User interface
|
||||
│ │ └── send-webhook.js # Frontend JavaScript
|
||||
│ ├── bin/
|
||||
│ │ ├── plugin.js # Code compilé (généré)
|
||||
│ │ └── package.json # Config module ES (généré)
|
||||
│ ├── imgs/ # Icônes et assets
|
||||
│ │ ├── actions/send-webhook/ # Icônes de l'action
|
||||
│ │ └── plugin/ # Icônes du plugin
|
||||
│ └── logs/ # Logs du plugin
|
||||
├── package.json # Dépendances et scripts
|
||||
├── tsconfig.json # Configuration TypeScript
|
||||
└── rollup.config.mjs # Configuration build
|
||||
│ │ ├── plugin.js # Compiled code (generated)
|
||||
│ │ └── package.json # ES module config (generated)
|
||||
│ └── imgs/ # Icons and assets
|
||||
├── package.json # Dependencies and scripts
|
||||
├── tsconfig.json # TypeScript configuration
|
||||
└── rollup.config.mjs # Build configuration
|
||||
```
|
||||
|
||||
### Scripts disponibles
|
||||
### Available Scripts
|
||||
|
||||
```bash
|
||||
npm run build # Compile TypeScript vers JavaScript
|
||||
npm run watch # Mode développement avec watch et auto-restart
|
||||
npm run restart # Build + redémarrage du plugin
|
||||
npm run build # Compile TypeScript to JavaScript
|
||||
npm run watch # Development mode with watch and auto-restart
|
||||
npm run restart # Build + restart plugin
|
||||
```
|
||||
|
||||
### Architecture logicielle
|
||||
### HTTP Methods
|
||||
|
||||
Le plugin suit une architecture modulaire avec les principes **SOLID** :
|
||||
- **GET**: Retrieve data from the server
|
||||
- **POST**: Send data to create new resources
|
||||
- **PUT**: Update or create resources
|
||||
- **PATCH**: Partially update resources
|
||||
- **DELETE**: Remove resources
|
||||
|
||||
#### **Services Backend (TypeScript)**
|
||||
### Error Handling
|
||||
|
||||
- **`ValidationService`** : Validation des paramètres webhook
|
||||
- **`WebhookRequestBuilder`** : Construction des requêtes HTTP
|
||||
- **`WebhookExecutor`** : Exécution des requêtes HTTP
|
||||
- **`SettingsManager`** : Gestion et normalisation des paramètres
|
||||
The plugin handles various error scenarios:
|
||||
|
||||
#### **Types et constantes**
|
||||
- **Network Errors**: Connection timeouts, DNS resolution failures
|
||||
- **HTTP Errors**: 4xx and 5xx status codes
|
||||
- **Validation Errors**: Invalid JSON, malformed URLs
|
||||
- **Configuration Errors**: Missing required fields
|
||||
|
||||
- **`WebhookSettings`** : Interface TypeScript pour les paramètres
|
||||
- **`WEBHOOK_CONSTANTS`** : Constantes partagées (méthodes, protocoles)
|
||||
## 🚨 Troubleshooting
|
||||
|
||||
#### **Frontend (JavaScript)**
|
||||
### Common Issues
|
||||
|
||||
- Interface utilisateur simple et efficace
|
||||
- Validation en temps réel avec gestion des timeouts
|
||||
- Beautification JSON intégrée
|
||||
- Pas de duplication d'alertes rouge/vert
|
||||
1. **Plugin Not Appearing**
|
||||
- Ensure Stream Deck software is running
|
||||
- Check if plugin is properly linked with `streamdeck link`
|
||||
- Restart Stream Deck software
|
||||
|
||||
### Logging
|
||||
2. **Webhook Not Sending**
|
||||
- Verify URL is accessible
|
||||
- Check network connectivity
|
||||
- Validate JSON syntax in headers/body
|
||||
- Review Stream Deck logs
|
||||
|
||||
Le plugin utilise le système de logging du SDK Stream Deck avec des scopes séparés :
|
||||
3. **JSON Validation Errors**
|
||||
- Use the "Beautify JSON" button to format
|
||||
- Check for missing quotes, commas, or brackets
|
||||
- Ensure headers are objects, not arrays
|
||||
|
||||
```typescript
|
||||
// Logs disponibles dans : com.mr-kayjaydee.webhooks-trigger.sdPlugin/logs/
|
||||
const logger = streamDeck.logger.createScope("SendWebhook");
|
||||
logger.info("Message d'information");
|
||||
logger.debug("Message de debug");
|
||||
logger.error("Message d'erreur");
|
||||
```
|
||||
### Debug Logging
|
||||
|
||||
**Localisation des logs** : `com.mr-kayjaydee.webhooks-trigger.sdPlugin/logs/com.mr-kayjaydee.webhooks-trigger.0.log`
|
||||
The plugin includes comprehensive logging. To view logs:
|
||||
|
||||
### Tests et debugging
|
||||
1. Open Stream Deck software
|
||||
2. Go to preferences → Advanced → Enable debug logging
|
||||
3. Check the plugin logs directory
|
||||
|
||||
1. **Vérifier les logs**
|
||||
## 📄 License
|
||||
|
||||
```bash
|
||||
tail -f com.mr-kayjaydee.webhooks-trigger.sdPlugin/logs/*.log
|
||||
```
|
||||
This project is licensed under the MIT License.
|
||||
|
||||
2. **Mode développement avec auto-restart**
|
||||
## 👤 Author
|
||||
|
||||
```bash
|
||||
npm run watch
|
||||
```
|
||||
**Mr-KayJayDee**
|
||||
|
||||
3. **Tester avec webhook.site**
|
||||
- Aller sur https://webhook.site
|
||||
- Copier l'URL unique générée
|
||||
- Configurer le plugin avec cette URL
|
||||
- Vérifier les requêtes reçues sur le site
|
||||
## 🤝 Contributing
|
||||
|
||||
4. **Redémarrer après modifications**
|
||||
```bash
|
||||
npm run restart
|
||||
```
|
||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||
|
||||
## 🐛 Dépannage
|
||||
## 📊 System Requirements
|
||||
|
||||
### Problèmes courants
|
||||
|
||||
**❌ Plugin ne s'installe pas**
|
||||
|
||||
- Vérifier que Stream Deck software est fermé pendant l'installation
|
||||
- Utiliser `streamdeck dev` pour activer le mode développeur
|
||||
- Vérifier les permissions du dossier
|
||||
|
||||
**❌ Requête échoue (X rouge)**
|
||||
|
||||
- Vérifier l'URL dans un navigateur
|
||||
- Valider le JSON des headers/body avec les boutons de validation
|
||||
- Consulter les logs pour les détails d'erreur
|
||||
- Vérifier la connectivité réseau
|
||||
|
||||
**❌ Configuration ne se sauvegarde pas**
|
||||
|
||||
- Vérifier la syntaxe JSON avec les boutons de validation
|
||||
- Utiliser le bouton "Verify Configuration"
|
||||
- Redémarrer Stream Deck si nécessaire
|
||||
|
||||
**❌ Bouton reste gris**
|
||||
|
||||
- Configuration incomplète (URL manquante)
|
||||
- JSON headers/body invalide
|
||||
- Consulter les logs pour les détails
|
||||
|
||||
**❌ Build échoue**
|
||||
|
||||
- Vérifier que Node.js 20+ est installé
|
||||
- Supprimer `node_modules` et relancer `npm install`
|
||||
- Vérifier les erreurs TypeScript
|
||||
|
||||
### Support et logs
|
||||
|
||||
Pour obtenir de l'aide :
|
||||
|
||||
1. Activer les logs détaillés
|
||||
2. Reproduire le problème
|
||||
3. Consulter les logs dans `logs/com.mr-kayjaydee.webhooks-trigger.0.log`
|
||||
4. Inclure les logs dans votre rapport de bug
|
||||
|
||||
## 🏗️ Technologies utilisées
|
||||
|
||||
- **Stream Deck SDK v1.0.0** : SDK officiel Elgato
|
||||
- **TypeScript 5.2+** : Langage principal avec typage fort
|
||||
- **Node.js 20** : Runtime JavaScript
|
||||
- **Rollup** : Bundler pour la compilation
|
||||
- **SDPI Components** : Composants UI Stream Deck
|
||||
|
||||
## 📄 Licence
|
||||
|
||||
Ce projet est sous licence MIT. Voir le fichier `LICENSE` pour plus de détails.
|
||||
|
||||
## 🤝 Contribution
|
||||
|
||||
Les contributions sont les bienvenues ! Merci de :
|
||||
|
||||
1. Fork le projet
|
||||
2. Créer une branche feature (`git checkout -b feature/amazing-feature`)
|
||||
3. Commit avec le format : `feat(webhook): description en français`
|
||||
4. Push vers la branche (`git push origin feature/amazing-feature`)
|
||||
5. Ouvrir une Pull Request
|
||||
|
||||
### Format des commits
|
||||
|
||||
```
|
||||
type(scope): description en français
|
||||
|
||||
Types autorisés : feat, fix, docs, refactor, test, chore
|
||||
Exemples :
|
||||
- feat(validation): ajout de la validation JSON en temps réel
|
||||
- fix(ui): correction du bug d'affichage des erreurs
|
||||
- docs(readme): mise à jour de la documentation
|
||||
- refactor(services): simplification de l'architecture
|
||||
```
|
||||
|
||||
## ✨ Remerciements
|
||||
|
||||
- [Elgato Stream Deck SDK](https://docs.elgato.com/sdk/) pour l'excellent SDK
|
||||
- [SDPI Components](https://sdpi-components.dev/) pour les composants UI
|
||||
- La communauté Stream Deck pour les retours et suggestions
|
||||
- **Stream Deck Software**: 6.5 or higher
|
||||
- **Operating System**:
|
||||
- Windows 10 or higher
|
||||
- macOS 12 or higher
|
||||
- **Node.js**: Version 20 or higher
|
||||
|
Reference in New Issue
Block a user