From 2dd9c7d279efce83287fec9b5a75b709ef3ede33 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Mon, 8 Dec 2025 16:00:02 -0500 Subject: [PATCH] Show app version and diagnostics in build scripts --- main.go | 53 +++++++++++++-- scripts/build-linux.sh | 11 +++- scripts/build.sh | 145 +++++++++++++++++------------------------ 3 files changed, 113 insertions(+), 96 deletions(-) mode change 100755 => 100644 scripts/build.sh diff --git a/main.go b/main.go index 6d08e2c..ffc32e3 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "image/png" "io" "math" + "net/url" "os" "os/exec" "path/filepath" @@ -63,8 +64,10 @@ var ( conversionLogSuffix = ".videotools.log" - logsDirOnce sync.Once - logsDirPath string + logsDirOnce sync.Once + logsDirPath string + feedbackBundler = newFeedbackBundler() + appVersion = "v0.1.0-dev14" modulesList = []Module{ {"convert", "Convert", utils.MustHex("#8B44FF"), "Convert", modules.HandleConvert}, // Violet @@ -215,6 +218,33 @@ func openFolder(path string) error { return cmd.Start() } +func (s *appState) showAbout() { + version := fmt.Sprintf("VideoTools %s", appVersion) + dev := "Leak Technologies" + logsPath := getLogsDir() + + versionText := widget.NewLabel(version) + devText := widget.NewLabel(fmt.Sprintf("Developer: %s", dev)) + logsLink := widget.NewButton("Open Logs Folder", func() { + if err := openFolder(logsPath); err != nil { + dialog.ShowError(fmt.Errorf("failed to open logs folder: %w", err), s.window) + } + }) + logsLink.Importance = widget.LowImportance + + donateURL, _ := url.Parse("https://leaktechnologies.dev/support") + donateLink := widget.NewHyperlink("Support development", donateURL) + + body := container.NewVBox( + versionText, + devText, + logsLink, + donateLink, + widget.NewLabel("Feedback: use the Logs button on the main menu to view logs; send issues with attached logs."), + ) + dialog.ShowCustom("About & Support", "Close", body, s.window) +} + type formatOption struct { Label string Ext string @@ -618,13 +648,22 @@ func (s *appState) showMainMenu() { // Update stats bar s.updateStatsBar() + // Footer with version info and a small About/Support button + versionLabel := widget.NewLabel(fmt.Sprintf("VideoTools %s", appVersion)) + versionLabel.Alignment = fyne.TextAlignLeading + aboutBtn := widget.NewButton("About / Support", func() { + s.showAbout() + }) + aboutBtn.Importance = widget.LowImportance + footer := container.NewBorder(nil, nil, nil, aboutBtn, versionLabel) + // Add stats bar at the bottom of the menu content := container.NewBorder( - nil, // top - s.statsBar, // bottom - nil, // left - nil, // right - container.NewPadded(menu), // center + nil, // top + container.NewVBox(s.statsBar, footer), // bottom + nil, // left + nil, // right + container.NewPadded(menu), // center ) s.setContent(content) diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index c9d1dab..aa72af8 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -6,6 +6,9 @@ set -e PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BUILD_OUTPUT="$PROJECT_ROOT/VideoTools" +# Extract app version from main.go +APP_VERSION="$(grep -E 'appVersion\s*=\s*\"' "$PROJECT_ROOT/main.go" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')" +[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)" echo "════════════════════════════════════════════════════════════════" echo " VideoTools Build Script" @@ -41,14 +44,15 @@ echo "🔨 Building VideoTools..." # Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled. export CGO_ENABLED=1 if go build -o "$BUILD_OUTPUT" .; then - echo "✓ Build successful!" + echo "✓ Build successful! (VideoTools $APP_VERSION)" echo "" echo "════════════════════════════════════════════════════════════════" - echo "✅ BUILD COMPLETE" + echo "✅ BUILD COMPLETE - $APP_VERSION" echo "════════════════════════════════════════════════════════════════" echo "" echo "Output: $BUILD_OUTPUT" echo "Size: $(du -h "$BUILD_OUTPUT" | cut -f1)" + echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')" echo "" echo "To run:" echo " $PROJECT_ROOT/VideoTools" @@ -58,6 +62,7 @@ if go build -o "$BUILD_OUTPUT" .; then echo " VideoTools" echo "" else - echo "❌ Build failed!" + echo "❌ Build failed! (VideoTools $APP_VERSION)" + echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')" exit 1 fi diff --git a/scripts/build.sh b/scripts/build.sh old mode 100755 new mode 100644 index a14ecf2..f119812 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,12 +1,14 @@ #!/bin/bash -# VideoTools Universal Build Script -# Auto-detects platform and builds accordingly - +# VideoTools Universal Build Script (Linux/macOS/Windows via Git Bash) set -e PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Extract app version from main.go +APP_VERSION="$(grep -E 'appVersion\s*=\s*"' "$PROJECT_ROOT/main.go" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')" +[ -z "$APP_VERSION" ] && APP_VERSION="(version unknown)" + echo "════════════════════════════════════════════════════════════════" echo " VideoTools Universal Build Script" echo "════════════════════════════════════════════════════════════════" @@ -14,30 +16,18 @@ echo "" # Detect platform PLATFORM="$(uname -s)" -case "${PLATFORM}" in - Linux*) - OS="Linux" - ;; - Darwin*) - OS="macOS" - ;; - CYGWIN*|MINGW*|MSYS*) - OS="Windows" - ;; - *) - echo "❌ Unknown platform: ${PLATFORM}" - exit 1 - ;; +case "$PLATFORM" in + Linux*) OS="Linux" ;; + Darwin*) OS="macOS" ;; + CYGWIN*|MINGW*|MSYS*) OS="Windows" ;; + *) echo "❌ Unknown platform: $PLATFORM"; exit 1 ;; esac - echo "🔍 Detected platform: $OS" echo "" -# Check if go is installed -if ! command -v go &> /dev/null; then - echo "❌ ERROR: Go is not installed. Please install Go 1.21 or later." - echo "" - echo "Download from: https://go.dev/dl/" +# Go check +if ! command -v go >/dev/null 2>&1; then + echo "❌ ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)." exit 1 fi @@ -45,85 +35,68 @@ echo "📦 Go version:" go version echo "" -# Route to appropriate build script +diagnostics() { + echo "Diagnostics: version=$APP_VERSION os=$OS arch=$(uname -m) go=$(go version | awk '{print $3}')" +} + case "$OS" in - Linux) - echo "→ Building for Linux..." + Linux|macOS) + echo "→ Building VideoTools $APP_VERSION for $OS..." echo "" exec "$SCRIPT_DIR/build-linux.sh" ;; - - macOS) - echo "→ Building for macOS..." - echo "" - # macOS uses same build process as Linux (native build) - exec "$SCRIPT_DIR/build-linux.sh" - ;; - Windows) - echo "→ Building for Windows..." + echo "→ Building VideoTools $APP_VERSION for Windows..." + echo "" + cd "$PROJECT_ROOT" + + echo "🧹 Cleaning previous builds..." + rm -f VideoTools.exe 2>/dev/null || true + echo "✓ Cache cleaned" echo "" - # Check if running in Git Bash or similar - if command -v go.exe &> /dev/null; then - # Windows native build - cd "$PROJECT_ROOT" + echo "⬇️ Downloading dependencies..." + go mod download + echo "✓ Dependencies downloaded" + echo "" - echo "🧹 Cleaning previous builds..." - rm -f VideoTools.exe 2>/dev/null || true - echo "✓ Cache cleaned" + echo "🔨 Building VideoTools $APP_VERSION for Windows..." + export CGO_ENABLED=1 + if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then + echo "✓ Build successful! (VideoTools $APP_VERSION)" echo "" - - echo "⬇️ Downloading dependencies..." - go mod download - echo "✓ Dependencies downloaded" - echo "" - - echo "🔨 Building VideoTools for Windows..." - export CGO_ENABLED=1 - - # Build with Windows GUI flags - if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then - echo "✓ Build successful!" + if [ -f "setup-windows.bat" ]; then + echo "════════════════════════════════════════════════════════════════" + echo "✅ BUILD COMPLETE - $APP_VERSION" + echo "════════════════════════════════════════════════════════════════" echo "" - - # Run setup script to get FFmpeg - if [ -f "setup-windows.bat" ]; then - echo "════════════════════════════════════════════════════════════════" - echo "✅ BUILD COMPLETE" - echo "════════════════════════════════════════════════════════════════" - echo "" - echo "Output: VideoTools.exe" - if [ -f "VideoTools.exe" ]; then - SIZE=$(du -h VideoTools.exe 2>/dev/null | cut -f1 || echo "unknown") - echo "Size: $SIZE" - fi - echo "" + echo "Output: VideoTools.exe" + if [ -f "VideoTools.exe" ]; then + SIZE=$(du -h VideoTools.exe 2>/dev/null | cut -f1 || echo "unknown") + echo "Size: $SIZE" + fi + diagnostics + echo "" + echo "Next step: Get FFmpeg" + echo " Run: setup-windows.bat" + echo " Or: .\\scripts\\setup-windows.ps1 -Portable" + echo "" + if ffmpeg -version >/dev/null 2>&1 && ffprobe -version >/dev/null 2>&1; then + echo "FFmpeg detected on PATH. Skipping bundled download." + else + echo "FFmpeg not detected on PATH." echo "Next step: Get FFmpeg" echo " Run: setup-windows.bat" - echo " Or: .\scripts\setup-windows.ps1 -Portable" - echo "" - - if ffmpeg -version >/dev/null 2>&1 && ffprobe -version >/dev/null 2>&1; then - echo "FFmpeg detected on PATH. Skipping bundled download." - else - echo "FFmpeg not detected on PATH." - echo "Next step: Get FFmpeg" - echo " Run: setup-windows.bat" - echo " Or: .\\scripts\\setup-windows.ps1 -Portable" - echo "You can skip if FFmpeg is already installed elsewhere." - fi - else - echo "✓ Build complete: VideoTools.exe" + echo " Or: .\\scripts\\setup-windows.ps1 -Portable" + echo "You can skip if FFmpeg is already installed elsewhere." fi else - echo "❌ Build failed!" - exit 1 + echo "✓ Build complete: VideoTools.exe" + diagnostics fi else - echo "❌ ERROR: go.exe not found." - echo "Please ensure Go is properly installed on Windows." - echo "Download from: https://go.dev/dl/" + echo "❌ Build failed! (VideoTools $APP_VERSION)" + diagnostics exit 1 fi ;;