Feat: use history router mode

This commit is contained in:
HFO4
2020-12-08 17:36:19 +08:00
parent 5b44606276
commit 5d406f1c6a
6 changed files with 74 additions and 9 deletions

View File

@@ -91,7 +91,7 @@ func OneDriveOAuth(c *gin.Context) {
queries.Add("msg", res.Msg)
queries.Add("err", res.Error)
redirect.RawQuery = queries.Encode()
c.Redirect(301, "/#"+redirect.String())
c.Redirect(301, "/"+redirect.String())
} else {
c.JSON(200, ErrorResponse(err))
}

View File

@@ -1,7 +1,6 @@
package routers
import (
"github.com/cloudreve/Cloudreve/v3/bootstrap"
"github.com/cloudreve/Cloudreve/v3/middleware"
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
"github.com/cloudreve/Cloudreve/v3/pkg/hashid"
@@ -9,7 +8,6 @@ import (
"github.com/cloudreve/Cloudreve/v3/routers/controllers"
"github.com/gin-contrib/cors"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
)
@@ -82,8 +80,7 @@ func InitMasterRouter() *gin.Engine {
静态资源
*/
r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{"/api/"})))
r.Use(middleware.InjectSiteInfo())
r.Use(static.Serve("/", bootstrap.StaticFS))
r.Use(middleware.FrontendFileHandler())
r.GET("manifest.json", controllers.Manifest)
v3 := r.Group("/api/v3")