forked from YouROK/TorrServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.go
50 lines (34 loc) · 1.16 KB
/
route.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
48
49
50
package api
import (
config "github.com/Terisback/TorrServer/server/settings"
"github.com/Terisback/TorrServer/server/web/auth"
"github.com/gin-gonic/gin"
)
type requestI struct {
Action string `json:"action,omitempty"`
}
func SetupRoute(route gin.IRouter) {
authorized := route.Group("/", auth.CheckAuth())
authorized.GET("/shutdown", shutdown)
authorized.POST("/settings", settings)
authorized.POST("/torrents", torrents)
authorized.POST("/torrent/upload", torrentUpload)
authorized.POST("/cache", cache)
route.HEAD("/stream", stream)
route.HEAD("/stream/*fname", stream)
route.GET("/stream", stream)
route.GET("/stream/*fname", stream)
route.HEAD("/play/:hash/:id", play)
route.GET("/play/:hash/:id", play)
authorized.POST("/viewed", viewed)
authorized.GET("/playlistall/all.m3u", allPlayList)
route.GET("/playlist", playList)
route.GET("/playlist/*fname", playList) // Is this endpoint still needed ? `fname` is never used in handler
authorized.GET("/download/:size", download)
if config.SearchWA {
route.GET("/search/*query", rutorSearch)
} else {
authorized.GET("/search/*query", rutorSearch)
}
authorized.GET("/ffp/:hash/:id", ffp)
}