diff --git a/internal/api/server.go b/internal/api/server.go index 34a2a14..70036bc 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -569,15 +569,19 @@ type accessibleRoot struct { func (s *Server) roots(w http.ResponseWriter, r *http.Request) { a := account(r, s) - if a == nil || a.Username == "" { + if a == nil { writeJSONError(w, http.StatusUnauthorized, "not authenticated") return } seen := map[string]bool{} out := make([]accessibleRoot, 0) - if a.Admin && a.MaskFor("").HasRead() { + if a.MaskFor("").HasRead() { seen[""] = true - out = append(out, accessibleRoot{Path: "", Name: "全部文件", Mask: permString(a.MaskFor("")), Home: false}) + name := "共享文件" + if a.Admin { + name = "全部文件" + } + out = append(out, accessibleRoot{Path: "", Name: name, Mask: permString(a.MaskFor("")), Home: false}) } if a.Home != "" && a.MaskFor(a.Home).HasRead() { home := strings.Trim(a.Home, "/") diff --git a/internal/api/web/index.html b/internal/api/web/index.html index 1311ca1..b9824a9 100644 --- a/internal/api/web/index.html +++ b/internal/api/web/index.html @@ -46,7 +46,7 @@ button.ghost{background:var(--surface2);color:var(--text)}button.danger{backgrou