mirror of https://github.com/Xhofe/alist
chore: fix typo
parent
2bff656f00
commit
a16da3b45e
|
@ -20,7 +20,7 @@ type Driver struct {
|
||||||
Addition
|
Addition
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Driver) Config() driver.Config {
|
func (d *Driver) Config() driver.Config {
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ func (d *Driver) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Driver) Other(ctx context.Context, data interface{}) (interface{}, error) {
|
func (d *Driver) Other(ctx context.Context, data interface{}) (interface{}, error) {
|
||||||
return nil, errs.NotSupport
|
return nil, errs.NotSupport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ type Proxy struct {
|
||||||
DownProxyUrl string `json:"down_proxy_url"`
|
DownProxyUrl string `json:"down_proxy_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Storage) GetStorage() Storage {
|
func (a *Storage) GetStorage() Storage {
|
||||||
return a
|
return *a
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Storage) SetStatus(status string) {
|
func (a *Storage) SetStatus(status string) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ func registerDriverItems(config driver.Config, addition driver.Additional) {
|
||||||
|
|
||||||
func getMainItems(config driver.Config) []driver.Item {
|
func getMainItems(config driver.Config) []driver.Item {
|
||||||
items := []driver.Item{{
|
items := []driver.Item{{
|
||||||
Name: "virtual_path",
|
Name: "mount_path",
|
||||||
Type: conf.TypeString,
|
Type: conf.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
Help: "",
|
Help: "",
|
||||||
|
@ -62,6 +62,9 @@ func getMainItems(config driver.Config) []driver.Item {
|
||||||
Name: "index",
|
Name: "index",
|
||||||
Type: conf.TypeNumber,
|
Type: conf.TypeNumber,
|
||||||
Help: "use to sort",
|
Help: "use to sort",
|
||||||
|
}, {
|
||||||
|
Name: "remark",
|
||||||
|
Type: conf.TypeText,
|
||||||
}, {
|
}, {
|
||||||
Name: "down_proxy_url",
|
Name: "down_proxy_url",
|
||||||
Type: conf.TypeText,
|
Type: conf.TypeText,
|
||||||
|
|
|
@ -5,11 +5,16 @@ type PageReq struct {
|
||||||
PageSize int `json:"page_size" form:"page_size"`
|
PageSize int `json:"page_size" form:"page_size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MaxUint = ^uint(0)
|
||||||
|
const MinUint = 0
|
||||||
|
const MaxInt = int(MaxUint >> 1)
|
||||||
|
const MinInt = -MaxInt - 1
|
||||||
|
|
||||||
func (p *PageReq) Validate() {
|
func (p *PageReq) Validate() {
|
||||||
if p.PageIndex < 1 {
|
if p.PageIndex < 1 {
|
||||||
p.PageIndex = 1
|
p.PageIndex = 1
|
||||||
}
|
}
|
||||||
if p.PageSize < 1 {
|
if p.PageSize < 1 {
|
||||||
p.PageSize = 50
|
p.PageSize = MaxInt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ func ListMetas(c *gin.Context) {
|
||||||
common.ErrorResp(c, err, 400)
|
common.ErrorResp(c, err, 400)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
req.Validate()
|
||||||
log.Debugf("%+v", req)
|
log.Debugf("%+v", req)
|
||||||
metas, total, err := db.GetMetas(req.PageIndex, req.PageSize)
|
metas, total, err := db.GetMetas(req.PageIndex, req.PageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -17,6 +17,7 @@ func ListStorages(c *gin.Context) {
|
||||||
common.ErrorResp(c, err, 400)
|
common.ErrorResp(c, err, 400)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
req.Validate()
|
||||||
log.Debugf("%+v", req)
|
log.Debugf("%+v", req)
|
||||||
storages, total, err := db.GetStorages(req.PageIndex, req.PageSize)
|
storages, total, err := db.GetStorages(req.PageIndex, req.PageSize)
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -16,6 +16,7 @@ func ListUsers(c *gin.Context) {
|
||||||
common.ErrorResp(c, err, 400)
|
common.ErrorResp(c, err, 400)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
req.Validate()
|
||||||
log.Debugf("%+v", req)
|
log.Debugf("%+v", req)
|
||||||
users, total, err := db.GetUsers(req.PageIndex, req.PageSize)
|
users, total, err := db.GetUsers(req.PageIndex, req.PageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue