From 9489a4291ba47ed0034a4030a98bffd89b7f60ac Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Wed, 7 Dec 2022 10:05:11 +0800 Subject: [PATCH 1/2] open js --- ui/template/header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/template/header.html b/ui/template/header.html index e07e31d1..a402f3ba 100644 --- a/ui/template/header.html +++ b/ui/template/header.html @@ -10,7 +10,7 @@ - + {{if $.siteinfo.JsonLD }}{{ .siteinfo.JsonLD | templateHTML}}{{end}} From 78c0606e52373dfdcb7412998bb98e6ec8cd18d2 Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:11:14 +0800 Subject: [PATCH 2/2] fix users --- internal/controller/template_controller.go | 19 +++++++++++++++++++ internal/router/template_router.go | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go index 5747fa9c..86f8c230 100644 --- a/internal/controller/template_controller.go +++ b/internal/controller/template_controller.go @@ -276,6 +276,14 @@ func (tc *TemplateController) TagInfo(ctx *gin.Context) { // UserInfo user info func (tc *TemplateController) UserInfo(ctx *gin.Context) { + // urlPath := ctx.Request.URL.Path + // filePath := "" + // switch urlPath { + // case "/users/login": + // filePath = "build/index.html" + // case "/users/register": + // filePath = "build/index.html" + // default: username := ctx.Param("username") req := &schema.GetOtherUserInfoByUsernameReq{} req.Username = username @@ -305,6 +313,17 @@ func (tc *TemplateController) UserInfo(ctx *gin.Context) { "userinfo": userinfo, "bio": template.HTML(userinfo.Info.BioHTML), }) + // } + + // file, err := ui.Build.ReadFile(filePath) + // if err != nil { + // log.Error(err) + // ctx.Status(http.StatusNotFound) + // return + // } + // ctx.Header("content-type", "text/html;charset=utf-8") + // ctx.String(http.StatusOK, string(file)) + } func (tc *TemplateController) Page404(ctx *gin.Context) { diff --git a/internal/router/template_router.go b/internal/router/template_router.go index af108081..fbc48cdd 100644 --- a/internal/router/template_router.go +++ b/internal/router/template_router.go @@ -41,6 +41,6 @@ func (a *TemplateRouter) RegisterTemplateRouter(r *gin.RouterGroup) { r.GET("/tags", a.templateController.TagList) r.GET("/tags/:tag", a.templateController.TagInfo) - r.GET("/users/:username", a.templateController.UserInfo) + // r.GET("/users/:username", a.templateController.UserInfo) r.GET("/404", a.templateController.Page404) }