feat(index): add disable index
option for storages (#7730)
This commit is contained in:
parent
040dc14ee6
commit
ed149be84b
@ -1,6 +1,8 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type Storage struct {
|
type Storage struct {
|
||||||
ID uint `json:"id" gorm:"primaryKey"` // unique key
|
ID uint `json:"id" gorm:"primaryKey"` // unique key
|
||||||
@ -13,6 +15,7 @@ type Storage struct {
|
|||||||
Remark string `json:"remark"`
|
Remark string `json:"remark"`
|
||||||
Modified time.Time `json:"modified"`
|
Modified time.Time `json:"modified"`
|
||||||
Disabled bool `json:"disabled"` // if disabled
|
Disabled bool `json:"disabled"` // if disabled
|
||||||
|
DisableIndex bool `json:"disable_index"`
|
||||||
EnableSign bool `json:"enable_sign"`
|
EnableSign bool `json:"enable_sign"`
|
||||||
Sort
|
Sort
|
||||||
Proxy
|
Proxy
|
||||||
|
@ -133,6 +133,12 @@ func getMainItems(config driver.Config) []driver.Item {
|
|||||||
Type: conf.TypeSelect,
|
Type: conf.TypeSelect,
|
||||||
Options: "front,back",
|
Options: "front,back",
|
||||||
})
|
})
|
||||||
|
items = append(items, driver.Item{
|
||||||
|
Name: "disable_index",
|
||||||
|
Type: conf.TypeBool,
|
||||||
|
Default: "false",
|
||||||
|
Required: true,
|
||||||
|
})
|
||||||
items = append(items, driver.Item{
|
items = append(items, driver.Item{
|
||||||
Name: "enable_sign",
|
Name: "enable_sign",
|
||||||
Type: conf.TypeBool,
|
Type: conf.TypeBool,
|
||||||
|
@ -157,6 +157,11 @@ func BuildIndex(ctx context.Context, indexPaths, ignorePaths []string, maxDepth
|
|||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if storage, _, err := op.GetStorageAndActualPath(indexPath); err == nil {
|
||||||
|
if storage.GetStorage().DisableIndex {
|
||||||
|
return filepath.SkipDir
|
||||||
|
}
|
||||||
|
}
|
||||||
// ignore root
|
// ignore root
|
||||||
if indexPath == "/" {
|
if indexPath == "/" {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user