Detect missing Syncthing, rewrite README with architecture diagram
Some checks failed
Release / build (push) Failing after 2m53s
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:
@@ -11,6 +11,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.davoryn.de/calic/syncwarden/internal/config"
|
||||
st "git.davoryn.de/calic/syncwarden/internal/syncthing"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -173,13 +174,29 @@ func runInstall() {
|
||||
fmt.Println()
|
||||
fmt.Printf("Launch SyncWarden: %s\n", trayPath)
|
||||
|
||||
// Check if Syncthing is installed
|
||||
if !st.IsInstalled() {
|
||||
fmt.Println()
|
||||
fmt.Println("Note: Syncthing is not installed.")
|
||||
fmt.Printf("Download it from: %s\n", st.DownloadURL)
|
||||
if isInteractive() {
|
||||
openURL(st.DownloadURL)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
showMessage("SyncWarden — Setup",
|
||||
"Setup completed with warnings:\n\n"+strings.Join(errors, "\n")+
|
||||
"\n\nSuccessfully installed "+fmt.Sprint(installed)+" binaries to:\n"+dst, true)
|
||||
msg := "Setup completed with warnings:\n\n" + strings.Join(errors, "\n") +
|
||||
"\n\nSuccessfully installed " + fmt.Sprint(installed) + " binaries to:\n" + dst
|
||||
if !st.IsInstalled() {
|
||||
msg += "\n\nNote: Syncthing is not installed.\nDownload it from: " + st.DownloadURL
|
||||
}
|
||||
showMessage("SyncWarden — Setup", msg, true)
|
||||
} else {
|
||||
showMessage("SyncWarden — Setup",
|
||||
"Setup complete!\n\nSyncWarden is running.\n\nIt will auto-discover your Syncthing API key.", false)
|
||||
msg := "Setup complete!\n\nSyncWarden is running.\n\nIt will auto-discover your Syncthing API key."
|
||||
if !st.IsInstalled() {
|
||||
msg += "\n\nNote: Syncthing is not installed.\nDownload it from: " + st.DownloadURL
|
||||
}
|
||||
showMessage("SyncWarden — Setup", msg, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +345,19 @@ func removeAutostartWindows() error {
|
||||
return os.Remove(lnkPath)
|
||||
}
|
||||
|
||||
func openURL(url string) {
|
||||
var cmd *exec.Cmd
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
|
||||
case "darwin":
|
||||
cmd = exec.Command("open", url)
|
||||
default:
|
||||
cmd = exec.Command("xdg-open", url)
|
||||
}
|
||||
_ = cmd.Start()
|
||||
}
|
||||
|
||||
func removeAutostartLinux() error {
|
||||
desktopPath := filepath.Join(os.Getenv("HOME"), ".config", "autostart", "syncwarden.desktop")
|
||||
if _, err := os.Stat(desktopPath); os.IsNotExist(err) {
|
||||
|
||||
Reference in New Issue
Block a user