refactor: fix import cycles
This commit is contained in:
parent
72219eb59c
commit
1f7c05434a
|
@ -20,10 +20,3 @@ func registerProtocolSubdomain(portal interfaces.Portal, mux *httprouter.Router,
|
|||
|
||||
(*router)[name+"."+domain] = mux
|
||||
}
|
||||
func ApplyMiddlewares(handler jape.Handler, middlewares ...MiddlewareFunc) jape.Handler {
|
||||
// Apply each middleware in reverse order
|
||||
for i := len(middlewares) - 1; i >= 0; i-- {
|
||||
handler = middlewares[i](handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package middleware
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.lumeweb.com/LumeWeb/portal/api"
|
||||
"git.lumeweb.com/LumeWeb/portal/interfaces"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"go.sia.tech/jape"
|
||||
|
@ -125,7 +124,7 @@ func BuildS5TusApi(portal interfaces.Portal) jape.Handler {
|
|||
})
|
||||
|
||||
// Apply the middlewares to the tusJapeHandler
|
||||
tusHandler := api.ApplyMiddlewares(tusJapeHandler, adaptedTusMiddleware, authMiddlewareFunc, protocolMiddleware)
|
||||
tusHandler := ApplyMiddlewares(tusJapeHandler, adaptedTusMiddleware, authMiddlewareFunc, protocolMiddleware)
|
||||
|
||||
return tusHandler
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"git.lumeweb.com/LumeWeb/portal/api"
|
||||
"go.sia.tech/jape"
|
||||
)
|
||||
|
||||
func ApplyMiddlewares(handler jape.Handler, middlewares ...api.MiddlewareFunc) jape.Handler {
|
||||
// Apply each middleware in reverse order
|
||||
for i := len(middlewares) - 1; i >= 0; i-- {
|
||||
handler = middlewares[i](handler)
|
||||
}
|
||||
return handler
|
||||
}
|
Loading…
Reference in New Issue