Rewrite imports for plugin, blocks, templates, auth, settings, crypto, and rbac packages from git.dev.alexdunmow.com/block/core/* to git.dev.alexdunmow.com/block/pluginsdk/* across all Go files. The captcha package stays on block/core, so the repo keeps both requires. go.mod: add pluginsdk v0.1.0; bump core v0.20.2 -> v0.20.3 (satisfies the check-safety core-version gate); transitive churn pgx v5.9.2 -> v5.10.0 and x/mod v0.34.0 -> v0.37.0 from go mod tidy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
65 lines
1.7 KiB
Go
65 lines
1.7 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
|
|
"git.dev.alexdunmow.com/block/pluginsdk/blocks"
|
|
"git.dev.alexdunmow.com/block/pluginsdk/plugin"
|
|
"git.dev.alexdunmow.com/block/pluginsdk/templates"
|
|
)
|
|
|
|
//go:embed all:web/dist/assets
|
|
var distAssets embed.FS
|
|
|
|
//go:embed schemas
|
|
var schemasFS embed.FS
|
|
|
|
//go:embed plugin.mod
|
|
var pluginModBytes []byte
|
|
|
|
// Register is the plugin entry point.
|
|
// Returns an error if registration fails.
|
|
func Register(tr templates.TemplateRegistry, br blocks.BlockRegistry) error {
|
|
br.Register(CalcomBookingMeta, CalcomBookingFunc)
|
|
return nil
|
|
}
|
|
|
|
// CalcomBookingMeta defines the Cal.com booking block metadata
|
|
var CalcomBookingMeta = blocks.BlockMeta{
|
|
Key: "calcom:booking",
|
|
Title: "Cal.com Booking",
|
|
Description: "Embeddable booking calendar with custom styling powered by Cal.com",
|
|
Category: blocks.CategoryContent,
|
|
Source: "calcomblock",
|
|
EditorJS: "remoteEntry.js",
|
|
}
|
|
|
|
// Schemas returns the embedded schemas filesystem
|
|
func Schemas() fs.FS {
|
|
subFS, _ := fs.Sub(schemasFS, "schemas")
|
|
return subFS
|
|
}
|
|
|
|
// AssetsHandler serves static assets including the Module Federation remote entry
|
|
func AssetsHandler() http.Handler {
|
|
subFS, err := fs.Sub(distAssets, "web/dist/assets")
|
|
if err != nil {
|
|
return http.NotFoundHandler()
|
|
}
|
|
return http.FileServer(http.FS(subFS))
|
|
}
|
|
|
|
// HTTPHandler returns the plugin's HTTP handler for Cal.com API endpoints.
|
|
// Mounted at /api/plugins/calcomblock/. deps carries Crypto + Pool.
|
|
func HTTPHandler(deps plugin.CoreServices) http.Handler {
|
|
return NewCalcomRouter(deps)
|
|
}
|
|
|
|
// SettingsPanel returns the path to the Module Federation settings component.
|
|
// The settings.tsx component is exposed at ./settings in the remoteEntry.js
|
|
func SettingsPanel() string {
|
|
return "remoteEntry.js"
|
|
}
|