mirror of https://github.com/Xhofe/alist
				
				
				
			chore: webdav policy of account
							parent
							
								
									2aff218356
								
							
						
					
					
						commit
						087fae1b15
					
				|  | @ -22,9 +22,8 @@ type Sort struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Proxy struct { | type Proxy struct { | ||||||
| 	WebProxy     string `json:"web_proxy"` | 	WebProxy     bool   `json:"web_proxy"` | ||||||
| 	WebdavProxy  bool   `json:"webdav_proxy"` | 	WebdavPolicy string `json:"webdav_policy"` | ||||||
| 	WebdavDirect bool   `json:"webdav_direct"` |  | ||||||
| 	DownProxyUrl string `json:"down_proxy_url"` | 	DownProxyUrl string `json:"down_proxy_url"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -35,3 +34,15 @@ func (a Account) GetAccount() Account { | ||||||
| func (a *Account) SetStatus(status string) { | func (a *Account) SetStatus(status string) { | ||||||
| 	a.Status = status | 	a.Status = status | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (p Proxy) Webdav302() bool { | ||||||
|  | 	return p.WebdavPolicy == "302_redirect" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (p Proxy) WebdavProxy() bool { | ||||||
|  | 	return p.WebdavPolicy == "use_proxy_url" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (p Proxy) WebdavNative() bool { | ||||||
|  | 	return !p.Webdav302() && !p.WebdavProxy() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -64,20 +64,27 @@ func getMainItems(config driver.Config) []driver.Item { | ||||||
| 	}, { | 	}, { | ||||||
| 		Name: "down_proxy_url", | 		Name: "down_proxy_url", | ||||||
| 		Type: driver.TypeText, | 		Type: driver.TypeText, | ||||||
| 	}, { |  | ||||||
| 		Name: "webdav_direct", |  | ||||||
| 		Type: driver.TypeBool, |  | ||||||
| 		Help: "Transfer the WebDAV of this account through the native without redirect", |  | ||||||
| 	}} | 	}} | ||||||
| 	if !config.OnlyProxy && !config.OnlyLocal { | 	if !config.OnlyProxy && !config.OnlyLocal { | ||||||
| 		items = append(items, []driver.Item{{ | 		items = append(items, []driver.Item{{ | ||||||
| 			Name: "web_proxy", | 			Name: "web_proxy", | ||||||
| 			Type: driver.TypeBool, | 			Type: driver.TypeBool, | ||||||
| 		}, { | 		}, { | ||||||
| 			Name: "webdav_proxy", | 			Name:     "webdav_policy", | ||||||
| 			Type: driver.TypeBool, | 			Type:     driver.TypeSelect, | ||||||
|  | 			Values:   "302_redirect, use_proxy_url, native_proxy", | ||||||
|  | 			Default:  "direct", | ||||||
|  | 			Required: true, | ||||||
| 		}, | 		}, | ||||||
| 		}...) | 		}...) | ||||||
|  | 	} else { | ||||||
|  | 		items = append(items, driver.Item{ | ||||||
|  | 			Name:     "webdav_policy", | ||||||
|  | 			Type:     driver.TypeSelect, | ||||||
|  | 			Default:  "", | ||||||
|  | 			Values:   "use_proxy_url, native_proxy", | ||||||
|  | 			Required: true, | ||||||
|  | 		}) | ||||||
| 	} | 	} | ||||||
| 	if config.LocalSort { | 	if config.LocalSort { | ||||||
| 		items = append(items, []driver.Item{{ | 		items = append(items, []driver.Item{{ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Noah Hsu
						Noah Hsu