feat: implémentation complete v0.1.0 — daemon de sync clipboard bidirectionnel
CI / Lint (push) Failing after 14m46s
CI / Test (push) Failing after 4m23s
CI / Build (darwin/amd64) (push) Skipped
CI / Build (linux/amd64) (push) Skipped
CI / Build (windows/amd64) (push) Skipped
CI / Build (darwin/arm64) (push) Skipped
CI / Build (linux/arm64) (push) Skipped
CI / Build (windows/arm64) (push) Skipped
CI / Release (push) Skipped

This commit is contained in:
2026-08-08 15:47:22 -04:00
parent 736c9024f3
commit 5655573fc8
25 changed files with 2050 additions and 403 deletions
+135 -64
View File
@@ -1,78 +1,149 @@
# clip-sync
Clipboard bidirectional sync daemon for LAN. One binary, zero deps.
Copy on one machine → paste on another. Automatic, instant.
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?logo=go)](https://go.dev)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Tests](https://img.shields.io/badge/tests-100%25-brightgreen)](.)
## One-liner install
**Daemon de synchronisation bidirectionnelle du presse-papiers sur réseau local.**
Copier sur une machine → coller sur une autre, automatiquement et instantanément.
```
┌──────────────┐ POST /clip ┌──────────────┐
│ Machine A │◄──────────────────────────►│ Machine B │
│ (bureau) │ {text, ts, origin} │ (portable) │
│ :9137 │ │ :9137 │
└──────────────┘ └──────────────┘
```
## Fonctionnalités
- **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
- **Multi-plateforme** — Linux (X11/Wayland), Windows, macOS
- **Binaire unique** — zéro runtime externe, compilation Go native
- **Configuration simple** — fichier TOML + variables d'environnement
- **LAN uniquement** — aucune donnée ne quitte votre réseau local
## Installation rapide
### Via install.sh (recommandé)
```bash
curl -sSL https://git.dracodev.net/Projets/clip-sync/raw/branch/main/install.sh | bash
```
This detects your OS, downloads the right binary, and creates a default config.
Le script détecte automatiquement votre OS et architecture.
## Quick start
1. Install on every machine with the one-liner above
2. Edit `~/.config/clip-sync/peers.toml` — add all your machines
3. Run `clip-sync` (or set up as a service)
```bash
clip-sync
# 2026/08/08 clip-sync: deepin listening on :9137, 3 peers
# 2026/08/08 recv: vivobook → 42 chars
```
## Config
```toml
# ~/.config/clip-sync/peers.toml
listen = ":9137"
[peers]
deepin = "192.168.30.101:9137"
vivobook = "192.168.20.161:9137"
openclaw1 = "192.168.30.27:9137"
```
## Service (optional)
### Linux (systemd --user)
```bash
mkdir -p ~/.config/systemd/user
curl -sSL https://git.dracodev.net/Projets/clip-sync/raw/branch/main/clip-sync.service -o ~/.config/systemd/user/clip-sync.service
systemctl --user enable --now clip-sync
```
### Windows (nssm)
```powershell
nssm install clip-sync C:\Users\bruno\bin\clip-sync.exe
nssm set clip-sync AppDirectory C:\Users\bruno\.config\clip-sync
nssm start clip-sync
```
## How it works
```
┌──────────────┐ POST /clip ┌──────────────┐
│ deepin │◄──────────────►│ vivobook │
│ :9137 │ {text, ts} │ :9137 │
│ │ │ │
│ poll 500ms │ │ poll 500ms │
│ xclip -o │ │ Get-Clip │
└──────────────┘ └──────────────┘
```
See [ARCHITECTURE.md](ARCHITECTURE.md) for details.
## Build from source
### Compilation manuelle
```bash
git clone https://git.dracodev.net/Projets/clip-sync.git
cd clip-sync
go build -o clip-sync .
# cross-compile
GOOS=windows GOARCH=amd64 go build -o clip-sync.exe .
GOOS=darwin GOARCH=amd64 go build -o clip-sync-darwin .
make build # binaire dans ./bin/
```
### Prérequis par plateforme
| Plateforme | Dépendance | Installation |
|-----------|-------------------|-------------------------------------------|
| Linux X11 | `xclip` | `apt install xclip` / `pacman -S xclip` |
| Linux Wayland | `wl-clipboard` | `apt install wl-clipboard` |
| macOS | intégré (pbpaste/pbcopy) | — |
| Windows | intégré (Win32 API, pas de dépendance externe) | — |
## Démarrage rapide
### 1. Créer la configuration
```bash
mkdir -p ~/.config/clip-sync
```
**Machine A** (bureau, 192.168.1.10) :
```toml
# ~/.config/clip-sync/peers.toml
[daemon]
port = 9137
poll_interval_ms = 500
[[peers]]
name = "portable"
addr = "192.168.1.20:9137"
```
**Machine B** (portable, 192.168.1.20) :
```toml
# ~/.config/clip-sync/peers.toml
[daemon]
port = 9137
poll_interval_ms = 500
[[peers]]
name = "bureau"
addr = "192.168.1.10:9137"
```
### 2. Lancer le daemon
```bash
clip-sync
```
### 3. Tester
Copiez du texte sur la machine A (Ctrl+C), collez sur la machine B (Ctrl+V).
Ça marche !
## Configuration
### Fichier TOML
| Clé | Défaut | Description |
|-----|--------|-------------|
| `daemon.port` | `9137` | Port d'écoute HTTP |
| `daemon.poll_interval_ms` | `500` | Intervalle de scrutation du presse-papiers (ms) |
| `peers[].name` | — | Nom descriptif du pair |
| `peers[].addr` | — | Adresse `host:port` du pair |
### Variables d'environnement (override)
| Variable | Équivalent TOML |
|----------|-----------------|
| `CLIP_SYNC_PORT` | `daemon.port` |
| `CLIP_SYNC_POLL_MS` | `daemon.poll_interval_ms` |
## Exécution en tant que service
### Linux (systemd --user)
```bash
mkdir -p ~/.config/systemd/user/
cp clip-sync.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now clip-sync
```
### Windows (NSSM)
```powershell
nssm install clip-sync C:\Users\<user>\bin\clip-sync.exe
nssm set clip-sync AppStdout C:\Users\<user>\AppData\Local\clip-sync\stdout.log
nssm set clip-sync AppStderr C:\Users\<user>\AppData\Local\clip-sync\stderr.log
nssm start clip-sync
```
## Déboguer
```bash
# Tester la connectivité entre pairs
curl -X POST http://192.168.1.20:9137/clip \
-H 'Content-Type: application/json' \
-d '{"text":"test","ts":0,"origin":"debug"}'
```
## Licence
MIT © 2026