filesharing

package
v0.29.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDownloadPath added in v0.14.6

func GenerateDownloadPath(basePath, fileName string, overwrite bool) (filePath, manifestPath string)

GenerateDownloadPath creates a file path that doesn't currently exist on the filesystem

Types

type Functionality

type Functionality struct {
}

Functionality groups some common UI triggered functions for contacts...

func FunctionalityGate

func FunctionalityGate() *Functionality

FunctionalityGate returns filesharing functionality - gates now happen on function calls.

func PreviewFunctionalityGate added in v0.14.6

func PreviewFunctionalityGate(experimentMap map[string]bool) (*Functionality, error)

PreviewFunctionalityGate returns filesharing if image previews are enabled

func (*Functionality) CheckDownloadStatus added in v0.19.0

func (f *Functionality) CheckDownloadStatus(profile peer.CwtchPeer, fileKey string) error

func (*Functionality) DownloadFile

func (f *Functionality) DownloadFile(profile peer.CwtchPeer, conversationID int, downloadFilePath string, manifestFilePath string, key string, limit uint64) error

DownloadFile given a profile, a conversation handle and a file sharing key, start off a download process to downloadFilePath

func (*Functionality) DownloadFileDefaultLimit added in v0.19.0

func (f *Functionality) DownloadFileDefaultLimit(profile peer.CwtchPeer, conversationID int, downloadFilePath string, manifestFilePath string, key string) error

DownloadFileDefaultLimit given a profile, a conversation handle and a file sharing key, start off a download process to downloadFilePath with a default filesize limit

func (*Functionality) EnhancedGetSharedFiles added in v0.19.0

func (f *Functionality) EnhancedGetSharedFiles(profile peer.CwtchPeer, conversationID int) string

func (*Functionality) EnhancedShareFile added in v0.19.0

func (f *Functionality) EnhancedShareFile(profile peer.CwtchPeer, conversationID int, sharefilepath string) string

func (*Functionality) EventsToRegister added in v0.19.0

func (f *Functionality) EventsToRegister() []event.Type

func (*Functionality) ExperimentsToRegister added in v0.19.0

func (f *Functionality) ExperimentsToRegister() []string

func (*Functionality) GetFileShareInfo added in v0.17.0

func (f *Functionality) GetFileShareInfo(profile peer.CwtchPeer, filekey string) (*SharedFile, error)

GetFileShareInfo returns information related to a known fileshare. An error is returned if the data is incomplete

func (*Functionality) GetSharedFiles added in v0.17.0

func (f *Functionality) GetSharedFiles(profile peer.CwtchPeer, conversationID int) []SharedFile

GetSharedFiles returns all file shares associated with a given conversation

func (*Functionality) NotifySettingsUpdate added in v0.19.2

func (f *Functionality) NotifySettingsUpdate(settings settings.GlobalSettings)

func (*Functionality) OnContactReceiveValue added in v0.19.0

func (f *Functionality) OnContactReceiveValue(profile peer.CwtchPeer, conversation model.Conversation, path attr.ScopedZonedPath, value string, exists bool)

func (*Functionality) OnContactRequestValue added in v0.19.0

func (f *Functionality) OnContactRequestValue(profile peer.CwtchPeer, conversation model.Conversation, eventID string, path attr.ScopedZonedPath)

func (*Functionality) OnEvent added in v0.19.0

func (f *Functionality) OnEvent(ev event.Event, profile peer.CwtchPeer)

OnEvent handles File Sharing Hooks like Manifest Received and FileDownloaded

func (*Functionality) ReShareFiles added in v0.17.0

func (f *Functionality) ReShareFiles(profile peer.CwtchPeer) error

ReShareFiles given a profile we iterate through all existing fileshares and re-share them if the time limit has not expired

func (*Functionality) RestartFileShare added in v0.17.0

func (f *Functionality) RestartFileShare(profile peer.CwtchPeer, filekey string) error

