Files
OpenList/internal/model/storage.go
SenkjM 5a0d8ee1b8 feat(proxy): add disable proxy sign (#764)
* feat(proxy): add disable proxy sign

* Update driver.go

* GenerateDownProxyUrl

* .

* Update internal/op/driver.go

Signed-off-by: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com>

* .

---------

Signed-off-by: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com>
Co-authored-by: j2rong4cn <j2rong@qq.com>
Co-authored-by: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com>
2025-07-21 17:03:08 +08:00

58 lines
1.7 KiB
Go

package model
import (
"time"
)
type Storage struct {
ID uint `json:"id" gorm:"primaryKey"` // unique key
MountPath string `json:"mount_path" gorm:"unique" binding:"required"` // must be standardized
Order int `json:"order"` // use to sort
Driver string `json:"driver"` // driver used
CacheExpiration int `json:"cache_expiration"` // cache expire time
Status string `json:"status"`
Addition string `json:"addition" gorm:"type:text"` // Additional information, defined in the corresponding driver
Remark string `json:"remark"`
Modified time.Time `json:"modified"`
Disabled bool `json:"disabled"` // if disabled
DisableIndex bool `json:"disable_index"`
EnableSign bool `json:"enable_sign"`
Sort
Proxy
}
type Sort struct {
OrderBy string `json:"order_by"`
OrderDirection string `json:"order_direction"`
ExtractFolder string `json:"extract_folder"`
}
type Proxy struct {
WebProxy bool `json:"web_proxy"`
WebdavPolicy string `json:"webdav_policy"`
ProxyRange bool `json:"proxy_range"`
DownProxyURL string `json:"down_proxy_url"`
//Disable sign for DownProxyURL
DisableProxySign bool `json:"disable_proxy_sign"`
}
func (s *Storage) GetStorage() *Storage {
return s
}
func (s *Storage) SetStorage(storage Storage) {
*s = storage
}
func (s *Storage) SetStatus(status string) {
s.Status = status
}
func (p Proxy) Webdav302() bool {
return p.WebdavPolicy == "302_redirect"
}
func (p Proxy) WebdavProxyURL() bool {
return p.WebdavPolicy == "use_proxy_url"
}