taildrop: include the absolute path in WaitingFiles

updates ENG-2868

including the source path for waiting files allows capable clients to move temporary taildrop files to the users's chosen location directly, rather than using the /files GET and DELETE endpoints.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
This commit is contained in:
Jonathan Nobels 2024-03-27 10:00:29 -04:00
parent 66e4d843c1
commit 21a6b02ed4
2 changed files with 12 additions and 4 deletions

View File

@ -30,9 +30,16 @@ type FileTarget struct {
PeerAPIURL string
}
// WaitingFiles represent taildrop files sent to the node, ready to be
// copied to their permenant location by the client. The client may
// opt to handle these these using either the /files GET and DELETE
// endpoints or by moving the file if the client has read/write
// access to the AbsolutePath. The client is responsible for removing
// the file when they have finished processing it.
type WaitingFile struct {
Name string
Size int64
Name string
Size int64
AbsolutePath string
}
// SetPushDeviceTokenRequest is the body POSTed to the LocalAPI endpoint /set-device-token.

View File

@ -80,8 +80,9 @@ func (m *Manager) WaitingFiles() (ret []apitype.WaitingFile, err error) {
return true
}
ret = append(ret, apitype.WaitingFile{
Name: filepath.Base(name),
Size: fi.Size(),
AbsolutePath: filepath.Join(m.opts.Dir, name),
Name: filepath.Base(name),
Size: fi.Size(),
})
}
return true