mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 07:09:46 +00:00
wip
Signed-off-by: Tiger Wang <tigerwang@outlook.com>
This commit is contained in:
parent
4eb35e1d25
commit
cab44de09b
@ -71,10 +71,10 @@ func InitV2Router() http.Handler {
|
|||||||
e.Use(echo_middleware.JWTWithConfig(echo_middleware.JWTConfig{
|
e.Use(echo_middleware.JWTWithConfig(echo_middleware.JWTConfig{
|
||||||
Skipper: func(c echo.Context) bool {
|
Skipper: func(c echo.Context) bool {
|
||||||
return c.RealIP() == "::1" || c.RealIP() == "127.0.0.1"
|
return c.RealIP() == "::1" || c.RealIP() == "127.0.0.1"
|
||||||
//return true
|
// return true
|
||||||
},
|
},
|
||||||
ParseTokenFunc: func(token string, c echo.Context) (interface{}, error) {
|
ParseTokenFunc: func(token string, c echo.Context) (interface{}, error) {
|
||||||
claims, code := jwt.Validate(token)
|
claims, code := jwt.Validate(token) // TODO - needs JWT validation
|
||||||
if code != common_err.SUCCESS {
|
if code != common_err.SUCCESS {
|
||||||
return nil, echo.ErrUnauthorized
|
return nil, echo.ErrUnauthorized
|
||||||
}
|
}
|
||||||
@ -137,6 +137,7 @@ func InitV2DocRouter(docHTML string, docYAML string) http.Handler {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitFile() http.Handler {
|
func InitFile() http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
filePath := r.URL.Query().Get("path")
|
filePath := r.URL.Query().Get("path")
|
||||||
@ -174,7 +175,7 @@ func InitDir() http.Handler {
|
|||||||
// handles only single files not folders and multiple files
|
// handles only single files not folders and multiple files
|
||||||
// if len(list) == 1 {
|
// if len(list) == 1 {
|
||||||
|
|
||||||
//filePath := list[0]
|
// filePath := list[0]
|
||||||
// info, err := os.Stat(filePath)
|
// info, err := os.Stat(filePath)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user