Files
multica/server/internal/handler/config.go
Naiyuan Qing 53cb01cc91 refactor(editor): remove hardcoded CDN domain, unify file card rendering
- Add GET /api/config endpoint exposing cdn_domain from CLOUDFRONT_DOMAIN
- Create packages/core/config/ zustand store, fetched at app startup
- Extract file card preprocessing to packages/ui/markdown/file-cards.ts
  with isCdnUrl(url, cdnDomain) using exact hostname match
- Add file card support to packages/ui/markdown/Markdown.tsx (was missing)
- Remove hardcoded .copilothub.ai hostname check from file-card.tsx
- Fix LocalStorage.CdnDomain() to return hostname not full URL
- Always run preprocessFileCards regardless of cdnDomain availability
  (!file syntax works without CDN domain, only legacy matching needs it)
- Use useConfigStore hook in common/markdown.tsx for reactive updates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 10:43:36 +08:00

16 lines
302 B
Go

package handler
import "net/http"
type AppConfig struct {
CdnDomain string `json:"cdn_domain"`
}
func (h *Handler) GetConfig(w http.ResponseWriter, r *http.Request) {
config := AppConfig{}
if h.Storage != nil {
config.CdnDomain = h.Storage.CdnDomain()
}
writeJSON(w, http.StatusOK, config)
}