Changeset 0.11.0 (#62)
This commit is contained in:
@@ -67,6 +67,9 @@ func main() {
|
||||
|
||||
// Seed additional users from env (dev/test only, skipped in production)
|
||||
handlers.SeedUsers(cfg, stores)
|
||||
|
||||
// Seed builtin extensions from disk (idempotent, version-aware)
|
||||
handlers.SeedBuiltinExtensions(stores, "extensions/builtin")
|
||||
}
|
||||
defer database.Close()
|
||||
|
||||
@@ -126,6 +129,12 @@ func main() {
|
||||
authGroup.POST("/logout", auth.Logout)
|
||||
}
|
||||
|
||||
// ── Public extension assets ────────────────
|
||||
// Script tags can't send Authorization headers, so asset serving must be public.
|
||||
// Extension JS is the same for all users — no user-specific data.
|
||||
extH := handlers.NewExtensionHandler(stores)
|
||||
api.GET("/extensions/:id/assets/*path", extH.ServeExtensionAsset)
|
||||
|
||||
// ── Protected routes ────────────────────
|
||||
protected := api.Group("")
|
||||
protected.Use(middleware.Auth(cfg))
|
||||
@@ -139,7 +148,7 @@ func main() {
|
||||
protected.DELETE("/channels/:id", channels.DeleteChannel)
|
||||
|
||||
// Messages
|
||||
msgs := handlers.NewMessageHandler(keyResolver, stores)
|
||||
msgs := handlers.NewMessageHandler(keyResolver, stores, hub)
|
||||
protected.GET("/channels/:id/messages", msgs.ListMessages)
|
||||
protected.POST("/channels/:id/messages", msgs.CreateMessage)
|
||||
|
||||
@@ -151,7 +160,7 @@ func main() {
|
||||
protected.GET("/channels/:id/messages/:msgId/siblings", msgs.ListSiblings)
|
||||
|
||||
// Chat Completions
|
||||
comp := handlers.NewCompletionHandler(keyResolver, stores)
|
||||
comp := handlers.NewCompletionHandler(keyResolver, stores, hub)
|
||||
protected.POST("/chat/completions", comp.Complete)
|
||||
|
||||
// Summarize & Continue
|
||||
@@ -258,6 +267,12 @@ func main() {
|
||||
// Public global settings (non-admin users can read safe subset)
|
||||
adm := handlers.NewAdminHandler(stores, keyResolver, uekCache)
|
||||
protected.GET("/settings/public", adm.PublicSettings)
|
||||
|
||||
// Extensions (user-facing)
|
||||
protected.GET("/extensions", extH.ListUserExtensions)
|
||||
protected.POST("/extensions/:id/settings", extH.UpdateUserExtensionSettings)
|
||||
protected.GET("/extensions/:id/manifest", extH.GetExtensionManifest)
|
||||
protected.GET("/extensions/tools", extH.ListBrowserToolSchemas)
|
||||
}
|
||||
|
||||
// ── Admin routes ────────────────────────
|
||||
@@ -336,6 +351,13 @@ func main() {
|
||||
admin.GET("/pricing", usageH.ListPricing)
|
||||
admin.PUT("/pricing", usageH.UpsertPricing)
|
||||
admin.DELETE("/pricing/:provider/:model", usageH.DeletePricing)
|
||||
|
||||
// Extensions (admin)
|
||||
extAdm := handlers.NewExtensionHandler(stores)
|
||||
admin.GET("/extensions", extAdm.AdminListExtensions)
|
||||
admin.POST("/extensions", extAdm.AdminInstallExtension)
|
||||
admin.PUT("/extensions/:id", extAdm.AdminUpdateExtension)
|
||||
admin.DELETE("/extensions/:id", extAdm.AdminUninstallExtension)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user