From 2c675ae9091ac247874c967322ff7281c638208b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=87=89?= <927625802@qq.com> Date: Fri, 12 Nov 2021 19:39:01 +0800 Subject: [PATCH] :sparkles: change settings --- bootstrap/model.go | 24 ++++++++++++++++++------ drivers/alidrive.go | 14 ++++++++++++++ model/setting.go | 3 ++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/bootstrap/model.go b/bootstrap/model.go index defe5249..f8f08aaa 100644 --- a/bootstrap/model.go +++ b/bootstrap/model.go @@ -119,63 +119,75 @@ func initSettings() { Key: "title", Value: "Alist", Description: "title", + Type: "string", Group: model.PUBLIC, }, { Key: "password", Value: "alist", Description: "password", + Type: "string", Group: model.PRIVATE, }, { Key: "logo", Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", Description: "logo", + Type: "string", Group: model.PUBLIC, }, { Key: "favicon", Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", Description: "favicon", + Type: "string", Group: model.PUBLIC, }, { Key: "icon color", Value: "teal.300", Description: "icon's color", + Type: "string", Group: model.PUBLIC, }, { Key: "text types", Value: "txt,htm,html,xml,java,properties,sql,js,md,json,conf,ini,vue,php,py,bat,gitignore,yml,go,sh,c,cpp,h,hpp", + Type: "string", Description: "text type extensions", }, { - Key: "readme file", - Value: "hide", - Description: "hide readme file? (show/hide)", + Key: "hide readme file", + Value: "true", + Type: "bool", + Description: "hide readme file? ", }, { Key: "music cover", Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", Description: "music cover image", + Type: "string", Group: model.PUBLIC, }, { Key: "site beian", Description: "chinese beian info", + Type: "string", Group: model.PUBLIC, }, { Key: "home readme url", Description: "when have multiple, the readme file to show", + Type: "string", Group: model.PUBLIC, }, { - Key: "markdown theme", - Value: "vuepress", + Key: "markdown theme", + Value: "vuepress", Description: "default | github | vuepress", - Group: model.PUBLIC, + Group: model.PUBLIC, + Type: "select", + Values: "default,github,vuepress", }, } for _, v := range settings { diff --git a/drivers/alidrive.go b/drivers/alidrive.go index b4bbf419..b92484f0 100644 --- a/drivers/alidrive.go +++ b/drivers/alidrive.go @@ -67,6 +67,20 @@ func (a AliDrive) Preview(path string, account *model.Account) (interface{}, err func (a AliDrive) Items() []Item { return []Item{ + { + Name: "order_by", + Label: "order_by", + Type: "select", + Values: "name,size,updated_at,created_at", + Required: false, + }, + { + Name: "order_direction", + Label: "order_direction", + Type: "select", + Values: "ASC,DESC", + Required: false, + }, { Name: "refresh_token", Label: "refresh token", diff --git a/model/setting.go b/model/setting.go index c3e62c96..08a1c6b6 100644 --- a/model/setting.go +++ b/model/setting.go @@ -14,8 +14,9 @@ type SettingItem struct { Key string `json:"key" gorm:"primaryKey" validate:"required"` Value string `json:"value"` Description string `json:"description"` - //Type string `json:"type"` + Type string `json:"type"` Group int `json:"group"` + Values string `json:"values"` } func SaveSettings(items []SettingItem) error {