mirror of https://github.com/Xhofe/alist
fix: is the root folder required (close #1633)
parent
fba1471ec4
commit
969018db37
|
@ -6,10 +6,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Addition struct {
|
type Addition struct {
|
||||||
Username string `json:"username" required:"true"`
|
Username string `json:"username" required:"true"`
|
||||||
Password string `json:"password" required:"true"`
|
Password string `json:"password" required:"true"`
|
||||||
VCode string `json:"validate_code"`
|
VCode string `json:"validate_code"`
|
||||||
RootFolderID string `json:"root_folder_id"`
|
driver.RootID
|
||||||
OrderBy string `json:"order_by" type:"select" options:"filename,filesize,lastOpTime" default:"filename"`
|
OrderBy string `json:"order_by" type:"select" options:"filename,filesize,lastOpTime" default:"filename"`
|
||||||
OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
||||||
Type string `json:"type" type:"select" options:"personal,family" default:"personal"`
|
Type string `json:"type" type:"select" options:"personal,family" default:"personal"`
|
||||||
|
@ -17,10 +17,6 @@ type Addition struct {
|
||||||
RapidUpload bool `json:"rapid_upload"`
|
RapidUpload bool `json:"rapid_upload"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a Addition) GetRootId() string {
|
|
||||||
return a.RootFolderID
|
|
||||||
}
|
|
||||||
|
|
||||||
var config = driver.Config{
|
var config = driver.Config{
|
||||||
Name: "189CloudPC",
|
Name: "189CloudPC",
|
||||||
DefaultRoot: "-11",
|
DefaultRoot: "-11",
|
||||||
|
|
|
@ -28,11 +28,11 @@ type IRootId interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RootPath struct {
|
type RootPath struct {
|
||||||
RootFolderPath string `json:"root_folder_path" required:"true"`
|
RootFolderPath string `json:"root_folder_path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RootID struct {
|
type RootID struct {
|
||||||
RootFolderID string `json:"root_folder_id" required:"true"`
|
RootFolderID string `json:"root_folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r RootPath) GetRootPath() string {
|
func (r RootPath) GetRootPath() string {
|
||||||
|
|
|
@ -145,8 +145,11 @@ func getAdditionalItems(t reflect.Type, defaultRoot string) []driver.Item {
|
||||||
if tag.Get("type") != "" {
|
if tag.Get("type") != "" {
|
||||||
item.Type = tag.Get("type")
|
item.Type = tag.Get("type")
|
||||||
}
|
}
|
||||||
if (item.Name == "root_folder_id" || item.Name == "root_folder_path") && item.Default == "" {
|
if item.Name == "root_folder_id" || item.Name == "root_folder_path" {
|
||||||
item.Default = defaultRoot
|
if item.Default == "" {
|
||||||
|
item.Default = defaultRoot
|
||||||
|
}
|
||||||
|
item.Required = item.Default != ""
|
||||||
}
|
}
|
||||||
// set default type to string
|
// set default type to string
|
||||||
if item.Type == "" {
|
if item.Type == "" {
|
||||||
|
|
Loading…
Reference in New Issue