Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"videoweb/app/service/configser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var dialogTemplates = map[string]string{
|
||||
"download": "downloadAppDialog",
|
||||
"login": "loginDialog",
|
||||
"register": "registerDialog",
|
||||
"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)
|
||||
}
|
||||
Reference in New Issue
Block a user