Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/drivers/baidu_netdisk/meta.go
2326 views
1
package baidu_netdisk
2
3
import (
4
"time"
5
6
"github.com/alist-org/alist/v3/internal/driver"
7
"github.com/alist-org/alist/v3/internal/op"
8
)
9
10
type Addition struct {
11
RefreshToken string `json:"refresh_token" required:"true"`
12
driver.RootPath
13
OrderBy string `json:"order_by" type:"select" options:"name,time,size" default:"name"`
14
OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
15
DownloadAPI string `json:"download_api" type:"select" options:"official,crack,crack_video" default:"official"`
16
ClientID string `json:"client_id" required:"true" default:"hq9yQ9w9kR4YHj1kyYafLygVocobh7Sf"`
17
ClientSecret string `json:"client_secret" required:"true" default:"YH2VpZcFJHYNnV6vLfHQXDBhcE7ZChyE"`
18
CustomCrackUA string `json:"custom_crack_ua" required:"true" default:"netdisk"`
19
AccessToken string
20
UploadThread string `json:"upload_thread" default:"3" help:"1<=thread<=32"`
21
UploadAPI string `json:"upload_api" default:"https://d.pcs.baidu.com"`
22
UseDynamicUploadAPI bool `json:"use_dynamic_upload_api" default:"true" help:"dynamically get upload api domain, when enabled, the 'Upload API' setting will be used as a fallback if failed to get"`
23
CustomUploadPartSize int64 `json:"custom_upload_part_size" type:"number" default:"0" help:"0 for auto"`
24
LowBandwithUploadMode bool `json:"low_bandwith_upload_mode" default:"false"`
25
OnlyListVideoFile bool `json:"only_list_video_file" default:"false"`
26
}
27
28
const (
29
UPLOAD_FALLBACK_API = "https://d.pcs.baidu.com" // 备用上传地址
30
UPLOAD_URL_EXPIRE_TIME = time.Minute * 60 // 上传地址有效期(分钟)
31
UPLOAD_TIMEOUT = time.Minute * 30 // 上传请求超时时间
32
UPLOAD_RETRY_COUNT = 3
33
UPLOAD_RETRY_WAIT_TIME = time.Second * 1
34
UPLOAD_RETRY_MAX_WAIT_TIME = time.Second * 5
35
)
36
37
var config = driver.Config{
38
Name: "BaiduNetdisk",
39
DefaultRoot: "/",
40
}
41
42
func init() {
43
op.RegisterDriver(func() driver.Driver {
44
return &BaiduNetdisk{}
45
})
46
}
47
48