Files
skillshare/internal/server/handler_hub.go
T
Willie f6087ac8ba refactor: use plain bool for BuildIndex auditSkills parameter
Variadic ...bool was used for backward compatibility but is non-idiomatic
Go for an internal API. Plain bool makes the function contract explicit
and simplifies the audit check from len(auditSkills) > 0 && auditSkills[0]
to a direct boolean test.
2026-02-22 08:08:35 +08:00

24 lines
450 B
Go

package server
import (
"net/http"
"path/filepath"
"skillshare/internal/hub"
)
func (s *Server) handleHubIndex(w http.ResponseWriter, r *http.Request) {
sourcePath := s.cfg.Source
if s.IsProjectMode() {
sourcePath = filepath.Join(s.projectRoot, ".skillshare", "skills")
}
idx, err := hub.BuildIndex(sourcePath, false, false)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, idx)
}