admin: Fix video route
This commit is contained in:
parent
b92381f007
commit
4a190f51c5
8 changed files with 28 additions and 7 deletions
|
@ -98,14 +98,14 @@ func declareStaticRoutes(router *gin.RouterGroup, cfg *settings.Settings, baseUR
|
|||
})
|
||||
|
||||
router.GET("/files/*_", func(c *gin.Context) {
|
||||
http.ServeFile(c.Writer, c.Request, path.Join(fic.FilesDir, strings.TrimPrefix(c.Request.URL.Path, "/files")))
|
||||
http.ServeFile(c.Writer, c.Request, path.Join(fic.FilesDir, strings.TrimPrefix(c.Request.URL.Path, path.Join(baseURL, "files"))))
|
||||
})
|
||||
router.GET("/submissions/*_", func(c *gin.Context) {
|
||||
http.ServeFile(c.Writer, c.Request, path.Join(api.TimestampCheck, strings.TrimPrefix(c.Request.URL.Path, "/submissions")))
|
||||
http.ServeFile(c.Writer, c.Request, path.Join(api.TimestampCheck, strings.TrimPrefix(c.Request.URL.Path, path.Join(baseURL, "submissions"))))
|
||||
})
|
||||
router.GET("/vids/*_", func(c *gin.Context) {
|
||||
if importer, ok := sync.GlobalImporter.(sync.LocalImporter); ok {
|
||||
http.ServeFile(c.Writer, c.Request, path.Join(importer.Base, strings.TrimPrefix(c.Request.URL.Path, "/vids")))
|
||||
if importer, ok := sync.GlobalImporter.(sync.DirectAccessImporter); ok {
|
||||
http.ServeFile(c.Writer, c.Request, importer.GetLocalPath(strings.TrimPrefix(c.Request.URL.Path, path.Join(baseURL, "vids"))))
|
||||
} else {
|
||||
c.AbortWithError(http.StatusBadRequest, errors.New("Only available with local importer."))
|
||||
}
|
||||
|
|
Reference in a new issue