Improve performance on poor connections: local assets, gzip, caching

- Replace Tailwind CDN (~350KB) with purged local CSS (~22KB)
- Replace htmx unpkg CDN with local static file
- Add Gzip middleware (standard library, sync.Pool) for all responses
- Add Cache-Control: public, max-age=3600 for /static/* assets
- Reduce status polling interval from 5s to 30s
- Add scripts/build-css.sh for CSS regeneration after template changes
- Document in bible-local/operations.md and history.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-14 14:51:21 +03:00
parent c53c484bde
commit df5be91353
14 changed files with 1220 additions and 4 deletions

View File

@@ -457,9 +457,11 @@ func setupRouter(cfg *config.Config, configPath string, connMgr *db.ConnectionMa
router := gin.New()
router.MaxMultipartMemory = 26 << 20 // 26MB; stock import handler enforces 25MB payload limit
router.Use(gin.Recovery())
router.Use(middleware.Gzip())
router.Use(requestLogger())
router.Use(middleware.OriginProtection())
router.Use(middleware.CORS())
router.Use(middleware.StaticCache())
router.Use(middleware.OfflineDetector(connMgr))
staticPath := filepath.Join("web", "static")