⭐ 跳过检查更新
This commit is contained in:
@@ -27,6 +27,7 @@ type DownloadReq struct {
|
||||
DriveId string `json:"drive_id"`
|
||||
FileId string `json:"file_id"`
|
||||
ExpireSec int `json:"expire_sec"`
|
||||
FileName string `json:"file_name"`
|
||||
}
|
||||
|
||||
// search request bean
|
||||
|
@@ -29,14 +29,14 @@ func GetFile(fileId string) (*File, error) {
|
||||
}
|
||||
|
||||
// get download_url
|
||||
func GetDownLoadUrl(fileId string) (*File, error) {
|
||||
func GetDownLoadUrl(fileId string) (*DownloadResp, error) {
|
||||
url:=conf.Conf.AliDrive.ApiUrl+"/file/get_download_url"
|
||||
req:=DownloadReq{
|
||||
DriveId: User.DefaultDriveId,
|
||||
FileId: fileId,
|
||||
ExpireSec: 14400,
|
||||
}
|
||||
var resp File
|
||||
var resp DownloadResp
|
||||
if err := BodyToJson(url, req, &resp, true); err!=nil {
|
||||
return nil,err
|
||||
}
|
||||
|
@@ -104,6 +104,18 @@ type File struct {
|
||||
Paths []Path `json:"paths"`
|
||||
}
|
||||
|
||||
type DownloadResp struct {
|
||||
RespError
|
||||
Expiration string `json:"expiration"`
|
||||
Method string `json:"method"`
|
||||
Size int64 `json:"size"`
|
||||
Url string `json:"url"`
|
||||
//RateLimit struct{
|
||||
// PartSize int `json:"part_size"`
|
||||
// PartSpeed int `json:"part_speed"`
|
||||
//} `json:"rate_limit"`//rate limit
|
||||
}
|
||||
|
||||
// token_login response bean
|
||||
type TokenLoginResp struct {
|
||||
RespError
|
||||
|
@@ -14,6 +14,7 @@ func init() {
|
||||
flag.BoolVar(&conf.Help,"help",false,"show usage help")
|
||||
flag.BoolVar(&conf.Version,"version",false,"show version info")
|
||||
flag.StringVar(&conf.Con,"conf","conf.yml","config file")
|
||||
flag.BoolVar(&conf.SkipUpdate,"skip-update",false,"skip update")
|
||||
}
|
||||
|
||||
// bootstrap run
|
||||
@@ -48,7 +49,9 @@ func printASC() {
|
||||
func start() {
|
||||
InitLog()
|
||||
printASC()
|
||||
if !conf.SkipUpdate {
|
||||
CheckUpdate()
|
||||
}
|
||||
if !ReadConf(conf.Con) {
|
||||
log.Errorf("读取配置文件时出现错误,启动失败.")
|
||||
return
|
||||
|
@@ -10,6 +10,8 @@ var(
|
||||
Help bool // is help command
|
||||
Version bool // is print version command
|
||||
Con string // config file
|
||||
SkipUpdate bool // skip update
|
||||
|
||||
Client *http.Client // request client
|
||||
Authorization string // authorization string
|
||||
|
||||
|
Reference in New Issue
Block a user