Compare commits

...

2 Commits

Author SHA1 Message Date
55275db618 Merge pull request '[🚀] region' (#4) from dev into main
Reviewed-on: #4
2024-08-06 10:06:11 +08:00
a72c860511 [🚀] region 2024-08-06 10:04:41 +08:00

View File

@ -56,13 +56,12 @@ type PutRet struct {
User string `json:"user"`
}
func New(accessKey, secretKey, bucket, domain, securityKey string) QiNiu {
region, _ := storage.GetRegion(accessKey, bucket)
func New(accessKey, secretKey, bucket, domain, securityKey string, region *storage.Region) QiNiu {
mac := qbox.NewMac(accessKey, secretKey)
conf := &storage.Config{
Region: region, //空间所在的存储区域
UseHTTPS: true, //是否使用https域名
UseCdnDomains: true, //上传是否使用CDN上传加速
UseCdnDomains: false, //上传是否使用CDN上传加速
}
return &qiNiu{
mac: mac,
@ -216,7 +215,7 @@ func (q *qiNiu) GetFileHash(path, qhash string) (hash string, err error) {
}
sign := q.TimestampSecuritySign(path, time.Second*5)
addr := fmt.Sprintf("https://cdn.mogume.com/%s?%s&qhash/%s", path, sign, qhash)
addr := fmt.Sprintf("%s/%s?%s&qhash/%s", strings.TrimRight(q.domain, "/"), path, sign, qhash)
resp, err := http.Get(addr)
if err != nil {