LocalSend-compatible file-transfer TUI for headless Arch/Omarchy servers. - Pure-stdlib implementation of the LocalSend v2 protocol (discovery, HTTPS with matching cert fingerprint, send/receive, PIN). - Bubble Tea TUI: Devices, Transfers, Manage (received-file housekeeping) and Settings, theme-aware on Omarchy. - Dual-mode install.sh: curl-pipe download or build-from-clone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package protocol
|
|
|
|
// FileMetadata describes one file offered in a prepare-upload request. SHA256
|
|
// and Preview are optional; the spec permits omitting the hash to avoid
|
|
// pre-hashing large files.
|
|
type FileMetadata struct {
|
|
ID string `json:"id"`
|
|
FileName string `json:"fileName"`
|
|
Size int64 `json:"size"`
|
|
FileType string `json:"fileType"`
|
|
SHA256 string `json:"sha256,omitempty"`
|
|
Preview string `json:"preview,omitempty"`
|
|
Metadata *FileTimestamps `json:"metadata,omitempty"`
|
|
}
|
|
|
|
// FileTimestamps carries optional modified/accessed times (RFC 3339 strings).
|
|
type FileTimestamps struct {
|
|
Modified string `json:"modified,omitempty"`
|
|
Accessed string `json:"accessed,omitempty"`
|
|
}
|
|
|
|
// PrepareUploadRequest is the body POSTed to /prepare-upload by the sender.
|
|
// Files is keyed by fileId.
|
|
type PrepareUploadRequest struct {
|
|
Info DeviceInfo `json:"info"`
|
|
Files map[string]FileMetadata `json:"files"`
|
|
}
|
|
|
|
// PrepareUploadResponse is returned by the receiver: a session id plus a
|
|
// single-use token per fileId.
|
|
type PrepareUploadResponse struct {
|
|
SessionID string `json:"sessionId"`
|
|
Files map[string]string `json:"files"`
|
|
}
|