The list block prints items with a dot, dash, number or checkbox bullet,
wrapping a long item with a hanging indent; a checkbox list ticks its
done items as [√], or [x] on code pages without √. It stands alone or
inside a box, and its items, bullet and done fields carry their enums
and limits as jsonschema tags.
internal/pkg/modules holds modules that build ordinary jobs from their
own payloads: a registry by name, an Env with the clock, time zone and
time layout, strict payload decoding that reports every problem, ErrSkip
and PayloadError. The note module prints a boxed note with an optional
checklist and a time stamp in the footer.
Three routes join the route table: POST /api/v1/print/{module} and
POST /api/v1/preview/{module}, which take ?copies and a reserved
?printer, and GET /api/v1/modules. Print and the module route share one
submit path, and preview shares one too. New error codes:
invalid_payload, invalid_query, unknown_printer, module_not_found and
module_failed; a module that builds an invalid receipt is logged and
reported to Sentry once. [format] gains timezone and time_layout, the
binary embeds the time zone database, and uberbringer preview takes
--module.
The note receipt passed on the TM-T88IV, and its bytes are pinned in
TestPaperReceipts. docs/api.md describes the list block, the module
routes and the note payload; docs/swagger.json is regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
948 B
Go
41 lines
948 B
Go
// Command uberbringer runs the Überbringer receipt printer daemon: a REST API
|
|
// that prints JSON-described receipts on an EPSON ESC/POS network printer.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
// Embeds the IANA time zone database, which Windows and slim container
|
|
// images lack, so that any format.timezone name loads.
|
|
_ "time/tzdata"
|
|
|
|
"uberbringer/internal/app/uberbringer"
|
|
)
|
|
|
|
// Set at build time with -ldflags "-X main.version=... -X main.commit=...".
|
|
var (
|
|
version = "dev"
|
|
commit = "none"
|
|
sentryDSN = ""
|
|
)
|
|
|
|
func main() {
|
|
os.Exit(run())
|
|
}
|
|
|
|
func run() int {
|
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
|
defer stop()
|
|
|
|
build := uberbringer.BuildInfo{Version: version, Commit: commit, SentryDSN: sentryDSN}
|
|
if err := uberbringer.Execute(ctx, build, os.Args[1:]); err != nil {
|
|
fmt.Fprintf(os.Stderr, "uberbringer: %v\n", err)
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|