Detect missing Syncthing, rewrite README with architecture diagram
Some checks failed
Release / build (push) Failing after 2m53s

Add Syncthing installation detection (PATH + config file check) to both
the tray app and setup installer. When missing, the tray shows an
"Install Syncthing..." menu item and the setup opens the download page.

Rewrite README with Mermaid topology graph, per-binary dependency tables,
project layout, API endpoint reference, and shields.io badges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-03-04 00:08:34 +01:00
parent 11e5c9b915
commit 99eeffcbe4
6 changed files with 259 additions and 26 deletions

View File

@@ -0,0 +1,23 @@
package syncthing
import (
"os"
"os/exec"
"git.davoryn.de/calic/syncwarden/internal/config"
)
// DownloadURL is the official Syncthing downloads page.
const DownloadURL = "https://syncthing.net/downloads/"
// IsInstalled returns true if Syncthing appears to be installed.
// It checks both PATH and the existence of a Syncthing config file.
func IsInstalled() bool {
if _, err := exec.LookPath("syncthing"); err == nil {
return true
}
if _, err := os.Stat(config.SyncthingConfigPath()); err == nil {
return true
}
return false
}

View File

@@ -25,6 +25,13 @@ func (a *App) buildMenu() {
a.lastSyncItem = systray.AddMenuItem("Last sync: —", "")
a.lastSyncItem.Disable()
if a.syncthingMissing {
mInstall := systray.AddMenuItem("Install Syncthing...", "Download Syncthing")
mInstall.Click(func() {
openBrowser(st.DownloadURL)
})
}
systray.AddSeparator()
// Open Admin Panel

View File

@@ -14,7 +14,7 @@ import (
st "git.davoryn.de/calic/syncwarden/internal/syncthing"
)
const version = "0.1.0"
const version = "0.2.0"
// App manages the tray icon and Syncthing monitoring.
type App struct {
@@ -37,6 +37,8 @@ type App struct {
conflictItem *systray.MenuItem
folderItems []*systray.MenuItem
recentItems []*systray.MenuItem
syncthingMissing bool
}
// Run starts the tray application (blocking).
@@ -59,10 +61,20 @@ func (a *App) onReady() {
a.client = st.NewClient(a.cfg.BaseURL(), a.cfg.SyncthingAPIKey)
// Check if Syncthing is installed
if !st.IsInstalled() {
a.syncthingMissing = true
log.Println("Syncthing not found on this system")
}
// Set initial icon
a.setState(icons.StateDisconnected)
systray.SetTitle("SyncWarden")
systray.SetTooltip("SyncWarden: connecting...")
if a.syncthingMissing {
systray.SetTooltip("SyncWarden: Syncthing not found")
} else {
systray.SetTooltip("SyncWarden: connecting...")
}
// Right-click shows menu
systray.SetOnRClick(func(menu systray.IMenu) {