mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
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.
24 lines
443 B
Go
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)
|
|
}
|