feat(frontend): optimize frontend interaction (#8)

Support auto refresh. Change authentication method. Streamline the frontend code.
This commit is contained in:
Li4n0
2021-04-25 22:15:56 +08:00
committed by GitHub
parent 50a6749070
commit 7e99d93e43
21 changed files with 347 additions and 232 deletions
+7 -1
View File
@@ -2,17 +2,23 @@ package server
import (
"io"
"net/http"
"github.com/gin-gonic/gin"
"github.com/li4n0/revsuit/internal/record"
log "unknwon.dev/clog/v2"
)
func ping(c *gin.Context) {
func auth(c *gin.Context) {
c.SetSameSite(http.SameSiteLaxMode)
c.SetCookie("token", c.Request.Header["Token"][0], 0, "/revsuit/api/", c.Request.Host, true, true)
c.String(200, "pong")
}
func ping(c *gin.Context) {
c.String(200, "pong")
}
func events(c *gin.Context) {
log.Info("Receive connection from %v", c.Request.RemoteAddr)
c.Stream(func(w io.Writer) bool {
+1
View File
@@ -38,6 +38,7 @@ func (revsuit *Revsuit) registerPlatformRouter() {
revsuit.http.ApiGroup = api
//platform routers
api.GET("/auth", auth)
api.GET("/events", events)
api.GET("/ping", ping)
}