mirror of https://github.com/schollz/croc.git
add window recipient prompt
This commit is contained in:
parent
4ee008225e
commit
f9dfa6bc05
|
@ -57,6 +57,10 @@ type Croc struct {
|
|||
StateString string
|
||||
Bar *progressbar.ProgressBar
|
||||
FileInfo models.FileStats
|
||||
|
||||
// special for window
|
||||
WindowRecipientPrompt bool
|
||||
WindowRecipientAccept bool
|
||||
}
|
||||
|
||||
// Init will initiate with the default parameters
|
||||
|
|
|
@ -220,6 +220,22 @@ func (cr *Croc) receive(forceSend int, serverAddress string, tcpPorts []string,
|
|||
return nil
|
||||
}
|
||||
}
|
||||
if cr.WindowRecipientPrompt {
|
||||
// wait until it switches to false
|
||||
// the window should then set WindowRecipientAccept
|
||||
for {
|
||||
if !cr.WindowRecipientPrompt {
|
||||
if cr.WindowRecipientAccept {
|
||||
break
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "cancelling request")
|
||||
c.WriteMessage(websocket.BinaryMessage, []byte("no"))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
// await file
|
||||
// erase file if overwriting
|
||||
|
|
Loading…
Reference in New Issue