MCPcopy Create free account
hub / github.com/Ringmast4r/PathFinder / submitInput

Method submitInput

main.go:2663–2740  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2661}
2662
2663func (tui *TUI) submitInput() {
2664 input := strings.TrimSpace(tui.inputText)
2665 if input == "" {
2666 return
2667 }
2668
2669 // Normalize URL - add https:// if no scheme present
2670 var targetURL string
2671 if strings.HasPrefix(input, "http://") || strings.HasPrefix(input, "https://") {
2672 targetURL = input
2673 } else {
2674 // Assume https for plain domains
2675 targetURL = "https://" + input
2676 }
2677
2678 // Validate URL
2679 parsedURL, err := url.Parse(targetURL)
2680 if err != nil || parsedURL.Scheme == "" || parsedURL.Host == "" {
2681 // Invalid URL - silently return (could show error message in future)
2682 return
2683 }
2684
2685 // Update scanner's BaseURL
2686 tui.scanner.BaseURL = strings.TrimRight(targetURL, "/")
2687
2688 // Reset maze animation for new search
2689 tui.initMaze()
2690 tui.scanHasEverRun = true
2691
2692 // Reset cancel flag for new scan
2693 tui.scanner.cancelMutex.Lock()
2694 tui.scanner.cancelScan = false
2695 tui.scanner.cancelMutex.Unlock()
2696
2697 // Reset statistics
2698 tui.scanner.Stats = &Statistics{
2699 RedirectTargets: make(map[string]int),
2700 ContentHashes: make(map[string][]*ScanResult),
2701 }
2702 tui.scanner.LiveStats = &LiveStats{
2703 StartTime: time.Now(),
2704 EndTime: time.Time{}, // Reset to zero (scan not finished)
2705 LastUpdate: time.Now(),
2706 }
2707 tui.scanner.lastResults = make([]*ScanResult, 0, 50)
2708
2709 // Reset visited paths for new scan
2710 tui.scanner.pathMutex.Lock()
2711 tui.scanner.visitedPaths = make(map[string]bool)
2712 tui.scanner.pathMutex.Unlock()
2713
2714 // Drain and reset recursion queue
2715 draining := true
2716 for draining {
2717 select {
2718 case <-tui.scanner.recursionQueue:
2719 // Discard old queue items
2720 default:

Callers 1

HandleInputMethod · 0.95

Calls 3

initMazeMethod · 0.95
LoadWordlistFunction · 0.85
ScanAllMethod · 0.80

Tested by

no test coverage detected