mirror of https://github.com/Xhofe/alist
feat: add alert for driver
parent
0d3146b51d
commit
4be8524d80
|
@ -78,10 +78,19 @@ func writeFile(name string, data interface{}) {
|
||||||
func generateDriversJson() {
|
func generateDriversJson() {
|
||||||
drivers := make(Drivers)
|
drivers := make(Drivers)
|
||||||
drivers["drivers"] = make(KV[interface{}])
|
drivers["drivers"] = make(KV[interface{}])
|
||||||
|
drivers["config"] = make(KV[interface{}])
|
||||||
driverInfoMap := op.GetDriverInfoMap()
|
driverInfoMap := op.GetDriverInfoMap()
|
||||||
for k, v := range driverInfoMap {
|
for k, v := range driverInfoMap {
|
||||||
drivers["drivers"][k] = convert(k)
|
drivers["drivers"][k] = convert(k)
|
||||||
items := make(KV[interface{}])
|
items := make(KV[interface{}])
|
||||||
|
config := map[string]string{}
|
||||||
|
if v.Config.Alert != "" {
|
||||||
|
alert := strings.SplitN(v.Config.Alert, "|", 2)
|
||||||
|
if len(alert) > 1 {
|
||||||
|
config["alert"] = alert[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drivers["config"][k] = config
|
||||||
for i := range v.Additional {
|
for i := range v.Additional {
|
||||||
item := v.Additional[i]
|
item := v.Additional[i]
|
||||||
items[item.Name] = convert(item.Name)
|
items[item.Name] = convert(item.Name)
|
||||||
|
|
|
@ -18,6 +18,7 @@ type Addition struct {
|
||||||
var config = driver.Config{
|
var config = driver.Config{
|
||||||
Name: "Aliyundrive",
|
Name: "Aliyundrive",
|
||||||
DefaultRoot: "root",
|
DefaultRoot: "root",
|
||||||
|
Alert: "warning|Deprecated, no longer maintained and will be removed in a future version",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -11,8 +11,8 @@ type Addition struct {
|
||||||
OrderBy string `json:"order_by" type:"select" options:"name,size,updated_at,created_at"`
|
OrderBy string `json:"order_by" type:"select" options:"name,size,updated_at,created_at"`
|
||||||
OrderDirection string `json:"order_direction" type:"select" options:"ASC,DESC"`
|
OrderDirection string `json:"order_direction" type:"select" options:"ASC,DESC"`
|
||||||
OauthTokenURL string `json:"oauth_token_url" default:"https://api.nn.ci/alist/ali_open/token"`
|
OauthTokenURL string `json:"oauth_token_url" default:"https://api.nn.ci/alist/ali_open/token"`
|
||||||
ClientID string `json:"client_id" required:"false"`
|
ClientID string `json:"client_id" required:"false" help:"Keep it empty if you don't have one"`
|
||||||
ClientSecret string `json:"client_secret" required:"false"`
|
ClientSecret string `json:"client_secret" required:"false" help:"Keep it empty if you don't have one"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = driver.Config{
|
var config = driver.Config{
|
||||||
|
|
|
@ -9,7 +9,8 @@ type Config struct {
|
||||||
NoUpload bool `json:"no_upload"`
|
NoUpload bool `json:"no_upload"`
|
||||||
NeedMs bool `json:"need_ms"` // if need get message from user, such as validate code
|
NeedMs bool `json:"need_ms"` // if need get message from user, such as validate code
|
||||||
DefaultRoot string `json:"default_root"`
|
DefaultRoot string `json:"default_root"`
|
||||||
CheckStatus bool
|
CheckStatus bool `json:"-"`
|
||||||
|
Alert string `json:"alert"` //info,success,warning,danger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Config) MustProxy() bool {
|
func (c Config) MustProxy() bool {
|
||||||
|
|
Loading…
Reference in New Issue