新增 event , 优化 websocket

This commit is contained in:
ExplodingDragon
2025-11-20 01:19:47 +08:00
parent 043b00bbb7
commit d6440ebb02
16 changed files with 646 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ import (
"gopkg.d7z.net/gitea-pages/pkg"
"gopkg.d7z.net/middleware/cache"
"gopkg.d7z.net/middleware/kv"
"gopkg.d7z.net/middleware/subscribe"
)
type TestServer struct {
@@ -52,9 +53,11 @@ func NewTestServer(domain string) *TestServer {
domain,
"gh-pages",
memoryKV,
subscribe.NewMemorySubscriber(),
memoryKV.Child("cache"),
0,
memoryCache,
0,
func(w http.ResponseWriter, r *http.Request, err error) {
if errors.Is(err, os.ErrNotExist) {
http.Error(w, "page not found.", http.StatusNotFound)