按成员版本与设备名单限制群组密文投递

This commit is contained in:
xhgit committed 2026-11-14 08:35:39 +08:00
1 parent 43216c205c
commit 636419e948
12 files changed
+592 -7

No files matched your search

+5 -1
View File
@@ -66,6 +66,7 @@ func run() error {
cancel()
accounts := account.New(db, cfg.SessionTTL)
envelopes := delivery.New(db)
groupStore := groups.New(db)
go func() {
ticker := time.NewTicker(15 * time.Minute)
defer ticker.Stop()
@@ -81,12 +82,15 @@ func run() error {
if err := envelopes.Cleanup(cleanup, cfg.EnvelopeRetention); err != nil {
slog.Warn("delivery cleanup failed")
}
if err := groupStore.Cleanup(cleanup, cfg.EnvelopeRetention); err != nil {
slog.Warn("group cleanup failed")
}
cancel()
}
}
}()
server := &http.Server{
Addr: cfg.Addr, Handler: httpapi.New(accounts, contacts.New(db), envelopes, groups.New(db), cache, cfg.Origins, ready),
Addr: cfg.Addr, Handler: httpapi.New(accounts, contacts.New(db), envelopes, groupStore, cache, cfg.Origins, ready),
ReadHeaderTimeout: 5 * time.Second, ReadTimeout: 10 * time.Second,
WriteTimeout: 15 * time.Second, IdleTimeout: 60 * time.Second, MaxHeaderBytes: 16 << 10,
BaseContext: func(net.Listener) context.Context { return ctx },