Skip to content

Commit

Permalink
feat: add tencent 404 project page
Browse files Browse the repository at this point in the history
Signed-off-by: daz-3ux <[email protected]>
  • Loading branch information
Daz-3ux committed Sep 12, 2023
1 parent 21e4762 commit 179ba7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions configs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>

<!--
Copyright 2023 daz-3ux(杨鹏达) <[email protected]>. All rights reserved.
Use of this source code is governed by a MIT style
license that can be found in the LICENSE file. The original repo for
this file is https://github.com/Daz-3ux/dBlog.
-->

<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Tencent 404 Project</title>
</head>
<body>
<script type="text/javascript" src="https://volunteer.cdn-go.cn/404/latest/404.js" charset="UTF-8"></script>
</body>
</html>
4 changes: 3 additions & 1 deletion internal/dazBlog/dazBlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ func run() error {
g := gin.New()

// register 404 handler
g.LoadHTMLGlob("configs/*.html")
g.NoRoute(func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"code": 10003, "message": "404 Not Found"})
//c.JSON(http.StatusOK, gin.H{"code": 10003, "message": "404 Not Found"})
c.HTML(http.StatusNotFound, "404.html", gin.H{})
})

// register /healthz handler
Expand Down

0 comments on commit 179ba7d

Please sign in to comment.