This commit is contained in:
Josh at WLTechBlog
2025-12-31 17:13:17 -07:00
parent f09cdc2973
commit ec391bd7ed
4 changed files with 301 additions and 200 deletions

View File

@@ -239,8 +239,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
case "open-tab":
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -259,8 +259,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
url := cmd.Params["url"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -280,14 +280,14 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
value := cmd.Params["value"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
}
}
actionTimeout := 5 // Default: 5 seconds
actionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["action-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
actionTimeout = parsedTimeout
@@ -307,14 +307,14 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
filePath := cmd.Params["file"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
}
}
actionTimeout := 5 // Default: 5 seconds
actionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["action-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
actionTimeout = parsedTimeout
@@ -333,14 +333,14 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
}
}
actionTimeout := 5 // Default: 5 seconds
actionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["action-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
actionTimeout = parsedTimeout
@@ -358,8 +358,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -378,7 +378,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
@@ -396,8 +396,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -413,7 +413,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
case "wait-navigation":
tabID := cmd.Params["tab"]
timeout := 5 // Default timeout
timeout := 30 // Default timeout
if timeoutStr, ok := cmd.Params["timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -431,14 +431,14 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
}
}
actionTimeout := 5 // Default: 5 seconds
actionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["action-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
actionTimeout = parsedTimeout
@@ -458,14 +458,14 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
value := cmd.Params["value"]
// Parse timeouts
selectionTimeout := 5 // Default: 5 seconds
selectionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["selection-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
selectionTimeout = parsedTimeout
}
}
actionTimeout := 5 // Default: 5 seconds
actionTimeout := 30 // Default: 30 seconds
if timeoutStr, ok := cmd.Params["action-timeout"]; ok {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
actionTimeout = parsedTimeout
@@ -484,8 +484,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
jsCode := cmd.Params["code"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -504,8 +504,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -565,8 +565,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
}
}
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -603,8 +603,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
injectLibrary := cmd.Params["inject_library"] // Optional: library URL or name
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -634,8 +634,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
checkType := cmd.Params["type"] // exists, visible, enabled, focused, selected
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -655,8 +655,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
attributes := cmd.Params["attributes"] // comma-separated list or "all"
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -675,8 +675,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -695,8 +695,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selectors := cmd.Params["selectors"] // JSON array of selectors
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -717,8 +717,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
textPattern := cmd.Params["text-pattern"] // Optional: regex pattern for link text
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -738,8 +738,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
includeHeaders := cmd.Params["include-headers"] == "true"
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -760,8 +760,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
extractType := cmd.Params["type"] // text, innerText, textContent (default: textContent)
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -780,8 +780,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -800,8 +800,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
interactionsJSON := cmd.Params["interactions"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -821,8 +821,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
fieldsJSON := cmd.Params["fields"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -840,8 +840,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -859,8 +859,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -878,8 +878,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -898,8 +898,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
contentType := cmd.Params["type"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -919,8 +919,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
outputPath := cmd.Params["output"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -946,8 +946,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
fullPage = true
}
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1000,8 +1000,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
includeContrastStr := cmd.Params["include_contrast"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1035,8 +1035,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
fetchRelatives := cmd.Params["fetch-relatives"] // "true" or "false"
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1063,8 +1063,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
role := cmd.Params["role"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1082,8 +1082,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1101,8 +1101,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1120,8 +1120,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1139,8 +1139,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1158,8 +1158,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1177,8 +1177,8 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
timeoutStr := cmd.Params["timeout"]
// Parse timeout (default to 5 seconds if not specified)
timeout := 5
// Parse timeout (default to 30 seconds if not specified)
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1197,7 +1197,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
sourceSelector := cmd.Params["source"]
targetSelector := cmd.Params["target"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1226,7 +1226,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
targetXStr := cmd.Params["target-x"]
targetYStr := cmd.Params["target-y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1266,7 +1266,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
offsetXStr := cmd.Params["offset-x"]
offsetYStr := cmd.Params["offset-y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1304,7 +1304,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1327,7 +1327,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1350,7 +1350,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1373,7 +1373,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
selector := cmd.Params["selector"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1397,7 +1397,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
xStr := cmd.Params["x"]
yStr := cmd.Params["y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1434,7 +1434,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
deltaXStr := cmd.Params["delta-x"]
deltaYStr := cmd.Params["delta-y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1478,7 +1478,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
keys := cmd.Params["keys"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1501,7 +1501,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
key := cmd.Params["key"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1525,7 +1525,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
selector := cmd.Params["selector"]
modifiers := cmd.Params["modifiers"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1553,7 +1553,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
xStr := cmd.Params["x"]
yStr := cmd.Params["y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1589,7 +1589,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
yStr := cmd.Params["y"]
durationStr := cmd.Params["duration"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1633,7 +1633,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
endXStr := cmd.Params["end-x"]
endYStr := cmd.Params["end-y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1679,7 +1679,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
centerYStr := cmd.Params["center-y"]
scaleStr := cmd.Params["scale"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1720,7 +1720,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
deltaXStr := cmd.Params["delta-x"]
deltaYStr := cmd.Params["delta-y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1755,7 +1755,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
xStr := cmd.Params["x"]
yStr := cmd.Params["y"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1791,7 +1791,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
startStr := cmd.Params["start"]
endStr := cmd.Params["end"]
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout
@@ -1825,7 +1825,7 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) {
tabID := cmd.Params["tab"]
selector := cmd.Params["selector"] // Optional - if empty, selects all text on page
timeoutStr := cmd.Params["timeout"]
timeout := 5
timeout := 30
if timeoutStr != "" {
if parsedTimeout, err := strconv.Atoi(timeoutStr); err == nil && parsedTimeout > 0 {
timeout = parsedTimeout