Merge remote-tracking branch 'origin/master'

pull/1298/head
HFO4 3 years ago
commit e705dedc22

@ -40,7 +40,7 @@
* :cloud: 支持本机、从机、七牛、阿里云 OSS、腾讯云 COS、又拍云、OneDrive (包括世纪互联版) 作为存储端 * :cloud: 支持本机、从机、七牛、阿里云 OSS、腾讯云 COS、又拍云、OneDrive (包括世纪互联版) 作为存储端
* :outbox_tray: 上传/下载 支持客户端直传,支持下载限速 * :outbox_tray: 上传/下载 支持客户端直传,支持下载限速
* 💾 可对接 Aria2 离线下载,可使用多个从机点分担下载任务 * 💾 可对接 Aria2 离线下载,可使用多个从机点分担下载任务
* 📚 在线 压缩/解压缩、多文件打包下载 * 📚 在线 压缩/解压缩、多文件打包下载
* 💻 覆盖全部存储策略的 WebDAV 协议支持 * 💻 覆盖全部存储策略的 WebDAV 协议支持
* :zap: 拖拽上传、目录上传、流式上传处理 * :zap: 拖拽上传、目录上传、流式上传处理
@ -71,7 +71,7 @@ chmod +x ./cloudreve
## :gear: 构建 ## :gear: 构建
自行构建前需要拥有 `Go >= 1.17`、`yarn`等必要依赖。 自行构建前需要拥有 `Go >= 1.17`、`node.js`、`yarn`、`zip` 等必要依赖。
#### 克隆代码 #### 克隆代码
@ -88,7 +88,12 @@ cd assets
yarn install yarn install
# 开始构建 # 开始构建
yarn run build yarn run build
# 构建完成后删除映射文件
cd build
find . -name "*.map" -type f -delete
# 返回项目主目录打包静态资源
cd ../../
zip -r - assets/build >assets.zip
``` ```
#### 编译项目 #### 编译项目
@ -102,7 +107,7 @@ export VERSION=$(git describe --tags)
go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'"
``` ```
你也可以使用项目根目录下的`build.sh`快速开始构建: 你也可以使用项目根目录下的 `build.sh` 快速开始构建:
```shell ```shell
./build.sh [-a] [-c] [-b] [-r] ./build.sh [-a] [-c] [-b] [-r]
@ -114,7 +119,7 @@ go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/p
## :alembic: 技术栈 ## :alembic: 技术栈
* [Go ](https://golang.org/) + [Gin](https://github.com/gin-gonic/gin) * [Go](https://golang.org/) + [Gin](https://github.com/gin-gonic/gin)
* [React](https://github.com/facebook/react) + [Redux](https://github.com/reduxjs/redux) + [Material-UI](https://github.com/mui-org/material-ui) * [React](https://github.com/facebook/react) + [Redux](https://github.com/reduxjs/redux) + [Material-UI](https://github.com/mui-org/material-ui)
## :scroll: 许可证 ## :scroll: 许可证

@ -88,7 +88,7 @@ usage() {
exit 1 exit 1
} }
while getopts "bacr:d" o; do while getopts "bacrd" o; do
case "${o}" in case "${o}" in
b) b)
ASSETS="true" ASSETS="true"

@ -4,9 +4,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/chunk"
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/chunk/backoff"
"github.com/cloudreve/Cloudreve/v3/pkg/util"
"io" "io"
"net/http" "net/http"
"net/url" "net/url"
@ -15,6 +12,10 @@ import (
"strings" "strings"
"time" "time"
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/chunk"
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/chunk/backoff"
"github.com/cloudreve/Cloudreve/v3/pkg/util"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
@ -299,7 +300,10 @@ func (handler *Driver) Source(
ttl = 3600 ttl = 3600
} }
signedURL, _ := req.Presign(time.Duration(ttl) * time.Second) signedURL, err := req.Presign(time.Duration(ttl) * time.Second)
if err != nil {
return "", err
}
// 将最终生成的签名URL域名换成用户自定义的加速域名如果有 // 将最终生成的签名URL域名换成用户自定义的加速域名如果有
finalURL, err := url.Parse(signedURL) finalURL, err := url.Parse(signedURL)

Loading…
Cancel
Save