mirror of https://github.com/Xhofe/alist
feat(index): add `disable index` option for storages (#7730)
parent
040dc14ee6
commit
ed149be84b
|
@ -1,6 +1,8 @@
|
|||
package model
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Storage struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"` // unique key
|
||||
|
@ -13,6 +15,7 @@ type Storage struct {
|
|||
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
|
||||
|
|
|
@ -133,6 +133,12 @@ func getMainItems(config driver.Config) []driver.Item {
|
|||
Type: conf.TypeSelect,
|
||||
Options: "front,back",
|
||||
})
|
||||
items = append(items, driver.Item{
|
||||
Name: "disable_index",
|
||||
Type: conf.TypeBool,
|
||||
Default: "false",
|
||||
Required: true,
|
||||
})
|
||||
items = append(items, driver.Item{
|
||||
Name: "enable_sign",
|
||||
Type: conf.TypeBool,
|
||||
|
|
|
@ -157,6 +157,11 @@ func BuildIndex(ctx context.Context, indexPaths, ignorePaths []string, maxDepth
|
|||
return filepath.SkipDir
|
||||
}
|
||||
}
|
||||
if storage, _, err := op.GetStorageAndActualPath(indexPath); err == nil {
|
||||
if storage.GetStorage().DisableIndex {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
}
|
||||
// ignore root
|
||||
if indexPath == "/" {
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue