Plan the printer choice in the JSON body
The printers plan named a request's printer with ?printer= on /print, /preview and the module routes. The owner's rule puts every API input in the JSON body, so the plan now takes printer in the body: beside elements and copies on /print and /preview, and in the module routes' body beside payload and copies, where it already sits. Decision 7 says so. The field belongs to the request, not the receipt, so receipt.Job gains none. An empty printer is the same as none, since JSON makes the two easy to confuse, and "default" names the default printer itself. Its Breaking item goes: every route already refuses a query string. route.by names a request's choice "request" in place of "query". Stage 1b, its tests, the compatibility notes and stage 2a follow. The templates plan's modules take the same body, and design.md's Planned next says printer goes in the body. The rule's list of plans that break it loses the printers plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6bfaee0bc8
commit
c60d7531b2
3 files changed
+53
-51
No files matched your search
@@ -29,8 +29,8 @@ For stage 1:
|
||||
- The sample needs only the fields the template reads, so a payload of many kilobytes can be cut down to a few lines.
|
||||
- No variable sets `[[templates]]`, nor, from later stages, `[[ntfy.rules]]` or `[webhooks]`. At start one WARN line names any `UBERBRINGER_TEMPLATES_*` or `UBERBRINGER_WEBHOOKS_*` variable, never its value, as printers.md decision 2 does for its sections.
|
||||
- Trade-off: long templates make the config long, and the config holds `api.secret`, so whoever edits templates can read it.
|
||||
4. **Templates and the existing modules.** Every template is also a module. It appears in `GET /api/v1/modules` with its description, prints at `POST /api/v1/print/<name>` and previews at `POST /api/v1/preview/<name>`, with the same query (`copies`, `printer`), answers and token scopes as `note`, `notify` and `ntfy`. A `json` template takes a JSON object as its body, as the module routes document it (server/handlers_modules.go:21-23); an `ntfy` template takes one ntfy message object, decoded leniently as the `ntfy` module does.
|
||||
- Template names share the modules' namespace and pattern, `^[a-z][a-z0-9-]{0,31}$` (modules/registry.go:96). A template named like a built-in module is a config error.
|
||||
4. **Templates and the existing modules.** Every template is also a module. It appears in `GET /api/v1/modules` with its description, prints at `POST /api/v1/print/<name>` and previews at `POST /api/v1/preview/<name>`, with the same body (`payload`, `copies`, `printer`), answers and token scopes as `note`, `notify` and `ntfy`. A `json` template takes a JSON object as its payload, as the module routes document it (`moduleRequest`, server/handlers_modules.go); an `ntfy` template takes one ntfy message object, decoded leniently as the `ntfy` module does.
|
||||
- Template names share the modules' namespace and pattern, `^[a-z][a-z0-9-]{0,31}$` (modules/registry.go:112). A template named like a built-in module is a config error.
|
||||
- So a script that can send a bearer token uses a template without a webhook, a token from `uberbringer token --modules <name>` limits it to that template, and the preview route is the dry-run over HTTP (decision 10). `uberbringer token` reads the config before it checks the names, which today it checks against the built-in modules only (internal/app/uberbringer/cli.go:156-161).
|
||||
- Emoji are removed from the text fields of what a template returns (`text`, `title`, `footer`, `key`, `value`, list items and the card's fields), as on the notification path (design.md:134-138), rather than printed as `?`. `url`, `data` and `base64` are left as they are. The `note` module keeps printing them as `?`.
|
||||
- `GET /api/v1/modules` lists every template's name and description to any token, those limited to other modules included. docs/security.md says so.
|
||||
@@ -165,7 +165,7 @@ KANRISHA
|
||||
- The engine itself is as printers.md's findings describe. Its runtime error log quotes Expr's message (engine.go:236-245), which this plan does not copy.
|
||||
|
||||
THE REPOSITORY
|
||||
- A module turns a body into a `receipt.Job` (modules/registry.go:72-87). The module routes answer `204` for `ErrSkip` and `422` `module_failed` for an invalid built job, with the problems' text (server/handlers_modules.go:90-118). They never call `checkRaw`, which only `/print` does.
|
||||
- A module turns a body into a `receipt.Job` (modules/registry.go:88-103). The module routes answer `204` for `ErrSkip` and `422` `module_failed` for an invalid built job, with the problems' text (server/handlers_modules.go:105-133). They never call `checkRaw`, which only `/print` does.
|
||||
- The subscriber's order (ntfy/subscriber.go:497-534): skip by `min_priority`; skip an update if `updates = "skip"`; quiet hours drop or hold; the budget holds unless `bypass_priority`, and so does a digest already waiting (line 518); then `Handler.Message`. An error from the handler stops reading and offers the message again. Held messages print as soon as the budget has room, or when quiet hours end (ntfy/subscriber.go:616-628). A digest row is a message's title, or its text's first line cut to 256 bytes (ntfy/ratelimit.go:113-139).
|
||||
- internal/app turns a message into a card and submits it; a card that fails validation is logged, reported and dropped (internal/app/uberbringer/ntfy.go:165-206).
|
||||
- `checkRaw` walks top-level elements only (server/auth.go:135-150), so a job built elsewhere must refuse `raw` itself.
|
||||
|
||||
Reference in new issue
Block a user