feat: implement security, discovery, history, file transfer, web UI (P0-P3)
This commit is contained in:
@@ -20,6 +20,11 @@ Copier sur une machine → coller sur une autre, automatiquement et instantaném
|
||||
|
||||
- **Bidirectionnel** — copie A → B et B → A, chaque nœud est client et serveur
|
||||
- **Anti-boucle** — double filtre (hash SHA-256 + timestamp/origine) empêche le ping-pong
|
||||
- **Sécurité** — clé partagée (Bearer token), validation d'origine, TLS optionnel
|
||||
- **Découverte mDNS** — détection automatique des pairs (optionnelle)
|
||||
- **Historique** — derniers clips conservés (`clip-sync history`)
|
||||
- **Transfert de fichiers** — `clip-sync send-file` (réception optionnelle)
|
||||
- **Interface web** — monitoring local sur `http://localhost:9137/`
|
||||
- **Multi-plateforme** — Linux (X11/Wayland), Windows, macOS
|
||||
- **Binaire unique** — zéro runtime externe, compilation Go native
|
||||
- **Configuration simple** — fichier TOML + variables d'environnement
|
||||
@@ -57,12 +62,12 @@ clip-sync détecte automatiquement X11 vs Wayland via `$XDG_SESSION_TYPE`.
|
||||
```bash
|
||||
# amd64
|
||||
curl -sSL -o ~/.local/bin/clip-sync \
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-linux-amd64
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-linux-amd64
|
||||
chmod +x ~/.local/bin/clip-sync
|
||||
|
||||
# arm64 (Raspberry Pi, etc.)
|
||||
curl -sSL -o ~/.local/bin/clip-sync \
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-linux-arm64
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-linux-arm64
|
||||
chmod +x ~/.local/bin/clip-sync
|
||||
```
|
||||
|
||||
@@ -78,7 +83,7 @@ source ~/.bashrc
|
||||
|
||||
```bash
|
||||
clip-sync --version
|
||||
# → clip-sync v0.1.0
|
||||
# → clip-sync v0.2.0
|
||||
```
|
||||
|
||||
**5. Installer comme service (systemd --user)**
|
||||
@@ -103,12 +108,12 @@ systemctl --user status clip-sync
|
||||
```bash
|
||||
# Apple Silicon (M1/M2/M3)
|
||||
curl -sSL -o ~/.local/bin/clip-sync \
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-darwin-arm64
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-darwin-arm64
|
||||
chmod +x ~/.local/bin/clip-sync
|
||||
|
||||
# Intel Mac
|
||||
curl -sSL -o ~/.local/bin/clip-sync \
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-darwin-amd64
|
||||
https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-darwin-amd64
|
||||
chmod +x ~/.local/bin/clip-sync
|
||||
```
|
||||
|
||||
@@ -123,7 +128,7 @@ source ~/.zshrc
|
||||
|
||||
```bash
|
||||
clip-sync --version
|
||||
# → clip-sync v0.1.0
|
||||
# → clip-sync v0.2.0
|
||||
```
|
||||
|
||||
**5. Installer comme service (launchd)**
|
||||
@@ -168,12 +173,12 @@ launchctl list | grep clip-sync
|
||||
```powershell
|
||||
# amd64 (standard)
|
||||
Invoke-WebRequest -Uri `
|
||||
"https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-windows-amd64.exe" `
|
||||
"https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-windows-amd64.exe" `
|
||||
-OutFile "$env:USERPROFILE\bin\clip-sync.exe"
|
||||
|
||||
# arm64 (Surface Pro X, etc.)
|
||||
Invoke-WebRequest -Uri `
|
||||
"https://git.dracodev.net/Projets/clip-sync/releases/download/latest/clip-sync-windows-arm64.exe" `
|
||||
"https://git.dracodev.net/Projets/clip-sync/releases/download/v0.2.0/clip-sync-windows-arm64.exe" `
|
||||
-OutFile "$env:USERPROFILE\bin\clip-sync.exe"
|
||||
```
|
||||
|
||||
@@ -192,7 +197,7 @@ Invoke-WebRequest -Uri `
|
||||
|
||||
```powershell
|
||||
clip-sync --version
|
||||
# → clip-sync v0.1.0
|
||||
# → clip-sync v0.2.0
|
||||
```
|
||||
|
||||
**5. Installer comme service Windows (NSSM)**
|
||||
@@ -274,10 +279,21 @@ Copiez du texte sur la machine A (Ctrl+C), collez sur la machine B (Ctrl+V).
|
||||
|
||||
| Clé | Défaut | Description |
|
||||
|-----|--------|-------------|
|
||||
| `daemon.port` | `9137` | Port d'écoute HTTP |
|
||||
| `daemon.port` | `9137` | Port d'écoute HTTP(S) |
|
||||
| `daemon.poll_interval_ms` | `500` | Intervalle de scrutation du presse-papiers (ms) |
|
||||
| `daemon.max_body_bytes` | `10485760` | Taille max d'une requête (10 MiB) |
|
||||
| `daemon.history_size` | `50` | Nombre d'entrées conservées dans l'historique |
|
||||
| `daemon.discovery` | `false` | Découverte automatique des pairs via mDNS |
|
||||
| `daemon.notify` | `false` | Notifications desktop à chaque clip reçu |
|
||||
| `daemon.receive_files` | `false` | Accepter les transferts de fichiers |
|
||||
| `daemon.receive_dir` | `~/Downloads/clip-sync` | Dossier de réception des fichiers |
|
||||
| `security.shared_key` | — | Clé partagée (`clip-sync --generate-key`) |
|
||||
| `security.allowed_origins` | — | Liste des hôtes autorisés |
|
||||
| `security.tls` | `false` | Chiffrement TLS entre pairs |
|
||||
| `security.cert_file` / `key_file` | `~/.config/clip-sync/{cert,key}.pem` | Certificat auto-signé |
|
||||
| `peers[].name` | — | Nom descriptif du pair |
|
||||
| `peers[].addr` | — | Adresse `host:port` du pair |
|
||||
| `peers[].tls` | `false` | TLS pour ce pair (override global) |
|
||||
|
||||
### Variables d'environnement (override)
|
||||
|
||||
@@ -285,6 +301,43 @@ Copiez du texte sur la machine A (Ctrl+C), collez sur la machine B (Ctrl+V).
|
||||
|----------|-----------------|
|
||||
| `CLIP_SYNC_PORT` | `daemon.port` |
|
||||
| `CLIP_SYNC_POLL_MS` | `daemon.poll_interval_ms` |
|
||||
| `CLIP_SYNC_KEY` | `security.shared_key` |
|
||||
| `CLIP_SYNC_MAX_BODY_BYTES` | `daemon.max_body_bytes` |
|
||||
|
||||
## Commandes
|
||||
|
||||
```bash
|
||||
clip-sync # lancer le daemon
|
||||
clip-sync --config <path> # config personnalisée
|
||||
clip-sync --version # afficher la version
|
||||
clip-sync history # afficher l'historique local
|
||||
clip-sync --one-shot [text] # envoyer le presse-papiers (ou text) une fois
|
||||
clip-sync send-file <path> # envoyer un fichier aux pairs
|
||||
clip-sync --generate-key # générer une clé partagée
|
||||
clip-sync --generate-cert # générer un certificat TLS auto-signé
|
||||
```
|
||||
|
||||
## Sécurité
|
||||
|
||||
Sur un réseau partagé, activez au minimum une clé partagée :
|
||||
|
||||
```bash
|
||||
clip-sync --generate-key # → copier la clé sur toutes les machines
|
||||
```
|
||||
|
||||
```toml
|
||||
[security]
|
||||
shared_key = "LA_CLÉ_GÉNÉRÉE"
|
||||
```
|
||||
|
||||
Pour chiffrer le trafic, générez un certificat sur une machine, copiez les
|
||||
fichiers `cert.pem`/`key.pem` vers toutes les autres, puis :
|
||||
|
||||
```toml
|
||||
[security]
|
||||
tls = true
|
||||
insecure_skip_verify = true # confiance au certificat auto-signé partagé
|
||||
```
|
||||
|
||||
## Déboguer
|
||||
|
||||
@@ -295,6 +348,8 @@ curl -X POST http://192.168.1.20:9137/clip \
|
||||
-d '{"text":"test","ts":0,"origin":"debug"}'
|
||||
```
|
||||
|
||||
L'interface de monitoring est disponible sur `http://localhost:9137/` après le démarrage du daemon.
|
||||
|
||||
## Licence
|
||||
|
||||
MIT © 2026
|
||||
|
||||
Reference in New Issue
Block a user