mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
add window recipient prompt
This commit is contained in:
parent
4ee008225e
commit
f9dfa6bc05
2 changed files with 20 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue