-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (41 loc) · 1.16 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"applemango/boorutan/backend/booru/feed"
"applemango/boorutan/backend/booru/moebooru"
h "applemango/boorutan/backend/handler"
"applemango/boorutan/backend/middleware"
"github.com/gin-gonic/gin"
)
func __init__() {
b := moebooru.CreateMoeBooru("https://konachan.net")
_ = b.GetTags()
_ = h.ReadTags()
}
func main() {
//__init__()
gin.SetMode(gin.ReleaseMode)
app := gin.Default()
app.Use(middleware.Cors())
app.Use(h.OptionMiddleware())
feed.RegisterBooruStreamer(app)
app.Use(middleware.BaseLimeMiddleware())
account := app.Group("/account")
{
account.Use(middleware.LoginMiddleware())
account.GET("/like", h.GetLikedPost)
account.POST("/like/:booru/:id", h.LikePost)
// u, _ := c.Get("account")
}
app.GET("/ping", h.Ping)
app.GET("/image", h.DownloadImage)
//app.GET("/like", h.GetLikedPost)
//app.POST("/like/:booru/:id", h.LikePost)
app.GET("/category", h.GetTagCategory)
app.GET("/tag/suggest", h.GetTagSuggest)
app.GET("/tag/suggest/fast", h.GetTagSuggestFast)
app.GET("/tag", h.GetTag)
app.POST("/tag/translate", h.TagTranslate)
app.GET("/post/:id", h.GetPost)
app.GET("/post", h.GetPosts)
_ = app.Run(":8080")
}