feat(16.2-07): purge the host site cache on every admin post and category write

- posts: FormAfterCreate/Update purge after the content_html translations,
  new FormAfterDelete; categories: FormAfterCreate and FormAfterDelete
- NewSiteCachePurger refuses half configuration, non-http(s) URLs, user
  info, fragments, http to a non-loopback host and tokens under 32 chars;
  Boot logs the endpoint host and path once
- TestPostsAdminPurgesSiteCache smoke test
- README: Configuration section (keys, contract, timing, scope), API rows
This commit is contained in:
2026-10-10 18:27:12 +02:00
parent f3b223f131
commit 2a3afb5107
8 changed files with 192 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ import (
"embed"
"fmt"
"io/fs"
"log/slog"
"net/http"
"strconv"
"time"
@@ -74,7 +75,11 @@ func (p *Plugin) wireSiteCache(app *backpack.App) error {
if purger == nil {
return nil
}
return app.Publish(purger)
if err := app.Publish(purger); err != nil {
return err
}
slog.Default().Info("journal: site cache purge enabled", "endpoint", purger.Endpoint())
return nil
}
func (p *Plugin) LangFS() fs.FS { return langFS }