RestartFileShare takes in an existing filekey and, assuming the manifest exists, restarts sharing of the manifest by default this function always forces a file share, even if the file has timed out.

func (*Functionality) ShareFile

func (f *Functionality) ShareFile(filepath string, profile peer.CwtchPeer) (string, string, error)

ShareFile given a profile and a conversation handle, sets up a file sharing process to share the file at filepath

func (*Functionality) StopAllFileShares added in v0.19.0

func (f *Functionality) StopAllFileShares(profile peer.CwtchPeer)

StopAllFileShares sends a message to the ProtocolEngine to cease sharing all files

func (*Functionality) StopFileShare added in v0.19.0

func (f *Functionality) StopFileShare(profile peer.CwtchPeer, fileKey string) error

StopFileShare sends a message to the ProtocolEngine to cease sharing a particular file

func (*Functionality) VerifyOrResumeDownload added in v0.19.0

func (f *Functionality) VerifyOrResumeDownload(profile peer.CwtchPeer, conversation int, fileKey string, size uint64) error

func (*Functionality) VerifyOrResumeDownloadDefaultLimit added in v0.20.0

func (f *Functionality) VerifyOrResumeDownloadDefaultLimit(profile peer.CwtchPeer, conversation int, fileKey string) error

type ImagePreviewsFunctionality added in v0.19.2

type ImagePreviewsFunctionality struct {
	// contains filtered or unexported fields
}

func (*ImagePreviewsFunctionality) EventsToRegister added in v0.19.2

func (i *ImagePreviewsFunctionality) EventsToRegister() []event.Type

func (*ImagePreviewsFunctionality) ExperimentsToRegister added in v0.19.2

func (i *ImagePreviewsFunctionality) ExperimentsToRegister() []string

func (*ImagePreviewsFunctionality) NotifySettingsUpdate added in v0.19.2

func (i *ImagePreviewsFunctionality) NotifySettingsUpdate(settings settings.GlobalSettings)

func (*ImagePreviewsFunctionality) OnContactReceiveValue added in v0.19.2

func (i *ImagePreviewsFunctionality) OnContactReceiveValue(profile peer.CwtchPeer, conversation model.Conversation, path attr.ScopedZonedPath, value string, exists bool)

func (*ImagePreviewsFunctionality) OnContactRequestValue added in v0.19.2

func (i *ImagePreviewsFunctionality) OnContactRequestValue(profile peer.CwtchPeer, conversation model.Conversation, eventID string, path attr.ScopedZonedPath)

func (*ImagePreviewsFunctionality) OnEvent added in v0.19.2

func (i *ImagePreviewsFunctionality) OnEvent(ev event.Event, profile peer.CwtchPeer)

type OverlayMessage

type OverlayMessage struct {
	Name  string `json:"f"`
	Hash  string `json:"h"`
	Nonce string `json:"n"`
	Size  uint64 `json:"s"`
}

OverlayMessage presents the canonical format of the File Sharing functionality Overlay Message This is the format that the UI will parse to display the message

func (*OverlayMessage) FileKey added in v0.14.6

func (om *OverlayMessage) FileKey() string

FileKey is the unique reference to a file offer

func (*OverlayMessage) ShouldAutoDL added in v0.14.6

func (om *OverlayMessage) ShouldAutoDL() bool

ShouldAutoDL checks file size and file name. *DOES NOT* check user settings or contact state

type SharedFile added in v0.17.0

type SharedFile struct {

	// The roothash.nonce identifier derived for this file share
	FileKey string

	// Path is the OS specific location of the file
	Path string

	// DateShared is the original datetime the file was shared
	DateShared time.Time

	// Active is true if the file is currently being shared, false otherwise
	Active bool

	// Expired is true if the file is not eligible to be shared (because e.g. it has been too long since the file was originally shared,
	// or the file no longer exists).
	Expired bool
}

SharedFile encapsulates information about a shared file including the file key, file path, the original share date and the current sharing status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL