2023-03-17 01:16:51 +00:00
|
|
|
package routewde
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2023-04-29 13:58:39 +00:00
|
|
|
"personalwebsite/wde"
|
2023-03-17 01:16:51 +00:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2023-04-29 13:58:39 +00:00
|
|
|
func Route(route *gin.RouterGroup, wde *wde.WDE) {
|
2023-03-17 01:16:51 +00:00
|
|
|
route.GET("/getbasicwindow", func(ctx *gin.Context) {
|
|
|
|
ctx.HTML(http.StatusOK, "basic-window.html", nil)
|
|
|
|
})
|
2023-03-22 21:53:06 +00:00
|
|
|
|
2023-04-13 01:09:07 +00:00
|
|
|
route.GET("/renderMobileDesktop", func(ctx *gin.Context) {
|
|
|
|
ctx.HTML(http.StatusOK, "base/mobile-desktop.tmpl", nil)
|
|
|
|
})
|
|
|
|
|
2023-03-22 21:53:06 +00:00
|
|
|
widgets := route.Group("widgets")
|
|
|
|
{
|
|
|
|
widgets.GET("/file-tile-view", func(ctx *gin.Context) {
|
2023-04-29 13:58:39 +00:00
|
|
|
path := ctx.Query("path")
|
|
|
|
if path == "" {
|
|
|
|
ctx.JSON(http.StatusBadRequest, "TODO") //TODO json error struct
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ginH, err := wde.Render(path)
|
|
|
|
if err != nil {
|
|
|
|
ctx.JSON(http.StatusInternalServerError, "TODO") //TODO
|
|
|
|
return
|
|
|
|
}
|
|
|
|
ctx.HTML(http.StatusOK, "wde-widgets/file-tile-view.tmpl", ginH)
|
2023-03-22 21:53:06 +00:00
|
|
|
})
|
|
|
|
}
|
2023-03-17 01:16:51 +00:00
|
|
|
}
|