Feat: set default view method in file manager

pull/247/head
HFO4 5 years ago
parent e2f6dab70c
commit a0c320b964

@ -164,6 +164,8 @@ Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; verti
{Name: "temp_path", Value: "temp", Type: "path"},
{Name: "score_enabled", Value: "1", Type: "score"},
{Name: "share_score_rate", Value: "80", Type: "score"},
{Name: "home_view_method", Value: "icon", Type: "view"},
{Name: "share_view_method", Value: "list", Type: "view"},
}
for _, value := range defaultSettings {

@ -14,6 +14,8 @@ type SiteConfig struct {
DefaultTheme string `json:"defaultTheme"`
ScoreEnabled bool `json:"score_enabled"`
ShareScoreRate string `json:"share_score_rate"`
HomepageViewMethod string `json:"home_view_method"`
ShareViewMethod string `json:"share_view_method"`
User User `json:"user"`
}
@ -42,6 +44,8 @@ func BuildSiteConfig(settings map[string]string, user *model.User) Response {
DefaultTheme: checkSettingValue(settings, "defaultTheme"),
ScoreEnabled: model.IsTrueVal(checkSettingValue(settings, "score_enabled")),
ShareScoreRate: checkSettingValue(settings, "share_score_rate"),
HomepageViewMethod: checkSettingValue(settings, "home_view_method"),
ShareViewMethod: checkSettingValue(settings, "share_view_method"),
User: userRes,
}}
}

@ -61,7 +61,11 @@ func BuildShareResponse(share *model.Share, unlocked bool) Share {
}
if share.IsDir {
source := share.GetSourceFolder()
resp.Source = &shareSource{
Name: source.Name,
Size: 0,
}
} else {
source := share.GetSourceFile()
resp.Source = &shareSource{

@ -23,6 +23,8 @@ func SiteConfig(c *gin.Context) {
"defaultTheme",
"score_enabled",
"share_score_rate",
"home_view_method",
"share_view_method",
})
// 如果已登录,则同时返回用户信息

Loading…
Cancel
Save