Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TUS global capabilities #775

Merged
merged 1 commit into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/reva/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ bigfilechunking = true
blacklisted_files = ["foo"]
undelete = true
versioning = true
[http.services.ocssvc.capabilities.capabilities.files.tus_support]
version = "1.0.0"
resumable = "1.0.0"
extension = "creation,creation-with-upload"
http_method_override = ""
max_chunk_size = 0
[http.services.ocssvc.capabilities.capabilities.dav]
chunking = "" # set to "1.0" for experimental support
[http.services.ocssvc.capabilities.capabilities.files_sharing]
Expand Down
22 changes: 16 additions & 6 deletions internal/http/services/owncloud/ocs/data/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type CapabilitiesData struct {
type Capabilities struct {
Core *CapabilitiesCore `json:"core" xml:"core"`
Checksums *CapabilitiesChecksums `json:"checksums" xml:"checksums"`
Files *CapabilitiesFiles `json:"files" xml:"files"`
Files *CapabilitiesFiles `json:"files" xml:"files" mapstructure:"files"`
Dav *CapabilitiesDav `json:"dav" xml:"dav"`
FilesSharing *CapabilitiesFilesSharing `json:"files_sharing" xml:"files_sharing" mapstructure:"files_sharing"`
Notifications *CapabilitiesNotifications `json:"notifications" xml:"notifications"`
Expand Down Expand Up @@ -83,13 +83,23 @@ type CapabilitiesChecksums struct {
PreferredUploadType string `json:"preferredUploadType" xml:"preferredUploadType" mapstructure:"preferred_upload_type"`
}

// CapabilitiesFilesTusSupport TODO this must be a summry of storages
type CapabilitiesFilesTusSupport struct {
Version string `json:"version" xml:"version"`
Resumable string `json:"resumable" xml:"resumable"`
Extension string `json:"extension" xml:"extension"`
MaxChunkSize int `json:"max_chunk_size" xml:"max_chunk_size" mapstructure:"max_chunk_size"`
HTTPMethodOverride string `json:"http_method_override" xml:"http_method_override" mapstructure:"http_method_override"`
}

// CapabilitiesFiles TODO this is storage specific, not global. What effect do these options have on the clients?
type CapabilitiesFiles struct {
PrivateLinks ocsBool `json:"privateLinks" xml:"privateLinks" mapstructure:"private_links"`
BigFileChunking ocsBool `json:"bigfilechunking" xml:"bigfilechunking"`
Undelete ocsBool `json:"undelete" xml:"undelete"`
Versioning ocsBool `json:"versioning" xml:"versioning"`
BlacklistedFiles []string `json:"blacklisted_files" xml:"blacklisted_files>element" mapstructure:"blacklisted_files"`
PrivateLinks ocsBool `json:"privateLinks" xml:"privateLinks" mapstructure:"private_links"`
BigFileChunking ocsBool `json:"bigfilechunking" xml:"bigfilechunking"`
Undelete ocsBool `json:"undelete" xml:"undelete"`
Versioning ocsBool `json:"versioning" xml:"versioning"`
BlacklistedFiles []string `json:"blacklisted_files" xml:"blacklisted_files>element" mapstructure:"blacklisted_files"`
TusSupport *CapabilitiesFilesTusSupport `json:"tus_support" xml:"tus_support" mapstructure:"tus_support"`
}

// CapabilitiesDav holds dav endpoint config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ func (h *Handler) Init(c *config.Config) {
// h.c.Capabilities.Files.Undelete is boolean
// h.c.Capabilities.Files.Versioning is boolean

if h.c.Capabilities.Files.TusSupport == nil {
// these are global capabilities
// TODO: infer from various TUS handlers from all known storages
h.c.Capabilities.Files.TusSupport = &data.CapabilitiesFilesTusSupport{
Version: "1.0.0",
Resumable: "1.0.0",
Extension: "creation,creation-with-upload",
MaxChunkSize: 0,
HTTPMethodOverride: "",
}
}

// dav

if h.c.Capabilities.Dav == nil {
Expand Down