package api import ( "github.com/gin-gonic/gin" "veza-backend-api/internal/handlers" ) // setupEmbedRoutes registers the public embed widget + oEmbed // endpoints. Both live on the root router (no /api/v1 prefix) so // the URLs match what blogs / Twitter / Discord scrapers expect : // // GET /embed/track/:id — standalone HTML widget // GET /oembed?url=&format=json — oEmbed JSON envelope // // v1.0.9 W3 Day 15. func (r *APIRouter) setupEmbedRoutes(router *gin.Engine) { frontend := r.config.FrontendURL if frontend == "" { frontend = "https://veza.fr" } apiBase := frontend // best default — assume frontend reverse-proxies API if r.config.StreamServerURL != "" { // Not actually the API base, but if we ever introduce an // explicit API_BASE_URL config it should land here. For now // the embed page uses relative-looking URLs which the // browser resolves against the embed page's own origin. _ = r.config.StreamServerURL } embedHandler := handlers.NewEmbedHandler(r.db.GormDB, frontend, apiBase, r.logger) router.GET("/embed/track/:id", embedHandler.EmbedTrack) router.GET("/oembed", embedHandler.OEmbed) }