download-link
into V20220228
2 years ago
@@ -88,12 +88,25 @@ func (a *Attachment) APIFormat() *api.Attachment { | |||||
Size: a.Size, | Size: a.Size, | ||||
UUID: a.UUID, | UUID: a.UUID, | ||||
DownloadURL: a.DownloadURL(), | DownloadURL: a.DownloadURL(), | ||||
S3DownloadURL: a.S3DownloadURL(), | |||||
} | } | ||||
} | } | ||||
// DownloadURL returns the download url of the attached file | // DownloadURL returns the download url of the attached file | ||||
func (a *Attachment) DownloadURL() string { | func (a *Attachment) DownloadURL() string { | ||||
return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID) | |||||
return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) | |||||
} | |||||
// S3DownloadURL returns the s3 download url of the attached file | |||||
func (a *Attachment) S3DownloadURL() string { | |||||
url := "" | |||||
if a.Type == TypeCloudBrainOne { | |||||
url, _ = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath+AttachmentRelativePath(a.UUID), a.Name) | |||||
} else if a.Type == TypeCloudBrainTwo { | |||||
url, _ = storage.ObsGetPreSignedUrl(a.UUID, a.Name) | |||||
} | |||||
return url | |||||
} | } | ||||
// AttachmentRelativePath returns the relative path | // AttachmentRelativePath returns the relative path | ||||
@@ -16,9 +16,10 @@ type Attachment struct { | |||||
Size int64 `json:"size"` | Size int64 `json:"size"` | ||||
DownloadCount int64 `json:"download_count"` | DownloadCount int64 `json:"download_count"` | ||||
// swagger:strfmt date-time | // swagger:strfmt date-time | ||||
Created time.Time `json:"created_at"` | |||||
UUID string `json:"uuid"` | |||||
DownloadURL string `json:"browser_download_url"` | |||||
Created time.Time `json:"created_at"` | |||||
UUID string `json:"uuid"` | |||||
DownloadURL string `json:"browser_download_url"` | |||||
S3DownloadURL string | |||||
} | } | ||||
// EditAttachmentOptions options for editing attachments | // EditAttachmentOptions options for editing attachments | ||||
@@ -14,7 +14,7 @@ | |||||
<div class="eight wide column right aligned"> | <div class="eight wide column right aligned"> | ||||
<div class="ui left mini icon buttons"> | <div class="ui left mini icon buttons"> | ||||
<span class="ui basic button text left" data-tooltip='{{$.i18n.Tr "dataset.download_count"}}' data-position="bottom right" style="width: 60px; padding-left: 0;">{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}}</span> | <span class="ui basic button text left" data-tooltip='{{$.i18n.Tr "dataset.download_count"}}' data-position="bottom right" style="width: 60px; padding-left: 0;">{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}}</span> | ||||
<span class="ui basic basic button clipboard" data-clipboard-text="{{.DownloadURL}}" data-tooltip='{{$.i18n.Tr "dataset.copy_url"}}' data-clipboard-action="copy"{{if ne $.Type 0}} style="display:none;"{{end}}>{{svg "octicon-file" 16}}</span> | |||||
<span class="ui basic basic button clipboard" data-clipboard-text="{{.DownloadURL}}" data-tooltip='{{$.i18n.Tr "dataset.copy_url"}}' data-clipboard-action="copy">{{svg "octicon-file" 16}}</span> | |||||
<span class="ui basic basic button clipboard" data-clipboard-text="{{.FileChunk.Md5}}" data-tooltip='{{$.i18n.Tr "dataset.copy_md5"}}' data-clipboard-action="copy">{{svg "octicon-file-binary" 16}}</span> | <span class="ui basic basic button clipboard" data-clipboard-text="{{.FileChunk.Md5}}" data-tooltip='{{$.i18n.Tr "dataset.copy_md5"}}' data-clipboard-action="copy">{{svg "octicon-file-binary" 16}}</span> | ||||
</div> | </div> | ||||
{{if eq .DecompressState 1}} | {{if eq .DecompressState 1}} | ||||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》