feature (turboload): decrease load time via sw

This commit is contained in:
MickaelK
2025-01-27 13:35:11 +11:00
parent fddc98b462
commit c3f2c57e5f
8 changed files with 531 additions and 317 deletions

View File

@ -1,9 +1,10 @@
package middleware
import (
. "github.com/mickael-kerjean/filestash/server/common"
"net/http"
"time"
. "github.com/mickael-kerjean/filestash/server/common"
)
func init() {
@ -58,6 +59,10 @@ func (w *ResponseWriter) Write(b []byte) (int, error) {
return w.ResponseWriter.Write(b)
}
func (w *ResponseWriter) Flush() {
w.ResponseWriter.(http.Flusher).Flush()
}
func PluginInjector(fn HandlerFunc) HandlerFunc {
for _, middleware := range Hooks.Get.Middleware() {
fn = middleware(fn)