Files
skillshare/internal/server/handler_hub.go
T
Willie d2854ed621 feat(ui): add private index search with multi-index management
Add /api/hub/index endpoint and index_url support to /api/search.
SearchPage now has GitHub/Private Index mode tabs with localStorage
persistence. Built-in "Current Skills" index plus user-managed
custom indexes with URL dedup and add/delete flow.
2026-02-13 14:21:37 +08:00

24 lines
443 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)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
writeJSON(w, idx)
}