Files
web_huangguo_web/app/api/web/dialog.go
T
2026-09-23 16:50:34 +07:00

33 lines
714 B
Go

package web
import (
"net/http"
"videoweb/app/service/configser"
"github.com/gin-gonic/gin"
)
var dialogTemplates = map[string]string{
"download": "downloadAppDialog",
"search": "searchDialog",
}
// DialogFragment renders only the requested dialog body. Styles and behavior
// are loaded by dialogLoader.js after the first user interaction.
func DialogFragment(c *gin.Context) {
name := c.Param("name")
templateName, ok := dialogTemplates[name]
if !ok {
c.Status(http.StatusNotFound)
return
}
data := gin.H{}
if name == "download" {
data["appConfig"] = configser.FetchAppConfigVMOrEmpty(c)
}
c.Header("Cache-Control", "private, max-age=300")
c.HTML(http.StatusOK, templateName, data)
}