Feat: generating token and callback url for OSS muiltpart upload, support resume upload in sever-side uploading for OSS

This commit is contained in:
HFO4
2022-03-20 11:23:55 +08:00
parent 015ccd5026
commit 0df9529b32
13 changed files with 146 additions and 82 deletions

View File

@@ -124,8 +124,7 @@ func addDefaultSettings() {
{Name: "share_download_session_timeout", Value: `2073600`, Type: "timeout"},
{Name: "onedrive_callback_check", Value: `20`, Type: "timeout"},
{Name: "folder_props_timeout", Value: `300`, Type: "timeout"},
{Name: "onedrive_chunk_retries", Value: `5`, Type: "retry"},
{Name: "slave_chunk_retries", Value: `5`, Type: "retry"},
{Name: "chunk_retries", Value: `5`, Type: "retry"},
{Name: "onedrive_source_timeout", Value: `1800`, Type: "timeout"},
{Name: "reset_after_upload_failed", Value: `0`, Type: "upload"},
{Name: "login_captcha", Value: `0`, Type: "login"},

View File

@@ -60,6 +60,8 @@ type PolicyOption struct {
ServerSideEndpoint string `json:"server_side_endpoint,omitempty"`
// 分片上传的分片大小
ChunkSize uint64 `json:"chunk_size,omitempty"`
// 分片上传时是否需要预留空间
PlaceholderWithSize bool `json:"placeholder_with_size,omitempty"`
}
var thumbSuffix = map[string][]string{
@@ -226,7 +228,15 @@ func (policy *Policy) IsThumbGenerateNeeded() bool {
// IsUploadPlaceholderWithSize 返回此策略创建上传会话时是否需要预留空间
func (policy *Policy) IsUploadPlaceholderWithSize() bool {
return policy.Type == "remote"
if policy.Type == "remote" {
return true
}
if policy.Type == "onedrive" || policy.Type == "oss" {
return policy.OptionsSerialized.PlaceholderWithSize
}
return false
}
// CanStructureBeListed 返回存储策略是否能被前台列物理目录