change proxy setting

This commit is contained in:
微凉
2021-11-17 17:20:57 +08:00
parent 0b7f2fee7d
commit 3d9746485d
8 changed files with 202 additions and 151 deletions

View File

@ -29,6 +29,13 @@ var client189Map map[string]*resty.Client
func (c Cloud189) Items() []Item {
return []Item{
{
Name: "proxy",
Label: "proxy",
Type: "bool",
Required: true,
Description: "allow proxy",
},
{
Name: "username",
Label: "username",
@ -224,6 +231,9 @@ func (c Cloud189) Link(path string, account *model.Account) (string, error) {
return "", fmt.Errorf(resp.ResMessage)
}
res, err := noRedirectClient.R().Get(resp.FileDownloadUrl)
if err != nil {
return "", err
}
if res.StatusCode() == 302 {
return res.Header().Get("location"), nil
}

View File

@ -67,6 +67,13 @@ func (a AliDrive) Preview(path string, account *model.Account) (interface{}, err
func (a AliDrive) Items() []Item {
return []Item{
{
Name: "proxy",
Label: "proxy",
Type: "bool",
Required: true,
Description: "allow proxy",
},
{
Name: "order_by",
Label: "order_by",

View File

@ -43,6 +43,7 @@ func (n Native) Save(account *model.Account, old *model.Account) error {
return fmt.Errorf("[%s] not exist", account.RootFolder)
}
account.Status = "work"
account.Proxy = true
err := model.SaveAccount(account)
if err != nil {
return err

View File

@ -77,6 +77,13 @@ func (o Onedrive) GetMetaUrl(account *model.Account, auth bool, path string) str
func (o Onedrive) Items() []Item {
return []Item{
{
Name: "proxy",
Label: "proxy",
Type: "bool",
Required: true,
Description: "allow proxy",
},
{
Name: "zone",
Label: "zone",