fix: auto accept block ask process

This commit is contained in:
2026-02-05 15:24:16 +08:00
parent dcba4c3e05
commit 6d8a8c4e2f
4 changed files with 118 additions and 18 deletions

View File

@@ -44,10 +44,11 @@ func (s *Service) SendFile(target *discovery.Peer, targetIP string, filePath str
task := NewTransfer(
taskID,
Sender{
ID: s.discoveryService.GetID(),
Name: s.config.GetHostName(),
},
NewSender(
s.discoveryService.GetID(),
s.config.GetHostName(),
WithReceiverIP(targetIP, s.discoveryService),
),
WithFileName(filepath.Base(filePath)),
WithFileSize(stat.Size()),
WithType(TransferTypeSend),
@@ -105,10 +106,11 @@ func (s *Service) SendFolder(target *discovery.Peer, targetIP string, folderPath
task := NewTransfer(
taskID,
Sender{
ID: s.discoveryService.GetID(),
Name: s.config.GetHostName(),
},
NewSender(
s.discoveryService.GetID(),
s.config.GetHostName(),
WithReceiverIP(targetIP, s.discoveryService),
),
WithFileName(filepath.Base(folderPath)),
WithFileSize(size),
WithType(TransferTypeSend),
@@ -152,10 +154,11 @@ func (s *Service) SendText(target *discovery.Peer, targetIP string, text string)
r := bytes.NewReader([]byte(text))
task := NewTransfer(
taskID,
Sender{
ID: s.discoveryService.GetID(),
Name: s.config.GetHostName(),
},
NewSender(
s.discoveryService.GetID(),
s.config.GetHostName(),
WithReceiverIP(targetIP, s.discoveryService),
),
WithFileSize(int64(len(text))),
WithType(TransferTypeSend),
WithContentType(ContentTypeText),