Add conflict resolution diff UI and app branding
This commit is contained in:
@@ -12,10 +12,11 @@ import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
|
||||
"github.com/tim/md-hub-secure/apps/server/internal/config"
|
||||
"github.com/tim/md-hub-secure/apps/server/internal/docs"
|
||||
"github.com/tim/md-hub-secure/apps/server/internal/realtime"
|
||||
"github.com/tim/md-hub-secure/apps/server/internal/store"
|
||||
"github.com/tim/cairnquire/apps/server/internal/config"
|
||||
"github.com/tim/cairnquire/apps/server/internal/docs"
|
||||
"github.com/tim/cairnquire/apps/server/internal/realtime"
|
||||
"github.com/tim/cairnquire/apps/server/internal/store"
|
||||
"github.com/tim/cairnquire/apps/server/internal/sync"
|
||||
)
|
||||
|
||||
//go:embed templates/*.gohtml static/*
|
||||
@@ -28,6 +29,8 @@ type Dependencies struct {
|
||||
Repository *docs.Repository
|
||||
ContentStore *store.ContentStore
|
||||
Hub *realtime.Hub
|
||||
SyncService *sync.Service
|
||||
SyncRepo *sync.Repository
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
@@ -37,6 +40,8 @@ type Server struct {
|
||||
repository *docs.Repository
|
||||
contentStore *store.ContentStore
|
||||
hub *realtime.Hub
|
||||
syncService *sync.Service
|
||||
syncRepo *sync.Repository
|
||||
templates *template.Template
|
||||
webEnabled bool
|
||||
}
|
||||
@@ -61,6 +66,8 @@ func New(deps Dependencies) (http.Handler, error) {
|
||||
repository: deps.Repository,
|
||||
contentStore: deps.ContentStore,
|
||||
hub: deps.Hub,
|
||||
syncService: deps.SyncService,
|
||||
syncRepo: deps.SyncRepo,
|
||||
templates: templates,
|
||||
}
|
||||
|
||||
@@ -75,9 +82,11 @@ func New(deps Dependencies) (http.Handler, error) {
|
||||
router.Use(server.timeoutExceptWebSocket(30 * time.Second))
|
||||
router.Use(server.requestLogger)
|
||||
router.Use(server.securityHeaders)
|
||||
router.Use(server.apiKeyMiddleware)
|
||||
|
||||
router.Get("/", server.handleIndex)
|
||||
router.Get("/health", server.handleHealth)
|
||||
router.Get("/sw.js", server.handleServiceWorker)
|
||||
router.Get("/ws", server.handleWebSocket)
|
||||
router.Post("/api/admin/login", server.handleAdminLogin)
|
||||
router.Get("/api/admin/users", server.handleAdminUsers)
|
||||
@@ -87,9 +96,17 @@ func New(deps Dependencies) (http.Handler, error) {
|
||||
router.Get("/docs", server.handleDocsIndex)
|
||||
router.Get("/docs/*", server.handleDocument)
|
||||
router.Get("/api/documents", server.handleDocuments)
|
||||
router.Post("/api/documents/*", server.handleDocumentSave)
|
||||
router.Get("/api/search", server.handleSearch)
|
||||
router.Post("/api/uploads", server.handleUpload)
|
||||
router.Get("/attachments/{hash}", server.handleAttachment)
|
||||
|
||||
// Sync protocol endpoints
|
||||
router.Post("/api/sync/init", server.handleSyncInit)
|
||||
router.Post("/api/sync/delta", server.handleSyncDelta)
|
||||
router.Post("/api/sync/resolve", server.handleSyncResolve)
|
||||
router.Get("/api/content/{hash}", server.handleContentFetch)
|
||||
|
||||
router.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(mustSub("static"))))
|
||||
|
||||
if server.webEnabled {
|
||||
|
||||
Reference in New Issue
Block a user