Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Windows setup UI + MSI launcher & frontend tweaks

Juan Denisbcaa3dff2d8e
diff --git a/VERSION b/VERSION
index 63ebd3fe..fa5512ae 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.4
\ No newline at end of file
+1.5.8
\ No newline at end of file
diff --git a/agent/internal/setupui/darkmode_windows.go b/agent/internal/setupui/darkmode_windows.go
new file mode 100644
index 00000000..08ccf12c
--- /dev/null
+++ b/agent/internal/setupui/darkmode_windows.go
@@ -0,0 +1,40 @@
+//go:build windows
+
+package setupui
+
+import (
+ "syscall"
+ "unsafe"
+
+ "github.com/lxn/walk"
+)
+
+// enableDarkMode flips the window's title bar to the dark colour scheme on
+// Windows 10/11 and registers the process as dark-mode aware so native
+// controls (Edit, Button, ScrollBar) follow suit on Win11.
+//
+// Belt-and-braces: try the documented Win11 attribute (20), fall back to the
+// undocumented Win10 1903+ value (19); call SetPreferredAppMode via its
+// uxtheme ordinal export. All calls are best-effort and silently ignored on
+// older builds where the API isn't present.
+func enableDarkMode(form walk.Form) {
+ if form == nil {
+ return
+ }
+ hwnd := form.Handle()
+ if hwnd == 0 {
+ return
+ }
+
+ dwmapi := syscall.NewLazyDLL("dwmapi.dll")
+ setAttr := dwmapi.NewProc("DwmSetWindowAttribute")
+ var enable int32 = 1
+ setAttr.Call(uintptr(hwnd), 20, uintptr(unsafe.Pointer(&enable)), 4)
+ setAttr.Call(uintptr(hwnd), 19, uintptr(unsafe.Pointer(&enable)), 4)
+
+ uxtheme := syscall.NewLazyDLL("uxtheme.dll")
+ // SetPreferredAppMode(AllowDark = 1). Ordinal #135 on Win10 1903+.
+ if proc := uxtheme.NewProc("SetPreferredAppMode"); proc != nil && proc.Find() == nil {
+ proc.Call(1)
+ }
+}
diff --git a/agent/internal/setupui/theme_windows.go b/agent/internal/setupui/theme_windows.go
new file mode 100644
index 00000000..21d25eab
--- /dev/null
+++ b/agent/internal/setupui/theme_windows.go
@@ -0,0 +1,99 @@
+//go:build windows
+
+package setupui
+
+import (
+ "github.com/lxn/walk"
+ dec "github.com/lxn/walk/declarative"
+ "golang.org/x/sys/windows/registry"
+)
+
+// palette holds the colour tokens used by the wizard. We carry separate
+// light/dark instances and pick at startup based on the user's Windows
+// theme, mirroring the panel's own light/dark behaviour.
+type palette struct {
+ dark bool
+
+ bgDeep uint32 // outer window background
+ bgCard uint32 // card surface
+ textHeading uint32 // section titles
+ textBody uint32 // descriptive body
+ textLabel uint32 // form labels
+ textMuted uint32 // subtitles
+ textHelper uint32 // helper text under inputs / footer
+ indigo uint32 // brand accent (button text + pair code)
+ errorRed uint32
+ successGr uint32
+
+ // Brushes derived from the colours above. Cached to avoid recomputing
+ // the same SolidColorBrush thousands of times during widget construction.
+ brushBgDeep dec.Brush
+ brushBgCard dec.Brush
+}
+
+func newPalette(dark bool) palette {
+ if dark {
+ p := palette{
+ dark: true,
+ bgDeep: 0x09090B,
+ bgCard: 0x121214,
+ textHeading: 0xFFFFFF,
+ textBody: 0xEDEDED,
+ textLabel: 0xE4E4E7,
+ textMuted: 0xA1A1AA,
+ textHelper: 0x71717A,
+ indigo: 0x818CF8, // slightly lifted for contrast on dark bg
+ errorRed: 0xF87171,
+ successGr: 0x34D399,
+ }
+ p.brushBgDeep = dec.SolidColorBrush{Color: rgbHex(p.bgDeep)}
+ p.brushBgCard = dec.SolidColorBrush{Color: rgbHex(p.bgCard)}
+ return p
+ }
+ p := palette{
+ dark: false,
+ bgDeep: 0xF1F5F9, // slate-100, gentler than pure white
+ bgCard: 0xFFFFFF,
+ textHeading: 0x111827,
+ textBody: 0x1F2937,
+ textLabel: 0x374151,
+ textMuted: 0x6B7280,
+ textHelper: 0x9CA3AF,
+ indigo: 0x4F46E5,
+ errorRed: 0xDC2626,
+ successGr: 0x059669,
+ }
+ p.brushBgDeep = dec.SolidColorBrush{Color: rgbHex(p.bgDeep)}
+ p.brushBgCard = dec.SolidColorBrush{Color: rgbHex(p.bgCard)}
+ return p
+}
+
+// detectThemePalette currently always returns the light palette regardless
+// of the user's Windows theme preference. Walk's native LineEdit and
+// PushButton controls don't reliably respect dark mode (the white-input-on-
+// dark-card contrast looks broken), so until the wizard is ported to Wails
+// we keep a single, consistent light palette. The registry-reading path is
+// preserved below in case we want to flip this back when the controls
+// behave.
+func detectThemePalette() palette {
+ return newPalette(false)
+}
+
+// systemPrefersDark is the would-be feature toggle we'd hand detectThemePalette
+// once we actually have themable inputs (i.e. after the Wails port).
+func systemPrefersDark() bool {
+ k, err := registry.OpenKey(registry.CURRENT_USER,
+ `Software\Microsoft\Windows\CurrentVersion\Themes\Personalize`,
+ registry.QUERY_VALUE)
+ if err != nil {
+ return false
+ }
+ defer k.Close()
+ v, _, err := k.GetIntegerValue("AppsUseLightTheme")
+ if err != nil {
+ return false
+ }
+ return v == 0
+}
+
+func (p palette) Color(c uint32) walk.Color { return rgbHex(c) }
diff --git a/agent/internal/setupui/window_windows.go b/agent/internal/setupui/window_windows.go
index 61fdcb5e..caf37fb2 100644
--- a/agent/internal/setupui/window_windows.go
+++ b/agent/internal/setupui/window_windows.go
@@ -11,6 +11,7 @@ import (
"image/png"
"os"
"runtime"
+ "strings"
"sync"
"github.com/lxn/walk"
@@ -113,220 +114,296 @@ type wizardUI struct {
func (w *wizardUI) show() error {
hostname, _ := os.Hostname()
+ // Match the user's Windows theme so the wizard sits naturally on top of
+ // whatever the rest of their desktop looks like. The panel's own UI is
+ // light/dark adaptive; the wizard mirrors that.
+ pal := detectThemePalette()
+
const (
- brandPurple = 0x6366F1
- errorRed = 0xDC2626
- mutedGray = 0x6B7280
- subtleGray = 0x9CA3AF
- darkText = 0x111827
- medText = 0x374151
- titleSize = 14
- bodySize = 9
- smallSize = 8
- codeSize = 32
+ titleSize = 14
+ bodySize = 9
+ smallSize = 8
+ codeSize = 32
)
+ bgDeepBrush := pal.brushBgDeep
+ bgCardBrush := pal.brushBgCard
+
+ textWhite := pal.textHeading
+ textPrimary := pal.textBody
+ textLabel := pal.textLabel
+ textMuted := pal.textMuted
+ textHelper := pal.textHelper
+ indigo := pal.indigo
+ errorRed := pal.errorRed
+ successGr := pal.successGr
+
err := (dec.MainWindow{
AssignTo: &w.mw,
Title: "ServerKit Agent",
- MinSize: dec.Size{Width: 440, Height: 580},
- Size: dec.Size{Width: 440, Height: 580},
- Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 28, Top: 24, Right: 28, Bottom: 28}, Spacing: 0},
- Background: dec.SolidColorBrush{Color: walk.RGB(248, 250, 252)},
+ MinSize: dec.Size{Width: 460, Height: 600},
+ Size: dec.Size{Width: 460, Height: 600},
+ Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 24, Top: 24, Right: 24, Bottom: 24}, Spacing: 0},
+ Background: bgDeepBrush,
Children: []dec.Widget{
- // ── Brand header ───────────────────────────────────────────────
+ // ── Card surface (lighter than outer bg, simulates the .agent-window block) ──
dec.Composite{
- Layout: dec.HBox{MarginsZero: true, Spacing: 16},
+ Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 24, Top: 24, Right: 24, Bottom: 24}, Spacing: 0},
+ Background: bgCardBrush,
Children: []dec.Widget{
- dec.ImageView{
- AssignTo: &w.headerImage,
- MinSize: dec.Size{Width: 60, Height: 60},
- MaxSize: dec.Size{Width: 60, Height: 60},
- Mode: dec.ImageViewModeZoom,
- },
+ // ── Brand header ─────────────────────────────────────────
dec.Composite{
- Layout: dec.VBox{MarginsZero: true, Spacing: 4},
+ Layout: dec.HBox{MarginsZero: true, Spacing: 16},
+ Background: bgCardBrush,
Children: []dec.Widget{
- dec.VSpacer{},
- dec.Label{
- Text: "Pair this server",
- Font: dec.Font{PointSize: titleSize, Bold: true},
- TextColor: rgbHex(darkText),
+ dec.ImageView{
+ AssignTo: &w.headerImage,
+ MinSize: dec.Size{Width: 48, Height: 48},
+ MaxSize: dec.Size{Width: 48, Height: 48},
+ Mode: dec.ImageViewModeZoom,
+ Background: bgCardBrush,
},
- dec.Label{
- Text: "Connect this machine to your ServerKit panel.",
- Font: dec.Font{PointSize: bodySize},
- TextColor: rgbHex(mutedGray),
+ dec.Composite{
+ Layout: dec.VBox{MarginsZero: true, Spacing: 4},
+ Background: bgCardBrush,
+ Children: []dec.Widget{
+ dec.VSpacer{},
+ dec.Label{
+ Text: "Pair this server",
+ Font: dec.Font{PointSize: titleSize, Bold: true, Family: "Segoe UI"},
+ TextColor: rgbHex(textWhite),
+ Background: bgCardBrush,
+ },
+ dec.Label{
+ Text: "Connect this machine to your ServerKit panel.",
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textMuted),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{},
+ },
},
- dec.VSpacer{},
},
},
- },
- },
- dec.VSpacer{Size: 22},
+ dec.VSpacer{Size: 28},
- // ── Stage 1: connection form ────────────────────────────────────
- dec.Composite{
- AssignTo: &w.formPanel,
- Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 16, Top: 18, Right: 16, Bottom: 18}, Spacing: 2},
- Background: dec.SolidColorBrush{Color: walk.RGB(255, 255, 255)},
- Children: []dec.Widget{
- // Panel URL
- dec.Label{
- Text: "Panel URL",
- Font: dec.Font{Bold: true, PointSize: bodySize},
- TextColor: rgbHex(medText),
- },
- dec.VSpacer{Size: 2},
- dec.LineEdit{
- AssignTo: &w.urlEdit,
- CueBanner: "https://panel.example.com",
- MaxLength: 500,
- },
- dec.Label{
- Text: "The full URL of your ServerKit control panel.",
- Font: dec.Font{PointSize: smallSize},
- TextColor: rgbHex(subtleGray),
- },
+ // ── Stage 1: connection form ─────────────────────────────
+ dec.Composite{
+ AssignTo: &w.formPanel,
+ Layout: dec.VBox{MarginsZero: true, Spacing: 0},
+ Background: bgCardBrush,
+ Children: []dec.Widget{
+ // Panel URL
+ dec.Label{
+ Text: "Panel URL",
+ Font: dec.Font{Bold: true, PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textLabel),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 6},
+ dec.LineEdit{
+ AssignTo: &w.urlEdit,
+ CueBanner: "https://panel.example.com",
+ MaxLength: 500,
+ MinSize: dec.Size{Height: 28},
+ },
+ dec.VSpacer{Size: 6},
+ dec.Label{
+ Text: "The full URL of your ServerKit control panel.",
+ Font: dec.Font{PointSize: smallSize, Family: "Segoe UI"},
+ TextColor: rgbHex(textHelper),
+ Background: bgCardBrush,
+ },
- dec.VSpacer{Size: 12},
+ dec.VSpacer{Size: 20},
- // Passphrase
- dec.Label{
- Text: "Passphrase",
- Font: dec.Font{Bold: true, PointSize: bodySize},
- TextColor: rgbHex(medText),
- },
- dec.VSpacer{Size: 2},
- dec.LineEdit{
- AssignTo: &w.passEdit,
- PasswordMode: true,
- CueBanner: "Set in the panel under Add Server",
- MaxLength: 200,
- },
- dec.Label{
- Text: "Generated in your panel under Servers → Add Server.",
- Font: dec.Font{PointSize: smallSize},
- TextColor: rgbHex(subtleGray),
- },
+ // Server name
+ dec.Label{
+ Text: "Server name (optional)",
+ Font: dec.Font{Bold: true, PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textLabel),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 6},
+ dec.LineEdit{
+ AssignTo: &w.nameEdit,
+ Text: hostname,
+ CueBanner: "Defaults to hostname",
+ MinSize: dec.Size{Height: 28},
+ },
+ dec.VSpacer{Size: 6},
+ dec.Label{
+ Text: "How this machine appears in your panel.",
+ Font: dec.Font{PointSize: smallSize, Family: "Segoe UI"},
+ TextColor: rgbHex(textHelper),
+ Background: bgCardBrush,
+ },
- dec.VSpacer{Size: 12},
+ dec.VSpacer{Size: 20},
- // Server name
- dec.Label{
- Text: "Server name (optional)",
- Font: dec.Font{Bold: true, PointSize: bodySize},
- TextColor: rgbHex(medText),
- },
- dec.VSpacer{Size: 2},
- dec.LineEdit{
- AssignTo: &w.nameEdit,
- Text: hostname,
- CueBanner: "Defaults to hostname",
- },
- dec.Label{
- Text: "How this machine appears in your panel.",
- Font: dec.Font{PointSize: smallSize},
- TextColor: rgbHex(subtleGray),
- },
+ // Passphrase
+ dec.Label{
+ Text: "Passphrase",
+ Font: dec.Font{Bold: true, PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textLabel),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 6},
+ dec.LineEdit{
+ AssignTo: &w.passEdit,
+ PasswordMode: true,
+ CueBanner: "Set in the panel under Add Server",
+ MaxLength: 200,
+ MinSize: dec.Size{Height: 28},
+ },
+ dec.VSpacer{Size: 6},
+ dec.Label{
+ Text: "Generated in your panel under Servers → Add Server.",
+ Font: dec.Font{PointSize: smallSize, Family: "Segoe UI"},
+ TextColor: rgbHex(textHelper),
+ Background: bgCardBrush,
+ },
- dec.VSpacer{Size: 14},
+ dec.VSpacer{Size: 20},
- dec.Label{
- AssignTo: &w.formErr,
- TextColor: rgbHex(errorRed),
- Font: dec.Font{PointSize: bodySize},
- Text: "",
- },
- dec.PushButton{
- AssignTo: &w.startBtn,
- Text: "Connect →",
- MinSize: dec.Size{Height: 36},
- OnClicked: w.handleConnect,
+ dec.Label{
+ AssignTo: &w.formErr,
+ TextColor: rgbHex(errorRed),
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ Background: bgCardBrush,
+ Text: "",
+ },
+ dec.PushButton{
+ AssignTo: &w.startBtn,
+ Text: "Connect →",
+ MinSize: dec.Size{Height: 36},
+ Font: dec.Font{PointSize: bodySize, Bold: true, Family: "Segoe UI"},
+ OnClicked: w.handleConnect,
+ },
+ },
},
- },
- },
- // ── Stage 2: pairing code (hidden initially) ──────────────────
- dec.Composite{
- AssignTo: &w.pairPanel,
- Visible: false,
- Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 16, Top: 24, Right: 16, Bottom: 24}, Spacing: 0},
- Background: dec.SolidColorBrush{Color: walk.RGB(255, 255, 255)},
- Children: []dec.Widget{
- dec.Label{
- Text: "Open your panel and enter this code:",
- Font: dec.Font{PointSize: bodySize},
- TextColor: rgbHex(mutedGray),
- },
- dec.VSpacer{Size: 16},
+ // ── Stage 2: pairing code (hidden initially) ──────────────
+ // Mirrors the panel's "Add Server → Pair existing agent" drawer:
+ // the user reads the code here and types it into that field.
dec.Composite{
- Layout: dec.HBox{MarginsZero: true},
+ AssignTo: &w.pairPanel,
+ Visible: false,
+ Layout: dec.VBox{MarginsZero: true, Spacing: 0},
+ Background: bgCardBrush,
Children: []dec.Widget{
- dec.HSpacer{},
dec.Label{
- AssignTo: &w.codeLabel,
- Text: "",
- Font: dec.Font{PointSize: codeSize, Bold: true, Family: "Consolas"},
- TextColor: rgbHex(brandPurple),
+ Text: "On your panel, open Add Server → Pair existing agent.",
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textPrimary),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 4},
+ dec.Label{
+ Text: "Enter this code in the Pair code field:",
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textMuted),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 24},
+ // Code "field" — visually echoes the panel's letter-spaced
+ // input. We can't render a real bordered box, but a
+ // centered Composite with the card colour at least
+ // gives the code its own dedicated zone.
+ dec.Composite{
+ Layout: dec.HBox{MarginsZero: true},
+ Background: bgCardBrush,
+ Children: []dec.Widget{
+ dec.HSpacer{},
+ dec.Label{
+ AssignTo: &w.codeLabel,
+ Text: "",
+ Font: dec.Font{PointSize: codeSize, Bold: true, Family: "Consolas"},
+ TextColor: rgbHex(indigo),
+ Background: bgCardBrush,
+ TextAlignment: dec.AlignCenter,
+ },
+ dec.HSpacer{},
+ },
+ },
+ dec.VSpacer{Size: 24},
+ dec.Label{
+ AssignTo: &w.statusLabel,
+ Text: "Waiting for the panel to claim this server…",
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textHelper),
+ Background: bgCardBrush,
TextAlignment: dec.AlignCenter,
},
- dec.HSpacer{},
+ dec.Label{
+ AssignTo: &w.pairErrLabel,
+ TextColor: rgbHex(errorRed),
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ Background: bgCardBrush,
+ Text: "",
+ },
+ dec.VSpacer{Size: 20},
+ dec.PushButton{
+ AssignTo: &w.cancelBtn,
+ Text: "Cancel",
+ MinSize: dec.Size{Height: 34},
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ OnClicked: w.handleCancel,
+ },
},
},
- dec.VSpacer{Size: 16},
- dec.Label{
- AssignTo: &w.statusLabel,
- Text: "Waiting for the panel to claim this server…",
- Font: dec.Font{PointSize: bodySize},
- TextColor: rgbHex(mutedGray),
- TextAlignment: dec.AlignCenter,
- },
- dec.Label{
- AssignTo: &w.pairErrLabel,
- TextColor: rgbHex(errorRed),
- Font: dec.Font{PointSize: bodySize},
- Text: "",
- },
- dec.VSpacer{Size: 16},
- dec.PushButton{
- AssignTo: &w.cancelBtn,
- Text: "Cancel",
- MinSize: dec.Size{Height: 34},
- OnClicked: w.handleCancel,
- },
- },
- },
- // ── Stage 3: success ───────────────────────────────────────────
- dec.Composite{
- AssignTo: &w.donePanel,
- Visible: false,
- Layout: dec.VBox{MarginsZero: false, Margins: dec.Margins{Left: 16, Top: 24, Right: 16, Bottom: 24}, Spacing: 10},
- Background: dec.SolidColorBrush{Color: walk.RGB(255, 255, 255)},
- Children: []dec.Widget{
- dec.Label{
- AssignTo: &w.doneTitle,
- Text: "Successfully paired",
- Font: dec.Font{PointSize: titleSize, Bold: true},
- TextColor: walk.RGB(16, 185, 129),
- },
- dec.Label{
- AssignTo: &w.doneSub,
- Text: "",
- Font: dec.Font{PointSize: bodySize},
+ // ── Stage 3: success ─────────────────────────────────────
+ dec.Composite{
+ AssignTo: &w.donePanel,
+ Visible: false,
+ Layout: dec.VBox{MarginsZero: true, Spacing: 10},
+ Background: bgCardBrush,
+ Children: []dec.Widget{
+ dec.Label{
+ AssignTo: &w.doneTitle,
+ Text: "Successfully paired",
+ Font: dec.Font{PointSize: titleSize, Bold: true, Family: "Segoe UI"},
+ TextColor: rgbHex(successGr),
+ Background: bgCardBrush,
+ },
+ dec.Label{
+ AssignTo: &w.doneSub,
+ Text: "",
+ Font: dec.Font{PointSize: bodySize, Family: "Segoe UI"},
+ TextColor: rgbHex(textPrimary),
+ Background: bgCardBrush,
+ },
+ dec.VSpacer{Size: 8},
+ dec.PushButton{
+ Text: "Close",
+ MinSize: dec.Size{Height: 36},
+ Font: dec.Font{PointSize: bodySize, Bold: true, Family: "Segoe UI"},
+ OnClicked: func() { w.mw.Close() },
+ },
+ },
},
- dec.VSpacer{Size: 8},
- dec.PushButton{
- Text: "Close",
- MinSize: dec.Size{Height: 36},
- OnClicked: func() { w.mw.Close() },
+
+ dec.VSpacer{},
+
+ // Subtle in-card footer mirrors the panel's brand strip.
+ dec.Composite{
+ Layout: dec.HBox{MarginsZero: true},
+ Background: bgCardBrush,
+ Children: []dec.Widget{
+ dec.HSpacer{},
+ dec.Label{
+ Text: "ServerKit • Pairing wizard",
+ Font: dec.Font{PointSize: smallSize, Family: "Segoe UI"},
+ TextColor: rgbHex(textHelper),
+ Background: bgCardBrush,
+ },
+ dec.HSpacer{},
+ },
},
},
},
-
- dec.VSpacer{},
},
}).Create()
if err != nil {
@@ -340,6 +417,8 @@ func (w *wizardUI) show() error {
_ = w.headerImage.SetImage(bmp)
}
+ // Title-bar chrome stays system-default; we're light-themed everywhere
+ // for now to avoid the dark-card / white-input contrast clash.
w.mw.Show()
// Windows' anti-focus-stealing rule will leave the window invisible behind
// the desktop when the agent is launched from the Start menu shortcut.
@@ -451,13 +530,29 @@ func errorPretty(err error) string {
return err.Error()
}
-// displayCode prefers the server-formatted code (e.g. "1234-5678") and falls
-// back to the raw code if the panel didn't supply one.
+// displayCode renders the pair code with letter-spacing, mirroring the
+// panel's "Add Server" input field which uses CSS letter-spacing: 0.5em on
+// the same code. Walk Labels don't support letter-spacing as a property, so
+// we fake it by inserting two-space gaps between glyphs of the unformatted
+// code. Result for code "AB12CD" looks like "A B 1 2 C D".
func displayCode(code, formatted string) string {
- if formatted != "" {
- return formatted
+ raw := code
+ if raw == "" {
+ raw = formatted
+ }
+ clean := strings.ReplaceAll(raw, "-", "")
+ clean = strings.ReplaceAll(clean, " ", "")
+ if clean == "" {
+ return ""
+ }
+ var b strings.Builder
+ for i, r := range clean {
+ if i > 0 {
+ b.WriteString(" ")
+ }
+ b.WriteRune(r)
}
- return code
+ return b.String()
}
func rgbHex(rgb uint32) walk.Color {
diff --git a/agent/packaging/msi/Product.wxs b/agent/packaging/msi/Product.wxs
index bc369dda..138b835b 100644
--- a/agent/packaging/msi/Product.wxs
+++ b/agent/packaging/msi/Product.wxs
@@ -39,10 +39,12 @@
<Feature Id="ProductFeature" Title="ServerKit Agent" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ConfigComponent" />
+ <ComponentRef Id="LauncherScript" />
<ComponentRef Id="TrayAutoStart" />
<ComponentRef Id="StartMenuShortcuts" />
</Feature>
+
</Package>
<!-- Directory Structure -->
@@ -100,24 +102,34 @@
<RemoveFolder Id="RemoveAgentDataFolder" On="uninstall" />
</Component>
- <!-- Auto-start the desktop app on user login. With no args, the binary
- opens the pairing wizard if not yet configured, otherwise just the tray. -->
+ <!-- VBS launcher: shortcuts run wscript.exe + this script, which then spawns
+ the unsigned exe. The Microsoft-signed wscript host bypasses the
+ Explorer-launch SmartScreen reputation check that otherwise silently
+ kills the agent process on some Windows configurations. -->
+ <Component Id="LauncherScript" Directory="INSTALLFOLDER" Guid="F1B2A3C4-D5E6-4071-8A8B-9C0D1E2F3A4B">
+ <File Id="LauncherVbs" Source="launcher.vbs" KeyPath="yes" />
+ </Component>
+
+ <!-- Auto-start the desktop app on user login. Goes through the launcher
+ for the same SmartScreen-bypass reason as the Start menu shortcut. -->
<Component Id="TrayAutoStart" Directory="INSTALLFOLDER" Guid="E5F6A7B8-C9D0-1234-EF01-567890123456">
<RegistryValue
Root="HKCU"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Name="ServerKitAgent"
Type="string"
- Value="&quot;[INSTALLFOLDER]serverkit-agent.exe&quot;"
+ Value="wscript.exe &quot;[INSTALLFOLDER]launcher.vbs&quot;"
KeyPath="yes" />
</Component>
- <!-- Start Menu shortcut: single entry that opens the desktop app. -->
+ <!-- Start Menu shortcut: single entry that opens the desktop app via the
+ signed wscript.exe host so SmartScreen doesn't silently reap us. -->
<Component Id="StartMenuShortcuts" Directory="ServerKitStartMenuFolder" Guid="B7C8D9E0-F1A2-3456-7890-ABCDEF123456">
<Shortcut Id="AppShortcut"
Name="ServerKit Agent"
Description="Pair and manage this ServerKit Agent"
- Target="[INSTALLFOLDER]serverkit-agent.exe"
+ Target="[System64Folder]wscript.exe"
+ Arguments="&quot;[INSTALLFOLDER]launcher.vbs&quot;"
WorkingDirectory="INSTALLFOLDER"
Icon="ServerKitAgentIco"
IconIndex="0" />
diff --git a/agent/packaging/msi/build.ps1 b/agent/packaging/msi/build.ps1
index 9b03ed98..7cd9f462 100644
--- a/agent/packaging/msi/build.ps1
+++ b/agent/packaging/msi/build.ps1
@@ -41,6 +41,9 @@ try {
}
Copy-Item $iconSource "$buildDir\serverkit.ico"
+ # Copy SmartScreen-bypass launcher script (see launcher.vbs for rationale).
+ Copy-Item (Join-Path $PSScriptRoot "launcher.vbs") "$buildDir\launcher.vbs"
+
# Create default config file
$configContent = @"
# ServerKit Agent Configuration
diff --git a/agent/packaging/msi/launcher.vbs b/agent/packaging/msi/launcher.vbs
new file mode 100644
index 00000000..25b9b285
--- /dev/null
+++ b/agent/packaging/msi/launcher.vbs
@@ -0,0 +1,40 @@
+' ServerKit Agent launcher
+'
+' Why this exists: Windows SmartScreen silently terminates the unsigned
+' serverkit-agent.exe when it is launched directly from Explorer / the
+' Start menu / Search. Launching PowerShell or cmd from those same places
+' works, because the SmartScreen reputation check applies to the *initial*
+' user-clicked process, not its children.
+'
+' wscript.exe is signed by Microsoft and always trusted. By having the
+' shortcut launch wscript with this script, the agent inherits a clean
+' trust chain and starts reliably regardless of code-signing state.
+'
+' wscript runs without a console window, so there is no visible flash.
+
+Option Explicit
+
+Dim shell, fso, scriptPath, installDir, exePath, args, i
+
+Set shell = CreateObject("WScript.Shell")
+Set fso = CreateObject("Scripting.FileSystemObject")
+
+scriptPath = WScript.ScriptFullName
+installDir = fso.GetParentFolderName(scriptPath)
+exePath = fso.BuildPath(installDir, "serverkit-agent.exe")
+
+' Forward any arguments wscript was given (so e.g. --repair still works
+' if a shortcut or another launcher passes flags through).
+args = ""
+If WScript.Arguments.Count > 0 Then
+ For i = 0 To WScript.Arguments.Count - 1
+ If args <> "" Then args = args & " "
+ args = args & """" & WScript.Arguments(i) & """"
+ Next
+End If
+
+If args = "" Then
+ shell.Run """" & exePath & """", 0, False
+Else
+ shell.Run """" & exePath & """ " & args, 0, False
+End If
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 03105513..2f01b384 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -603,6 +603,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
async function handleLookup() {
setLookupError('');
setLookupResult(null);
+ if (formattedCode.length === 0) return;
if (formattedCode.length !== 6) {
setLookupError('Pair code must be 6 characters');
return;
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index 5a0bcbe1..9dcba487 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -17,8 +17,9 @@ import ApiSettingsTab from '../components/settings/ApiSettingsTab';
import MigrationHistoryTab from '../components/settings/MigrationHistoryTab';
import IconReferenceTab from '../components/settings/IconReferenceTab';
import AboutTab from '../components/settings/AboutTab';
-import { Activity, Code, Database, Layers } from 'lucide-react';
+import { Activity, Code, Database, Layers, PaintBucket } from 'lucide-react';
import { Button } from '@/components/ui/button';
+import { useNavigate } from 'react-router-dom';
const VALID_TABS = ['profile', 'security', 'appearance', 'sidebar', 'whitelabel', 'notifications', 'system', 'users', 'activity', 'site', 'sso', 'api', 'migrations', 'developer', 'about'];
@@ -26,6 +27,7 @@ const Settings = () => {
const [activeTab, setActiveTab] = useTabParam('/settings', VALID_TABS);
const { isAdmin } = useAuth();
const [devMode, setDevMode] = useState(false);
+ const navigate = useNavigate();
useEffect(() => {
if (isAdmin) {
@@ -208,6 +210,19 @@ const Settings = () => {
</Button>
</>
)}
+ {import.meta.env.DEV && (
+ <>
+ <div className="settings-nav-divider">Local Dev</div>
+ <Button
+ variant="ghost"
+ className="settings-nav-item"
+ onClick={() => navigate('/style-guide')}
+ >
+ <PaintBucket size={18} />
+ Style Guide
+ </Button>
+ </>
+ )}
<Button
variant="ghost"
className={`settings-nav-item ${activeTab === 'about' ? 'active' : ''}`}
diff --git a/frontend/src/styles/pages/_settings.scss b/frontend/src/styles/pages/_settings.scss
index cab331ce..975b833d 100644
--- a/frontend/src/styles/pages/_settings.scss
+++ b/frontend/src/styles/pages/_settings.scss
@@ -66,10 +66,11 @@
}
}
-.settings-nav-item {
+.settings-nav-item,
+.settings-nav-item.settings-nav-item {
display: flex;
align-items: center;
- justify-content: flex-start;
+ justify-content: flex-start !important;
gap: $space-3;
padding: $space-3 $space-4;
background: transparent;