mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
update ui
This commit is contained in:
parent
3170737aa5
commit
8a843a6a85
1 changed files with 21 additions and 4 deletions
|
@ -19,6 +19,7 @@ import (
|
||||||
"github.com/go-redis/redis"
|
"github.com/go-redis/redis"
|
||||||
"github.com/mattn/go-colorable"
|
"github.com/mattn/go-colorable"
|
||||||
"github.com/pions/webrtc"
|
"github.com/pions/webrtc"
|
||||||
|
"github.com/schollz/croc/v5/src/crypt"
|
||||||
"github.com/schollz/croc/v5/src/utils"
|
"github.com/schollz/croc/v5/src/utils"
|
||||||
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
||||||
"github.com/schollz/croc/v5/src/webrtc/pkg/session/receiver"
|
"github.com/schollz/croc/v5/src/webrtc/pkg/session/receiver"
|
||||||
|
@ -393,7 +394,14 @@ func (c *Client) processMessage(m Message) (err error) {
|
||||||
}
|
}
|
||||||
case "fileinfo":
|
case "fileinfo":
|
||||||
var senderInfo SenderInfo
|
var senderInfo SenderInfo
|
||||||
err = json.Unmarshal(m.Bytes, &senderInfo)
|
var decryptedBytes []byte
|
||||||
|
key, _ := c.Pake.SessionKey()
|
||||||
|
decryptedBytes, err = crypt.DecryptFromBytes(m.Bytes, key)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(decryptedBytes, &senderInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
|
@ -415,7 +423,14 @@ func (c *Client) processMessage(m Message) (err error) {
|
||||||
c.Step2FileInfoTransfered = true
|
c.Step2FileInfoTransfered = true
|
||||||
case "recipientready":
|
case "recipientready":
|
||||||
var remoteFile RemoteFileRequest
|
var remoteFile RemoteFileRequest
|
||||||
err = json.Unmarshal(m.Bytes, &remoteFile)
|
var decryptedBytes []byte
|
||||||
|
key, _ := c.Pake.SessionKey()
|
||||||
|
decryptedBytes, err = crypt.DecryptFromBytes(m.Bytes, key)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = json.Unmarshal(decryptedBytes, &remoteFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -498,9 +513,10 @@ func (c *Client) updateState() (err error) {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
key, _ := c.Pake.SessionKey()
|
||||||
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
||||||
Type: "fileinfo",
|
Type: "fileinfo",
|
||||||
Bytes: b,
|
Bytes: crypt.EncryptToBytes(b, key),
|
||||||
}.String()).Err()
|
}.String()).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -581,9 +597,10 @@ func (c *Client) updateState() (err error) {
|
||||||
CurrentFileChunks: c.CurrentFileChunks,
|
CurrentFileChunks: c.CurrentFileChunks,
|
||||||
FilesToTransferCurrentNum: c.FilesToTransferCurrentNum,
|
FilesToTransferCurrentNum: c.FilesToTransferCurrentNum,
|
||||||
})
|
})
|
||||||
|
key, _ := c.Pake.SessionKey()
|
||||||
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
||||||
Type: "recipientready",
|
Type: "recipientready",
|
||||||
Bytes: bRequest,
|
Bytes: crypt.EncryptToBytes(bRequest, key),
|
||||||
}.String()).Err()
|
}.String()).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue