Compare commits
3 Commits
d75bec2e03
...
d08466ec70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d08466ec70 | ||
|
|
d9788abe4c | ||
|
|
e309e3d80b |
15
Makefile
15
Makefile
@ -2,16 +2,11 @@ SDK_MODULE := git.dev.alexdunmow.com/block/core
|
||||
SDK_VERSION ?= $(shell git describe --tags --abbrev=0)
|
||||
|
||||
SDK_DOWNSTREAM_DIRS := \
|
||||
$(HOME)/src/blockninja/backend \
|
||||
$(HOME)/src/orchestrator/backend \
|
||||
$(wildcard $(HOME)/src/blockninja-themes/*) \
|
||||
$(HOME)/src/assumechaos \
|
||||
$(HOME)/src/bidbuddy \
|
||||
$(HOME)/src/bidmasters \
|
||||
$(HOME)/src/coterieos \
|
||||
$(HOME)/src/messenger \
|
||||
$(HOME)/src/perthplaygrounds \
|
||||
$(HOME)/src/symposium
|
||||
$(HOME)/src/blockninja/cms/backend \
|
||||
$(HOME)/src/blockninja/orchestrator/backend \
|
||||
$(wildcard $(HOME)/src/blockninja/themes/*) \
|
||||
$(wildcard $(HOME)/src/blockninja/sites/*) \
|
||||
$(wildcard $(HOME)/src/blockninja/plugins/*)
|
||||
|
||||
.PHONY: install-ninja
|
||||
install-ninja:
|
||||
|
||||
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.26.4
|
||||
require (
|
||||
connectrpc.com/connect v1.20.0
|
||||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/a-h/templ v0.3.1001
|
||||
github.com/a-h/templ v0.3.1020
|
||||
github.com/flosch/pongo2/v6 v6.1.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jackc/pgx/v5 v5.9.2
|
||||
|
||||
2
go.sum
2
go.sum
@ -4,6 +4,8 @@ github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk
|
||||
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/a-h/templ v0.3.1001 h1:yHDTgexACdJttyiyamcTHXr2QkIeVF1MukLy44EAhMY=
|
||||
github.com/a-h/templ v0.3.1001/go.mod h1:oCZcnKRf5jjsGpf2yELzQfodLphd2mwecwG4Crk5HBo=
|
||||
github.com/a-h/templ v0.3.1020 h1:ypAT/L5ySWEnZ6Zft/5yfoWXYYkhFNvEFOeeqecg4tw=
|
||||
github.com/a-h/templ v0.3.1020/go.mod h1:A2DlK61v+K+NRoGnhmYbNYVmtYHcFO5/AisMvBdDxTM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
|
||||
@ -38,6 +38,9 @@ type CoreServices struct {
|
||||
MediaPath string
|
||||
AppURL string
|
||||
|
||||
// Media library — deposit images through the full upload pipeline
|
||||
Media Media
|
||||
|
||||
// AI
|
||||
ToolRegistry ai.ToolRegistry
|
||||
AITextCall func(ctx context.Context, taskKey, systemPrompt, userMessage string) (string, error)
|
||||
@ -60,6 +63,45 @@ type CoreServices struct {
|
||||
RAGService RAGService
|
||||
}
|
||||
|
||||
// MediaDeposit describes an image a plugin deposits into the CMS media library.
|
||||
// The bytes flow through the same pipeline as an admin upload (optimize, WebP,
|
||||
// thumbnails, LQIP, dimensions); responsive variants are generated on demand.
|
||||
type MediaDeposit struct {
|
||||
// ID is the media row's primary key. REQUIRED for Provisioner.EnsureMedia —
|
||||
// it is the deterministic, template-referable key a seeded {% img %} tag
|
||||
// resolves by. Optional for Media.Deposit, where a zero value is generated.
|
||||
ID uuid.UUID
|
||||
// Filename is the original filename, e.g. "hero.jpg".
|
||||
Filename string
|
||||
// Data is the raw image bytes, typically from go:embed.
|
||||
Data []byte
|
||||
// AltText is optional accessibility text.
|
||||
AltText string
|
||||
// Folder optionally groups the media under a named library folder,
|
||||
// created if absent.
|
||||
Folder string
|
||||
// Source is an optional provenance label, e.g. the plugin name.
|
||||
Source string
|
||||
}
|
||||
|
||||
// MediaResult reports the outcome of a deposit.
|
||||
type MediaResult struct {
|
||||
// ID is the media row's primary key (the supplied ID, or a generated one).
|
||||
ID uuid.UUID
|
||||
// Ref is a ready-to-use reference ("media:<uuid>") for a block src or a
|
||||
// {% img %} tag.
|
||||
Ref string
|
||||
// Created is false when an existing row with the supplied ID was reused.
|
||||
Created bool
|
||||
}
|
||||
|
||||
// Media lets a plugin deposit images into the CMS media library at runtime.
|
||||
// Seed-time deposits use Provisioner.EnsureMedia instead — it is idempotent
|
||||
// (skip if the ID exists; on changed bytes it warns rather than overwriting).
|
||||
type Media interface {
|
||||
Deposit(ctx context.Context, deposit MediaDeposit) (MediaResult, error)
|
||||
}
|
||||
|
||||
// JobRunner submits background jobs for async processing.
|
||||
type JobRunner interface {
|
||||
Submit(ctx context.Context, jobType string, config []byte) error
|
||||
|
||||
@ -23,6 +23,11 @@ type Provisioner interface {
|
||||
DisableOrphanedJobSchedules(registeredTypes []string) error
|
||||
EnsurePlugin(name string) error
|
||||
EnsureCustomColor(config CustomColorConfig) error
|
||||
// EnsureMedia deposits an image under the plugin-chosen MediaDeposit.ID if a
|
||||
// row with that ID does not already exist. Idempotent: an existing ID is a
|
||||
// no-op; if the bytes differ from what was first deposited it logs a warning
|
||||
// rather than overwriting (seeded media is immutable once placed).
|
||||
EnsureMedia(deposit MediaDeposit) error
|
||||
}
|
||||
|
||||
// DataTableConfig defines a data table to provision.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user