feat(server): add owner-tools injection and inline code theme CSS
- Add owner-tools serving and injection for blog owners - Inline code theme CSS in templates for soft reload support - Update import paths from github.com/writekitapp to writekit - Add optional session middleware for owner detection - Update platform index with improved UI Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
771ff7615a
commit
119e3b7a6d
11 changed files with 838 additions and 483 deletions
|
|
@ -11,26 +11,27 @@ import (
|
|||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/writekitapp/writekit/internal/auth"
|
||||
"github.com/writekitapp/writekit/internal/cloudflare"
|
||||
"github.com/writekitapp/writekit/internal/db"
|
||||
"github.com/writekitapp/writekit/internal/imaginary"
|
||||
"github.com/writekitapp/writekit/internal/storage"
|
||||
"github.com/writekitapp/writekit/internal/tenant"
|
||||
"writekit/internal/auth"
|
||||
"writekit/internal/cloudflare"
|
||||
"writekit/internal/db"
|
||||
"writekit/internal/imaginary"
|
||||
"writekit/internal/storage"
|
||||
"writekit/internal/tenant"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
router chi.Router
|
||||
database *db.DB
|
||||
tenantPool *tenant.Pool
|
||||
tenantCache *tenant.Cache
|
||||
storage storage.Client
|
||||
imaginary *imaginary.Client
|
||||
cloudflare *cloudflare.Client
|
||||
rateLimiter *RateLimiter
|
||||
domain string
|
||||
jarvisURL string
|
||||
stopCleanup chan struct{}
|
||||
router chi.Router
|
||||
database *db.DB
|
||||
tenantPool *tenant.Pool
|
||||
tenantCache *tenant.Cache
|
||||
storage storage.Client
|
||||
imaginary *imaginary.Client
|
||||
cloudflare *cloudflare.Client
|
||||
rateLimiter *RateLimiter
|
||||
domain string
|
||||
jarvisURL string
|
||||
ownerToolsURL string
|
||||
stopCleanup chan struct{}
|
||||
}
|
||||
|
||||
func New(database *db.DB, pool *tenant.Pool, cache *tenant.Cache, storageClient storage.Client) *Server {
|
||||
|
|
@ -44,6 +45,8 @@ func New(database *db.DB, pool *tenant.Pool, cache *tenant.Cache, storageClient
|
|||
jarvisURL = "http://localhost:8090"
|
||||
}
|
||||
|
||||
ownerToolsURL := os.Getenv("OWNER_TOOLS_URL")
|
||||
|
||||
var imgClient *imaginary.Client
|
||||
if url := os.Getenv("IMAGINARY_URL"); url != "" {
|
||||
imgClient = imaginary.New(url)
|
||||
|
|
@ -52,17 +55,18 @@ func New(database *db.DB, pool *tenant.Pool, cache *tenant.Cache, storageClient
|
|||
cfClient := cloudflare.NewClient()
|
||||
|
||||
s := &Server{
|
||||
router: chi.NewRouter(),
|
||||
database: database,
|
||||
tenantPool: pool,
|
||||
tenantCache: cache,
|
||||
storage: storageClient,
|
||||
imaginary: imgClient,
|
||||
cloudflare: cfClient,
|
||||
rateLimiter: NewRateLimiter(),
|
||||
domain: domain,
|
||||
jarvisURL: jarvisURL,
|
||||
stopCleanup: make(chan struct{}),
|
||||
router: chi.NewRouter(),
|
||||
database: database,
|
||||
tenantPool: pool,
|
||||
tenantCache: cache,
|
||||
storage: storageClient,
|
||||
imaginary: imgClient,
|
||||
cloudflare: cfClient,
|
||||
rateLimiter: NewRateLimiter(),
|
||||
domain: domain,
|
||||
jarvisURL: jarvisURL,
|
||||
ownerToolsURL: ownerToolsURL,
|
||||
stopCleanup: make(chan struct{}),
|
||||
}
|
||||
|
||||
s.router.Use(middleware.Logger)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue