CUPS Web Developer Guide
็ฎไฝไธญๆ ยท English
This guide covers the project architecture, API, development workflow, and extension points. For user instructions, see README.en.md.
๐ In-depth documentation lives in docs/en/. This guide keeps the rules and contracts easy to scan.
Keeping Chinese and English documentation in sync
- When adding or updating documentation, maintain both versions in the same change. Pair
README.mdwithREADME.en.md,AGENTS.mdwithAGENTS.en.md, anddocs/<path>.mdwithdocs/en/<path>.md. Preserve the relative filename and directory structure in the English tree. - Synchronize feature descriptions, examples, links, screenshot references, and navigation. When a heading changes, check section links in both languages. Keep code, commands, paths, and configuration names consistent.
- Keep both languages current for the website home page, documentation navigation, and language switcher. Verify with
npm ci --prefix websiteandnpm run build --prefix website. After merging tomaster, the GitHub Pages workflow rebuilds and publishes the site.
๐ฆ Project overview
- Purpose: A web print management tool built on CUPS, with a separate frontend and backend.
- Stack: Go 1.26 backend, Vue 3 frontend, SQLite storage, and IPP printing.
- Deployment: A single binary embeds the frontend via
go:embedand connects to external CUPS. The all-in-one (AIO) Docker image runscupsdandcups-webtogether with LibreOffice, Java 21, the OFD converter, Ghostscript, and printing drivers. - Web-only image: The
web-runtimetarget in the sameDockerfileretains document conversion dependencies and connects to external CUPS viaCUPS_HOSTorCUPS_SOCKET_PATH. These tags end in-weband usedocker-compose.web.yml. This target ships without cupsd, printer drivers, or scanning utilities.
โ ๏ธ The repository previously used separate CUPS and cups-web containers in the
cups/directory. The unified deployment uses the rootDockerfileandentrypoint.sh, build scripts inscripts/build/, and driver scripts inscripts/driver/.
๐ ๏ธ Technology stack
Backend
| Component | Purpose |
|---|---|
| Go 1.26 | See go.mod |
gorilla/mux |
HTTP routing |
gorilla/securecookie |
Session management |
modernc.org/sqlite |
Pure Go SQLite without CGO |
OpenPrinting/goipp |
IPP protocol |
rsc.io/pdf + phpdave11/gofpdf |
PDF parsing and generation |
golang.org/x/image/draw |
CatmullโRom downsampling of large images |
golang.org/x/crypto/bcrypt |
Password hashing |
Frontend
| Component | Purpose |
|---|---|
| Vue 3.5 + Vue Router | Hash-based routing |
| Vite 7 | Build |
@nuxt/ui v4 + Tailwind CSS v4 |
UI and styles |
pdfjs-dist |
PDF preview. The backend /api/convert endpoint generates PDFs. |
| Bun (local) / npm (CI and Docker) | Package management. npm covers linux/arm/v7 because Bun lacks 32-bit ARM support. |
External dependencies
CUPS provides IPP communication, LibreOffice converts Office documents to PDFs, Java 21 and ofd-converter.jar convert OFD documents to PDFs, Ghostscript normalizes PDFs, and dpkg/apt-get install drivers at runtime.
See architecture.md for details on LibreOffice's writable home directory, Ghostscript font changes, and the runtime image's lack of
dpkg-dev.
๐ Project layout
cups-web/
โโโ cmd/server/ # Backend executable
โ โโโ main.go # Entry point and route registration
โ โโโ app.go # Globals
โ โโโ bootstrap.go # Default admin initialization
โ โโโ auth_handlers.go # Login, logout, session, and CSRF
โ โโโ login_limiter.go # Failed login rate limiting
โ โโโ admin_handlers.go # Administrator users, settings, and cleanup
โ โโโ user_handlers.go # /api/me
โ โโโ print_handlers.go # /api/print (primary print entry point)
โ โโโ print_records_handlers.go # Print record listing, downloads, and reprints
โ โโโ printer_info_handler.go # Printer attributes
โ โโโ convert_handler.go # /api/convert
โ โโโ convert_utils.go # LibreOffice and OFD conversion helpers
โ โโโ compose_handler.go # /api/compose (multi-page layout)
โ โโโ estimate_handler.go # /api/estimate (page count estimate)
โ โโโ preview_handler.go # /api/preview-page (PDF page to PNG fallback)
โ โโโ driver_handlers.go # /api/admin/drivers/* and background jobs
โ โโโ driver_registry.go # Driver registry
โ โโโ file_utils.go # File storage, type detection, and page count
โ โโโ pdf_utils.go # Image and text to PDF conversion
โ โโโ pdf_compose.go # Multi-page layout
โ โโโ pdf_reorder.go # Page reordering and tests
โ โโโ watermark.go # Watermarks
โ โโโ pdf_normalize.go # PDF normalization pipeline
โ โโโ fonts.go # Chinese font loading
โ โโโ font_handlers.go # /api/admin/fonts/* (list, upload, delete, and refresh)
โ โโโ font_parser.go # SFNT (TTF/OTF/TTC) name-table parsing
โ โโโ font_preflight.go # Missing font detection and print blocking
โ โโโ maintenance.go # Background maintenance
โ โโโ version.go # Build-time version
โโโ internal/
โ โโโ auth/session.go # securecookie sessions and CSRF
โ โโโ middleware/ # CSRF and security middleware
โ โโโ ipp/ # IPP client and URI validation
โ โโโ server/static.go # Embedded assets and SPA fallback
โ โโโ store/ # Data layer (users, prints, and settings)
โโโ frontend/ # Vue 3 frontend (go:embed dist)
โโโ ofd-converter/ # Java OFD to PDF converter
โโโ scripts/
โ โโโ build/install-cups.sh # Build CUPS from source
โ โโโ driver/ # Driver commands, installers, and capture-debs.sh apt hook
โโโ docker-fonts/ # Build-time fonts and Ghostscript/fontconfig configuration
โโโ entrypoint.sh # AIO container startup
โโโ Dockerfile # Shared converter dependencies and AIO/Web-only targets
โโโ docker-compose.yml # Single AIO service
โโโ docker-compose.web.yml # Web-only service with external CUPS
โโโ Makefile # Build targets
๐ HTTP API
All routes have the /api prefix. Protected routes use RequireSession and ValidateCSRF. Administrator routes also use RequireAdmin. The public routes are listed below.
CSRF contract: After successful login, the server issues a non-HttpOnly
csrf_tokencookie. The frontend supplies theX-CSRF-Tokenheader on non-GET requests.
API key authentication (issue #113): The
protectedandadminsubrouters runmiddleware.APIKeyAuthbeforeRequireSession. The middleware looks up the SHA-256 hex hash ofAuthorization: Bearer cw_...orX-API-Key: cw_...inapi_keys.token_hash, then inserts the owner'sauth.Sessioninto the request context.RequireSessionandRequireAdminapply the usual checks.ValidateCSRFusesauth.IsAPIKeyAuthto exempt this authentication method from double-submit validation. The reserved guest account cannot issue or use keys. The handlers forPOST /api/api-keysandDELETE /api/api-keys/{id}require a browser session to prevent keys issuing more keys.
Public endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /api/login |
Log in |
| POST | /api/logout |
Log out |
| GET | /api/csrf |
Refresh CSRF token |
| GET | /api/session |
Query session |
| GET | /api/version |
Build version |
| GET | /api/auth/config |
{passkeyEnabled}; the login page renders from it |
| POST | /api/passkey/login/begin ยท login/finish |
Passkey discoverable-credential sign-in (no username). Registered only when PASSKEY_ENABLED=true |
Authenticated endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/me |
Current user information |
| GET | /api/printers |
List printers |
| GET | /api/printer-info?uri=<uri> |
Printer attributes |
| GET | /api/printer-options?uri=<uri>&force=1 |
Driver paper, media, and quality options. force is optional. |
| POST | /api/estimate |
Estimate page count |
| POST | /api/convert |
Convert a document to PDF (single file or multiple image files) |
| POST | /api/preview-page |
Render a PDF page to PNG (file and page, response header X-Page-Count) as a browser pdf.js fallback |
| POST | /api/print |
Submit a print job |
| POST | /api/compose |
Compose a multi-page layout |
| GET/POST | /api/scheduled-prints |
List or create scheduled jobs |
| PUT/DELETE | /api/scheduled-prints/{id} |
Update or delete a scheduled job |
| POST | /api/scheduled-prints/{id}/run |
Run a job early and asynchronously. Returns 202 {ok, status:"running"}. |
| GET | /api/scheduled-prints/{id}/files/{index} |
Photo queue thumbnail for the owner or an administrator |
| GET | /api/scheduled-prints/bing/preview |
Today's Bing China wallpaper metadata and a same-origin image URL |
| GET | /api/scheduled-prints/bing/image/{imageID} |
Preview URL for today's downloadable Bing JPEG, validated before serving |
| GET | /api/print-records |
Print records |
| GET | /api/print-records/{id}/file |
Download the original file |
| POST | /api/print-records/{id}/reprint |
Prefill reprint parameters |
| GET | /api/scan/devices |
List scanners (scanimage -L) |
| GET | /api/scan/options?device=<name> |
List device options using scanimage -A. The MVP covers mode, resolution, and source. |
| POST | /api/scan/jobs |
Submit an asynchronous scan. Returns 202 {jobId, recordId, filename}. |
| GET | /api/scan/jobs/{id} |
Poll scan status and incremental logs |
| DELETE | /api/scan/jobs/{id} |
Cancel a running scan |
| GET | /api/scan/records |
Scan records. Administrators can filter with ?username=. |
| GET | /api/scan/records/{id}/file |
Download a scan |
| DELETE | /api/scan/records/{id} |
Delete scan record and file |
| GET | /api/api-keys |
List the caller's API keys without plaintext (issue #113) |
| POST | /api/api-keys |
Create a key and reveal plaintext once. Browser session only. |
| DELETE | /api/api-keys/{id} |
Delete one of the caller's keys. Browser session only. |
| GET | /api/passkeys |
List the caller's passkeys (routes exist only when PASSKEY_ENABLED=true). Browser session only; guest gets 403 |
| POST | /api/passkeys/register/begin ยท register/finish |
Register a passkey (ResidentKey: required); the challenge is linked by the X-Passkey-Session header; limit 10 per user |
| DELETE | /api/passkeys/{id} |
Delete one of the caller's passkeys |
| GET | /api/print-presets |
List the caller's presets (issue #128). Guests receive 403. |
| POST | /api/print-presets |
Create {name, settings}. Duplicate names return 409. Limit 20 per user. |
| PUT/DELETE | /api/print-presets/{id} |
Owner-only rename, overwrite of optional fields, or deletion |
Asynchronous scan jobs (issue #111)
- Use the
scanimagesubprocess. HPLIP'shp-scandepends on the container's HPLIP daemon and returnedSANE: Error during device I/O (code=9)even withdbus-daemon --system --fork. The standard Debian SANE stack (sane-utils+libsane-hpaio) worked on the same host and hardware. - Scans can run concurrently.
scanimagehas no global apt/dpkg lock. The SANE backend manages exclusive access to each scanner. - The hard timeout is five minutes (
scanJobTimeout). Derive the context fromcontext.Background()so the HTTP server'sWriteTimeout=120scannot terminate the subprocess. - For PDF output, first write a temporary PNG with
scanimage, then convert it usinggs -sDEVICE=pdfwrite -dSAFER -dNOPAUSE -dBATCHand clean up the PNG. This path works with backends that lack--format=pdf. - The in-memory job table retains entries for an hour. Expiry removes the memory entry only. User-visible data lives in
scan_recordsand the stored file. SCAN_DIRcontrols storage and defaults toscans/. The AIO Compose file maps./.scansto/scans. Downloads and deletions useos.OpenInRoot(scanDir, ...)to guard against path traversal.- Validate device names against
scanimage -L, round-trip resolution viastrconv.Atoi, and allowlist mode and format (Color/Gray/Lineart and png/jpeg/pdf). Pass separate arguments toexec.CommandContextwithout invoking a shell. - The eSCL/AirScan backend needs an explicit scan region (issue #112). Without
--tl-x/--tl-y/--br-x/--br-y, br-x/br-y round to zero andsane_startreturnsInvalid argument.runScanimagefirst probes withscanimage -A. When br-x/br-y ranges exist, pass a top-left of 0 and a bottom-right at the reported maxima. Older backends such as hpaio without these ranges keep their existing behavior.isNumericScanValuescreens values parsed from-Abefore argument construction. - Device discovery cache and preload (issue #111).
scanimage -Ltakes about 17 seconds because it queries multiple SANE backends.scanDeviceCacheGetcaches results in process for 60 seconds by default. Override viaSCAN_DEVICES_CACHE_TTL(<=0disables the cache).GET /api/scan/devices?force=1, used by Refresh Devices, bypasses the cache. Probe, options, and jobs validate existence from the cache.startScanPrewarmstarts a background discovery during startup. Failed refreshes retain the previous entry. Async.Mutexandchan struct{}coalesce concurrent requests into one subprocess.
/api/printers response shape
Each item contains name, uri, info, location, and makeAndModel. info is the Description in the CUPS web UI (printer-info), which the frontend uses to distinguish queues for the same model (issue #101).
ipp.ListPrinterstries IPPCUPS-Get-Printersfirst. It requests four specific attributes to avoid hundreds per printer. When the peer rejects the operation or is outside CUPS, it falls back to the/printersHTML page and returns emptyinfo,location, andmakeAndModel.- Iterate all
TagPrinterGroupentries inrsp.Groups. The flattenedgoippMessage.Printerholds the first group only, which silently omits the remaining queues. - Construct URIs from the configured host and the queue name. In TCP mode use
CUPS_HOST. In Unix socket mode uselocalhost:631. Avoid the response'sprinter-uri-supportedbecause it reflects cupsd's own hostname, which can be unresolvable in containers or across networks. - If CUPS creates a queue without
-D,printer-infodefaults to the queue name.printerLabel()omits the duplicate description.
CUPS Unix socket (issue #120)
- A nonempty
CUPS_SOCKET_PATHtakes precedence overCUPS_HOST. Set an absolute path, which the application checks at startup. External cupsd can create the socket later. A failed socket connection stays in socket mode. internal/ipp/connection.goprovides centralized URI handling. Socket mode keeps queue paths and normalizes HTTP addresses tohttp://localhost:631, usingipp://for IPP attributes. It also normalizes job-listjob-printer-urivalues for cancellation. Historical records and scheduled jobs with TCP URIs use the same connection layer.- The socket path comes from the deployment environment only. Socket mode allows only the root, printer list, and printer/class queue paths, and rejects credentials, queries, fragments, and path traversal.
newSafeClientdials the Unix socket directly and keeps timeouts, redirect restrictions, and response size limits. TCP mode uses the host/IP SSRF policy. docker-compose.web.socket.ymldemonstrates mounting the host socket directory. Containers can share a runtime directory volume. Mount the whole directory so cupsd can recreate the socket. The deployer manages directory and socket permissions. AIO keeps its default TCP mode and local driver commands.
Administrator endpoints (/api/admin/*)
| Method | Path | Purpose |
|---|---|---|
| GET/POST | /api/admin/users |
List or create users |
| PUT/DELETE | /api/admin/users/{id} |
Update or delete users except the protected admin |
| GET | /api/admin/print-records |
Site-wide print records |
| GET/PUT | /api/admin/settings |
System settings |
| POST | /api/admin/cleanup |
Manual cleanup |
| GET | /api/admin/drivers |
Driver list and status |
| POST | /api/admin/drivers/install |
Asynchronous install. Returns 202 and jobId. |
| POST | /api/admin/drivers/hplip-plugin/prepare |
AIO asynchronous download and signature verification. The job result contains version, license, and digest. |
| POST | /api/admin/drivers/hplip-plugin/install |
AIO asynchronous install. Submit {acceptedLicense: true, digest} to bind the install to the reviewed package. |
| POST | /api/admin/drivers/remove |
Asynchronous uninstall. Returns 202 and jobId. |
| GET | /api/admin/drivers/detect |
Detect printers and recommend drivers |
| GET | /api/admin/drivers/ppds |
PPD candidates (?deviceUri=&deviceId=&manufacturer=&model=&limit=8) |
| POST | /api/admin/drivers/upload |
Synchronous .ppd or .deb upload, up to 64 MB |
| POST | /api/admin/drivers/setup |
Asynchronous one-click setup. Returns 202 and jobId. |
| GET | /api/admin/drivers/jobs/{id} |
Poll job status |
| GET | /api/admin/fonts |
Custom font list and status |
| POST | /api/admin/fonts/upload |
Synchronous upload (.ttf, .ttc, .otf), up to 64 MB |
| DELETE | /api/admin/fonts/{name} |
Delete a custom font |
| POST | /api/admin/fonts/refresh |
Sync fonts and refresh the cache |
Asynchronous driver jobs
install,remove, andsetupmust run asynchronously. Compiling drivers can take more than ten minutes, which exceeds the globalWriteTimeout=120s. Return202andjobIdimmediately, and run the command in acontext.Background()goroutine with a 30-minute hard timeout. The frontend pollsjobs/{id}.- Allow one driver job at a time because apt/dpkg use a global lock. Return
409with the activejobIdif a job is already running. - Jobs are stored in memory for one hour and cleared when the process restarts.
- After installing the HPLIP plug-in, the server saves the original installer and signature as
hplip-plugin/<arch>/<version>.zipon the driver volume. At startup, the AIO container verifies and restores the matching version and architecture offline. It logs restore failures and continues starting.GET /api/admin/driversincludes thehplipPluginstatus.
See driver management for the asynchronous job design and request/response shapes.
Each drivers[] item is a DriverStatus with name, displayName, description, arch, needCompile, installed, installedAt, installedArch, supported, and hasScript. The presence of manifest.txt determines installed.
Each customDebs[] item is an informational CustomDebPackage with filename, installedAt, installedArch, and sizeBytes.
Font management and preflight
- Storage and system synchronization
FONTS_DIRcontrols storage. The default is/data/fontsand the fallback isdata/fonts. Both AIO and Web-only images mount./.data:/data.- Startup (
entrypoint.shstep 1b) and the upload, delete, and refresh endpoints callsyncAndRefreshFonts.- Symlink or copy fonts into
/usr/share/fonts/truetype/customand clean up orphaned symlinks for files deleted from storage. - Run
fc-cache -f /usr/share/fonts/truetype/customwith a 30-second timeout. - When basic fonts such as
simsun.ttf,simhei.ttf,simkai.ttf, andsimfang.ttfare present, patch/etc/ghostscript/cidfmap.localand sync$GS_INIT_DIR/cidfmapso Ghostscript'spdfwritenormalization uses the correct glyphs. - Call
InvalidateSystemFontCache()to reset the in-process cache immediately.
- Symlink or copy fonts into
- Metadata parser (
font_parser.go)- Filename-based recognition can misidentify files such as
1.ttf. Parse the standard SFNT (TTF/OTF/TTC)nametable. - Decode Chinese names strictly as UTF-16BE for Platform ID 3 (Windows) and Platform ID 0 (Unicode).
- Extract Name IDs 1 (Family), 2 (Subfamily), 4 (Full Name), 6 (PostScript), and 16 (Preferred Family).
- Each
customFonts[]entry preservesnameas the on-disk filename. It addsdisplayName(bilingual names such asไปฟๅฎ (FangSong), Western names such asArial, or slash-separated TTC subfonts such asๅฎไฝ (SimSun) / ๆฐๅฎไฝ (NSimSun)),family,subfamily, andformat(TTF/OTF/TTC). - The API sorts by
displayNamein ascending case-insensitive order.
- Filename-based recognition can misidentify files such as
- Font preflight blocking (
font_preflight.go)- For
.docxor.pdffiles with incomplete embedded fonts submitted to/api/printor/api/convert, extract referenced fonts and compare with system families, including alias mappings and Chinese GBK hex BaseFont names. - Missing fonts return
422 Unprocessable Entitywith{"error":"MISSING_FONTS","missingFonts":["..."]}when font substitution is disabled, so incorrect layouts cannot print silently. allow_font_fallbackis disabled by default and configurable globally in system settings. The frontend modal can allow substitutions once or always.
- For
- Upload and delete boundaries
- Sanitize filenames with
filepath.Base, allow only.ttf,.ttc, or.otf, and reject traversal characters. - Each upload has a 64 MB limit.
- Sanitize filenames with
/api/print form fields
| Field | Type | Purpose |
|---|---|---|
file |
file | File to print |
printer |
string | Printer URI |
sides |
one-sided / two-sided-long-edge / two-sided-short-edge |
Simplex, long-edge duplex, or short-edge duplex. Takes precedence over duplex. |
duplex |
"true" / "false" |
Compatibility field. Without sides, true means long-edge duplex. |
color |
"true" / "false" |
Color output |
copies |
int | Number of copies |
orientation |
portrait / landscape |
Orientation |
paper_size |
A4 / A3 / 5inchโฆ10inch |
Paper size |
driver_options |
JSON string | pageSize, mediaType, and quality from /api/printer-options. The server validates and stores a snapshot. These override the corresponding legacy parameters. |
paper_type |
plain / photo / โฆ / auto |
Media type |
media_source |
string | Input tray. Omit auto. |
print_scaling |
auto / auto-fit / fit / fill / none / numeric 10โ400 |
Scaling. A number is a custom percentage. |
page_range |
string | Page range |
page_set |
all / odd / even |
Page subset. Omit all. |
mirror |
"true" / "false" |
Mirror output |
compress_images |
"true" / "false" |
Opt-in image compression during conversion. Each encoded image is at most 800,000 bytes. |
number_up |
1โ16 |
N-up. Omit 1. |
number_up_layout |
lrtb / rltb / tblr / tbrl |
N-up order |
page_border |
single / none |
N-up borders |
๐๏ธ Database
SQLite uses WAL and foreign_keys. Migrations in store.go::migrate() use idempotent SQL and add columns incrementally with addColumnIfMissing.
users
| Column | Type | Purpose |
|---|---|---|
id |
INTEGER PK | Auto-increment |
username |
TEXT UNIQUE | Login name |
password_hash |
TEXT | bcrypt |
role |
TEXT | admin or user |
protected |
INTEGER | 1 indicates protected |
contact_name / phone / email |
TEXT | Contact information |
created_at / updated_at |
TEXT | RFC3339 UTC |
print_jobs
| Column | Type | Purpose |
|---|---|---|
id |
INTEGER PK | Auto-increment |
user_id |
INTEGER FK | Submitter |
printer_uri / filename / stored_path |
TEXT | Printer and file |
pages |
INTEGER | Page count |
job_id |
TEXT | IPP Job ID |
status |
TEXT | queued or printed |
is_duplex / is_color / mirror |
INTEGER | Boolean parameters |
copies / number_up |
INTEGER | Numeric parameters |
orientation / paper_size / paper_type / media_source |
TEXT | Media parameters |
print_scaling / page_range / page_set |
TEXT | Page parameters |
watermark_text |
TEXT | Watermark |
number_up_layout / page_border |
TEXT | N-up parameters |
created_at |
TEXT | RFC3339 UTC |
Issue #68 added the print parameter columns beyond
is_duplexandis_colorto persist a full snapshot for reprinting.page_setstores the user's original choice, such aseven-reverse, before any page reordering.
scan_records (issue #111)
| Column | Type | Purpose |
|---|---|---|
id |
INTEGER PK | Auto-increment |
user_id |
INTEGER FK | Scanning user, with cascading deletes |
device |
TEXT | SANE URI such as hpaio:/usb/... |
mode |
TEXT | Color, Gray, or Lineart |
resolution |
INTEGER | dpi (50โ4800) |
source |
TEXT | ADF, Flatbed, or another source. An empty string uses the device default. |
format |
TEXT | png, jpeg, or pdf |
filename / stored_path |
TEXT | Relative to SCAN_DIR |
size_bytes |
INTEGER | Output file size, or 0 on failure |
status |
TEXT | running, succeeded, failed, or cancelled |
err_msg |
TEXT | Failure reason |
created_at / finished_at |
TEXT | RFC3339 UTC |
Index: idx_scan_records_user_time (user_id, created_at). Administrators can view the entire table. Standard users are filtered by username.
settings
Key-value table. Current keys are retention_days (0 means keep forever), save_history, max_pages_per_job, max_upload_bytes, custom_css, guest_mode, allow_font_fallback (0 means block on missing fonts, 1 allows automatic substitution), session_hash_key, and session_block_key.
webauthn_credentials (passkeys)
user_id (cascade delete) / credential_id (UNIQUE, base64url) / name / credential_json (full go-webauthn Credential serialization including sign count) / created_at / last_used_at. The user handle is the 8-byte big-endian users.id. See docs/en/passkey.md.
print_presets (issue #128)
| Column | Type | Purpose |
|---|---|---|
id |
INTEGER PK | Auto-increment |
user_id |
INTEGER FK | Owner, with cascading deletes |
name |
TEXT | Name, UNIQUE(user_id, name), 1โ64 characters |
settings_json |
TEXT | Frontend settings snapshot, JSON object up to 16 KB |
created_at / updated_at |
TEXT | RFC3339 UTC |
- Last settings live in browser localStorage under
print_settings_last. They are written after successful standard printing and omit watermark content and page ranges. Named presets persist to the database. The shared guest account cannot use presets. - The server checks the object type and size. The field allowlist lives in
frontend/src/utils/print-settings.js::sanitizePrintSettings. Applying a preset uses factory defaults for missing or invalid values./api/printremains the authoritative validation boundary. Update the allowlist andDEFAULT_PRINT_SETTINGSwhen adding print parameters. driverOptionsholds queue-specific attribute/value pairs. Store it alongsideprinterUriand restore it only for that printer. When changing printers, clear the options and incrementdriverRematchKeysoPrinterMediaOptionsmatches the paper again./api/printrejects options from another queue.
Scheduled photo queues (issue #121)
scheduled_printsreuses print parameters and trigger policies. The idempotently added columns arefiles_json(ordered relative original and thumbnail paths),next_file_index,submitted_count,loop,start_date,history_json(results for the last 20 photos), andphotos_per_run(batch size, default 1).- Creation uses multipart with the existing single-file
filefield or the newfilesqueue field for 1โ100 JPG/PNG/GIF images. Supply one of these fields. Each run submits 1โ100 photos viaphotos_per_run, default 1. Queues support daily, weekly, and monthly schedules.start_dateis local to the server.loop=truerepeats the sequence, otherwise completion disables the queue. - Automatic execution, manual execution, edits, and deletion share a per-job lock. Manual execution uses a background goroutine, and the UI polls the list's
runningfield. Persist progress immediately after each successful submission. A failure ends the batch and the affected photo stays next if submission fails or the execution window is missed. A manual run consumes the next scheduled occurrence and preserves paused status. - Editing print options or pausing preserves the next run time. On resume, only recalculate expired times so running early still moves the schedule forward. The edit view preserves print options it does not expose. The list ignores late responses from older requests.
- Before submitting, persist
enabled=0, last_status=running. On success or a definitive failure, atomically persist the result and progress and restore the schedule. Keep the job paused if service is interrupted, result persistence fails, or the IPP outcome is uncertain to avoid submitting duplicates. - Originals and thumbnails live under
uploads/scheduled/and remain exempt from history cleanup. Restrict thumbnail reads and deletes withos.OpenInRootandos.OpenRoot. Existing single-file schedules keep their completion behavior.
Scheduled Bing daily wallpaper
- Create a multipart job with
source=bingand no file. It can run once, daily, weekly, or monthly. Task responses includesource. Existing jobs default toupload, and the source is fixed when editing a job. - Preview and background runs use fixed Bing China endpoints, with the image date determined in China Standard Time. Automatic and manual runs each submit one image. A manual run keeps the scheduled occurrence. Fetch failures appear in the task results, and the task pauses if the IPP outcome is uncertain. Print history keeps the image that was submitted.
๐ Authentication and security
- Startup โ
auth.SetupSecureCookiereads or creates keys in settings. - Login โ Write
session(HttpOnly, encrypted, and signed) andcsrf_token(non-HttpOnly). - Authorization โ
RequireSessionโRequireAdminfor administrators โValidateCSRFfor non-GET requests. - Logout โ Set both cookies to
MaxAge=-1. - Default administrator โ
bootstrap.goensuresadmin/adminexists withprotected=1.Username == "admin"prevents renaming, changing the role, or deleting the account.
Cookie attributes
Both cookies use Path=/, SameSite=Lax, and MaxAge=86400. Omit Domain to keep them host-only. Always use auth.NewCSRFCookie(), auth.SetSession(), or auth.ClearSession() to issue or clear cookies. Directly constructing http.Cookie in handlers caused attribute drift when the old logout path omitted Secure and SameSite.
COOKIE_SECURE has three modes. The default auto checks r.TLS or the first X-Forwarded-Proto value per request. true always sets Secure and false always clears it. CookieSecure(r) takes an *http.Request because its result cannot be cached process-wide.
Cross-origin protection (middleware.CrossOriginProtection)
The middleware wraps the Go standard library's http.CrossOriginProtection, which uses Sec-Fetch-Site and falls back to comparing Origin with r.Host. It adds two project-specific behaviors.
- Compare
X-Forwarded-HostwhenSec-Fetch-Siteis absent. If a proxy omitsproxy_set_header Host $host,r.Hostcontains the upstream address and disagrees with Origin, blocking POST requests with 403.proxyOriginAllowed()checks the forwarded host only whenSec-Fetch-Siteis missing. Keep browser-supplied cross-origin decisions authoritative when it has a value. The default forwarded-host trust does not weaken security because a client that forges headers can already make the standard library fail open. See the reverse proxy guide for the rationale. - Return JSON on rejection. The standard library's
text/plainresponse once caused the frontend to report invalid credentials for proxy misconfiguration (issue #99).denyCrossOriginreturns{"error","code":"cross_origin_blocked","origin","host"}and logs the decision inputs.LoginView.vuechooses the error message by HTTP status. Keep JSON parsing errors distinct from invalid credentials.
TRUSTED_ORIGINS, a comma-separated list of complete origins, is the only override for browser-classified same-site and cross-site requests.
Login rate limiting (login_limiter.go)
The in-process limiter uses clientIP|username as its key and locks for 15 minutes after five failures. clientIP() unconditionally trusts the first X-Forwarded-For value, so keep the backend port off the public internet.
See the reverse proxy guide for troubleshooting both kinds of 403s, configuring Caddy or Traefik, and using subpaths.
๐จ๏ธ Print pipeline
printHandler accepts multipart data, stores the upload under uploads/YYYYMMDD/, detects and converts the file, counts pages, inserts a queued record, submits via IPP, and writes back printed.
pdfusesnormalizePDF(Ghostscript โ LibreOffice โ passthrough).officeuses LibreOffice--convert-to pdf.ofdusesjava -jar /ofd-converter.jar.imageusesgofpdf. It retains original pixels unless compression is enabled, which limits images to 3000 pixels and 800 KB each. A PDF matrix applies rotation.textusesgofpdfwith embedded Chinese fonts.
โ ๏ธ Normalization addresses older CUPS driver compatibility. Ghostscript can damage placeholder CJK fonts and misalign pdf.js previews. See the PDF pipeline for the pipeline and cidfmap.
Duplex binding (issue #129)
- Standard and batch printing, document and photo reprints, and scheduled jobs share the three-value
sidesfield. JSON uses the same name. LegacyduplexandisDuplexbooleans remain supported. Explicitsidestakes precedence and accepts only the three standard keywords. Invalid values return 400. print_jobsandscheduled_printsgain asidescolumn. An empty string marks a legacy record and falls back to simplex or long-edge duplex viais_duplex. Store the boolean alongside the new column. Reprint prefill, schedule edits, and pause/resume preserve the binding.- Odd, even, and reverse-even modes run as manual duplex. Both submission and history store simplex (issue #109). Use the original
page_setbefore reversing page order.
Custom percentage scaling (pdf_scale.go)
Numeric print_scaling uses resolveCustomScaling to scale PDF content using Ghostscript and send print-scaling=none to CUPS. Use it on both printing and reprinting (reprintHandler).
- IPP
print-scalingaccepts keywords, so omit numeric strings such as"40". After a Ghostscript failure or for a non-PDF input, use the empty string for the printer default. - Avoid fixed media and dimensions via
-dFIXEDMEDIAand-dDEVICEWIDTHPOINTS. They shift landscape pages onto portrait paper. TheInstallprocedure readscurrentpagedevice /PageSizeper page to preserve dimensions. - Put
-sOutputFilebefore-f. Ghostscript interprets later arguments as input filenames and reportsrequires an output file(issue #98). PrintPreview.vueandPdfCanvas.vuepreview percentages with a proportional CSS transform. CUPS applies the other scaling modes.
Driver print options (issue #122)
internal/ipp/printer_options.goreads the queue's PPD using the existing safe connection. It parses PageSize, MediaType, and quality controls, which may be named Ink or similar. Missing categories fall back to standard IPP. Borderless capability requires an appropriate ImageableArea or zero margins on all four sides of media-col.driver_options_jsonstores the complete choice inprint_jobsandscheduled_prints. Accept attribute/value pairs reported for the queue. Treat client-supplied dimensions and labels as untrusted. Print, reprint, and scheduled execution share validation and IPP encoding.- Paper conversion and preview use
custom:<width-mm>x<height-mm>. Borderless image conversion changes the application's default 10 mm margin to zero. Existing PDFs keep their content margins. - Image
print_scaling=fillproportionally enlarges and center-crops during PDF generation. It uses the content area for a single image and each cell for multiple images.fitpreserves the full image. Standard printing, conversion, original-image reprinting, and scheduled jobs share layout logic. Switching fill in the frontend invalidates the old PDF. PDFs already generated keep their layout. - Submit queued photos one at a time and persist each success before starting the next image. Each batch advances a single scheduling point. Keep the persisted job paused while processing a batch to avoid duplicate submissions after interruption. See printer options.
Photo capture date watermarks (issue #124)
photo_date_watermark(multipart) orphotoDateWatermark(JSON) is off by default and persisted in print records and schedules. Printing, reprinting, and scheduled execution share image-to-PDF rendering.- Read JPEG/PNG EXIF
DateTimeOriginalonly and skip missing or invalid values. The browser uploads originals for preview and print, and the server extracts dates before conversion. Clients that precompress images must pass an orderedphoto_datesarray to/api/convert. The server strictly validates the dates and item count. - After rotation and fit/fill layout, place each watermark at the bottom-right of the visible image. Toggling the feature invalidates the old PDF cache. Preserve dates already present in generated PDFs so reprinting does not overlay a second copy. See printer options.
Photo originals and submitted PDFs
/api/printkeeps the singlefilefield and supportsfilesfor 1โ100 photos. Use one field per request. Photo layout sharesrotations,per_page,invert, andcompress_images. Upload originals even when a preview PDF exists.print_jobs.photo_layout_jsonstores ordered originals and a layout snapshot.rendered_pathstores the submitted PDF. Photo reprints regenerate from originals and create independent copies, so clearing one record cannot break another. Scheduled print history separately stores originals, while the schedule owns its source files.- Custom photo sizes conventionally place the short side first, then apply
orientation. Conversion, preview, reprinting, and scheduled execution share this convention. - Download originals via
/api/print-records/{id}/file?source=<index>and the submitted PDF with?variant=rendered. Both require ownership or administrator access and restrict paths withos.OpenInRoot. Retention and manual cleanup must cover every associated asset while preserving shared files underscheduled/.
๐งน Maintenance
maintenance.go runs hourly. Read retention_days and skip if it is 0, delete expired print_jobs and files, then run VACUUM and wal_checkpoint. Administrators can trigger cleanup via POST /api/admin/cleanup.
๐งฉ Driver management
Related files are driver_handlers.go, driver_registry.go, scripts/driver/*.sh, and DriversView.vue.
Directory conventions
| Path | Contents |
|---|---|
/opt/cups-drivers/scripts/install-<name>.sh |
Installer scripts copied at build time for runtime use |
/usr/local/bin/{driver-install,driver-list,driver-remove,restore-drivers} |
Management commands |
/opt/cups-drivers/libexec/capture-debs |
apt DPkg::Pre-Install-Pkgs hook that archives the .deb files apt is about to install |
/opt/cups-drivers/baseline-packages.txt |
Build-time snapshot of packages that ship in the image. Kept in the image layer outside the mounted volume. |
/opt/cups-drivers/data/<driver>/manifest.txt |
File path list and sole installed marker. May be empty in package mode. |
/opt/cups-drivers/data/<driver>/packages.txt |
Marks package or hybrid mode when present. Each row is <pkg> <version> <arch> <relative-path>. |
/opt/cups-drivers/data/<driver>/packages/*.deb |
Archived original packages |
/opt/cups-drivers/data/<driver>/metadata.txt |
driver= / installed_at= / file_count= / arch= / manifest_version= / restore_mode= / package_count= / package_bytes= |
/opt/cups-drivers/data/<driver>/<mirrored-absolute-path> |
Copy of a file-level artifact |
/opt/cups-drivers/data/custom-ppd/ |
Uploaded .ppd files with a restorable manifest |
/opt/cups-drivers/data/custom-deb/packages/ |
Uploaded .deb packages registered in packages.txt and reinstalled on startup |
docker-compose.yml mounts ./.drivers at /opt/cups-drivers/data. This volume preserves drivers across restarts.
Two persistence modes by driver source
| Mode | Applies to | Restore | Uninstall |
|---|---|---|---|
| Package | dpkg packages such as escpr2 (deb), canon-ufr2, konica-bizhub, epson-cn, gutenprint, and custom-deb |
dpkg -i on archived .deb files |
apt-get purge after dry-run validation, or dpkg -P --force-depends |
| File | Non-package sources such as canon-capt, hp-laserjet1020, sharp, foo2zjs-firmware, custom-ppd, and escpr2 (source branch) |
cp -aT using the manifest |
rm -f using the manifest |
Vendor packages often install files outside the allowed paths. All 298 Epson escpr2 files live under /opt, the Konica filter lives under /opt/km, the Canon UFR II rendering engine cnrsdrvufr2 lives under /usr/bin, and the 370 Gutenprint model XML files and 356 Canon ICC profiles live under /usr/share/<vendor>/. A file snapshot alone can yield an empty manifest and exit 1 even after installing files, or an incomplete snapshot that appears installed in the UI and fails after a restart.
Capture original .deb files in this order, stopping after the first source that works. Use the apt hook capture-debs for all transitive dependencies, then the vendor installer handoff through DRIVER_PKG_DIR, then /var/cache/apt/archives/, and finally apt-get download.
capture-debsmust alwaysexit 0. A nonzero result fromDPkg::Pre-Install-Pkgsaborts the entire apt transaction.The vendor installer handoff must use
|| trueand avoid adding atrap, preserving the exit code contract and the single EXIT trap.
Exit code contract
| Exit code | Meaning | Behavior |
|---|---|---|
0 |
Success | Write the manifest |
3 |
Unsupported architecture | Skip the manifest and exit 3 |
| Any other nonzero result | Failure | Skip the manifest and return the failure |
If the installer returns 0, classify the installation as failed only when both the file snapshot and package archive are empty. An archived .deb can be restored successfully even when every installed file falls outside the path allowlist.
Architecture detection
Use dpkg --print-architecture. The runtime lacks dpkg-dev and therefore dpkg-architecture. Go's currentDebArch() maps GOARCH to Debian names. detect_multiarch_libdir() matches /usr/lib/*-linux-gnu* and returns an empty string when no path matches.
Manifest path allowlist
ALLOW: /usr/lib/cups, /usr/share/cups, /usr/share/ppd, /usr/share/foomatic, /lib/firmware, /usr/lib/firmware, and /usr/lib/<multiarch>.
DENY: /usr/bin/*, /usr/sbin/*, /bin/*, /sbin/*, /usr/local/{bin,sbin}/*, /etc/*, /var/*, /usr/include/*, /opt/cups-drivers/*, /tmp/*, /usr/share/{doc,man,locale,info}/*, /usr/share/cups/doc-root/*, */pkgconfig/*, *.a, *.o, and *.la.
Keep the allowlist in all three scripts:
driver-install.sh,driver-remove.sh, andrestore-drivers.sh. Removal and restoration also protect against contaminated legacy snapshots. See driver management for the rationale.
Baseline package ownership guard
The multiarch directory /usr/lib/<triplet> contains both driver and system libraries. A path allowlist cannot distinguish ownership. When apt resolves a vendor package's dependencies, it can pull in unrelated system libraries. For example, the old install-epson-cn.sh used apt-get -f install, which pulled in Qt5, X11, and GL for a GUI utility. These libraries passed the allowlist and entered the manifest, allowing driver-remove to delete them and restore-drivers to overwrite them with stale copies on startup.
At build time, record all installed package names in baseline-packages.txt. The three scripts use that list to exclude files owned by image packages from recording, removal, and overwrite.
Load package names into a Bash associative array for O(1) lookup to avoid a grep subprocess for each of over two thousand .list files. Read only the baseline package's /var/lib/dpkg/info/*.list files. Multiarch manifests use <pkg>:<arch>.list, so strip :arch before matching. Intersect the paths with the driver manifest using comm -12 once, then use O(1) checks for individual paths.
Keep this ownership guard in all three scripts for the same reason as the path allowlist.
Generate
baseline-packages.txtafter all apt installations and retain it in the image layer. A file under/opt/cups-drivers/datawould be hidden by the volume mount, leaving only path filtering.Keep CUPS packages out of driver snapshots.
PKG_NAME_DENY_PATTERNSindriver-install.shcoverscups,cups-core-drivers,cups-ppdc,libcups*, and related names. The image builds CUPS 2.4.19 from source and overlays the tar archive in/usr. apt installscups-daemon,cups-client, andcups-filtersand omits thecupsmetapackage. Packages such asprinter-driver-gutenprintand the Konica deb depend on the metapackage. Resolving it through apt installs Debian'scups-core-driversand overwrites the compiled backends in/usr/lib/cups/backend/{usb,socket,lpd,...}and filters. The Konica installation once caused 564 CUPS files to be captured as driver files. Theinstall-*.shscripts usedpkg -i --force-dependsto avoid pulling in the metapackage. The denylist adds a second check.
AIO installer build scripts
Compiler-based scripts must register only one
trap _cleanup EXITbecause Bash keeps the last handler for each signal. In AIO mode use onlyapt-get cleanand keep/var/lib/apt/lists/*. See driver management for the single-trap contract.
Custom driver uploads
.ppd: Validate, install under/usr/share/cups/model/custom/, and write a restorable manifest..deb: Rundpkg -i. If it fails and dependencies are installed afterward, rundpkg -iagain. Archive the package undercustom-deb/packages/and register it inpackages.txt. On startup,restore-driversreinstalls packages idempotently withdpkg -i. Package maintainer scripts perform the real installation, so this path skips file manifests.- Restore automatically discovers older archived packages missing from the registry via glob.
- A broken package is retried on every startup. Remove the corresponding file from
./.drivers/custom-deb/packages/on the host to stop retrying.
- A
.debupload lets its maintainer scripts run as root in the container. The endpoint uses three layers of authorization, and the administrator password is equivalent to container root credentials. - Enforce the body size with
http.MaxBytesReader. The parameter toParseMultipartForm(n)limits memory, leaving the body size unrestricted.
See the custom driver upload documentation.
lpinfo detection and one-click setup
- Use the long format
lpinfo -l -vfor manufacturer and model. Add--timeoutand--include-schemesonly when supported. Use an independent timeout context, separate fromr.Context(). - Model precedence is
req.Manufacturer/Modelfrom lpinfo make-and-model, thendevice-idMFG/MDL, then the URI path. Place URI parsing last because USB URIs can report onlyHPor evenUnknownas the manufacturer. - PPD matching uses a scoring engine, with pure functions in
ppd_match.goand side effects inppd_query.go. Normalize model names, score tiers, apply source preference (custom > vendor > hplip > everywhere > foomatic > gutenprint > generic), add the cups-driverd fingerprint bonus, and stably sort the top N. GET /api/admin/drivers/ppdsreturns candidates without a background job or the driver-job lock. It has its own concurrency limit of four.setupprefers an explicitppdUri, theneverywherefor driverless printing, then the top candidate. Return an error if no candidate applies.lpadminwithout-mcreates a raw queue without a PPD. Pass-m everywhereexplicitly for IPP Everywhere. The lack of PPD settings on raw queues leavesmediaSourceSupportedempty in/api/printer-info, hiding the frontend tray selector.- Deduplicate queue names via
uniquePrinterNamewith suffixes-2through-50. Refuse to overwrite an existing queue with the same device URI. - After
lpadmin, verify withlpstat -pandlpoptions -l. If the PPD failed to apply, roll back anisNewqueue withlpadmin -x.
See driver management for parser details and failure cases.
๐ Container startup (entrypoint.sh)
- Restore driver snapshots with
restore-drivers. Reinstall archived.debpackages withdpkg -ifirst, then restore saved files withcp -a. - Set up the CUPS administrator and tzdata.
- Restore CUPS configuration from
/etc/cups-bak/when the volume is empty. Ensure existing volumes also havessl/andReadyPaperSizes. - Patch the HP 1020 PPD from Letter to A4 (issue #48).
- Upload HP host-based firmware in the background.
- Start dbus, avahi, and ipp-usb in the background. Failures here are nonfatal.
- Start cupsd and its watchdog.
- Wait for cupsd via
lpstat -r, up to 30 times at one-second intervals. - Set the HP 1020 queue's
media-default=A4in the background. - Use
exec /cups-webas PID 1.
Start
cupsd -fin the foreground inside the watchdog subshell.waitcan only wait for its own child processes. Moving startup outside the subshell causes a restart storm with status 127.
restore-driversmust alwaysexit 0. Best-effort restoration keeps the web UI available for recovery. It runsdpkg -iwithDEBIAN_FRONTEND=noninteractive,--force-confold, atimeout, and a temporarypolicy-rc.d.Keep both step 3 patches outside
if [ ! -f cupsd.conf ]. Existing./.etcvolumes with a configuration skip that restore block and still need new baseline additions.
lpadmin -o media=setsmedia-default, which step 9 uses to preselect A4 in the AirPrint UI. iPhone lists available sizes frommedia-ready, which cupsd computes from the intersection ofReadyPaperSizesand the PPD sizes.load_ppdinscheduler/printers.cis the only writer. Issue #82 is fixed byReadyPaperSizes A4,A3,A5,A6,EnvDLusing PPD sizes rather than PWG names such asiso_a4_210x297mm. Without that directive, the container's unsetLANGfalls back to the C locale, which yieldsLetter,Legal,Tabloid,4x6,Env10and omits A4.See container startup for the full design.
๐ง Development environment
Local setup
# Frontend
cd frontend && bun install && bun run dev # :5173, proxies /api to :8090
# Backend
go mod download
go build -o bin/cups-web ./cmd/server && ./bin/cups-web # :8080
Makefile
make all # Frontend dist followed by the Go binary
make frontend # Frontend only
make build # Backend only, preferred over a bare go build ./cmd/server
make docker-build # AIO image
make docker-build-web # Web-only image (cups-web:web)
Vite development proxy
/api proxies to http://localhost:8090. For local debugging, run LISTEN_ADDR=:8090 go run ./cmd/server for the backend and bun run dev for the frontend.
Frontend chunks
vue-vendor contains Vue and the router, ui-vendor contains nuxt-ui, reka-ui, and vueuse, and pdf-vendor contains pdfjs-dist.
๐ข Deployment
Docker Compose
The AIO Compose service is cups, with image: hanxi/cups-web:latest and network_mode: host for mDNS multicast. CUPS uses port 631 on the host and the web server uses LISTEN_ADDR, default :1180 (issue #107).
| Setting | Reason |
|---|---|
network_mode: host and hostname: CUPS |
mDNS/DNS-SD multicast (5353/UDP) requires host networking to discover LAN printers and advertise AirPrint (issue #107). avahi advertises CUPS.local. |
LISTEN_ADDR=:1180 |
With host networking, the web server listens directly on host port 1180, matching the former bridge setup. |
user: root |
cupsd, lpadmin, dpkg, and writes to system paths |
security_opt: [apparmor:unconfined] |
Works around AppArmor denials on PVE LXC (issue #91) |
./.etc:/etc/cups, ./.data:/data, and ./.uploads:/uploads |
Persist configuration, data, and uploads |
./.drivers:/opt/cups-drivers/data |
Persist driver snapshots across restarts |
./.scans:/scans with SCAN_DIR=/scans |
Persist scans (issue #111). Without the mount, scan records can outlive the files they reference. |
/dev/bus/usb:/dev/bus/usb with device_cgroup_rules |
USB hot-plugging (issue #81) |
/run/udev:/run/udev:ro |
Optional libusb device attributes |
Avoid mounting the host's
/run/dbus/system_bus_socket. The old AirPrint setup borrowed host avahi (issue #94), but if avahi was unavailable on the host, the mounted socket path prevented the container's own dbus-daemon and avahi from starting (issue #107). The container starts its own dbus and avahi on the host network.
Docker build
The seven stages are frontend-build (node:20-slim), java-builder (amd64 via BUILDPLATFORM), builder (golang:1.26), cups-builder (CUPS from source), document-runtime (shared conversion dependencies and fonts), web-runtime (Web-only), and runtime (default AIO). Build platforms are linux/amd64, arm64, and arm/v7. The Web-only stage skips cups-builder and avoids compiling CUPS.
Keep
ca-certificatesincups-builderfor wget TLS verification in CI.The Debian trixie
cups-daemonpackage (2.4.10) supplies/etc/cups/*.cups-compiled.tarfrom the source build contains only/usr, so take defaultcupsd.confLocation and Policy values from Debian. Files in/usr/lib/cups/**, including filters, backends, anddaemon/cups-driverd, come from compiled CUPS 2.4.19. Installingcups-core-driversvia apt overwrites those files with Debian's versions.Explicitly create
/etc/cups/ssl. In the source,cupsdCheckPermissionspassescreate_dir=0for this path. A failedlstatneither creates the directory nor returns an immediate error. The first IPPS handshake then reportsUnable to create server credentials. AirPrint clients prefer_ipps._tcp. Debian once supplied the empty directory as part ofcups-daemon. The Dockerfile and entrypoint now create it explicitly.See Docker builds for target dependencies, the three image architectures, and the writable HOME and LibreOffice profile requirements.
CI/CD
build-release.ymlcross-compiles for seven platforms. Tags matchingv*generate formal releases. Commits onmasterupdate the rolling prerelease taggeddev, which avoids a tag/branch naming conflict.docker-publish.ymlpublishes both targets for three architectures onmasteror tags matchingv*. AIO usesvX.Y.Z,latest, anddev. Web-only usesvX.Y.Z-web,latest-web, anddev-web. Both have the sameVERSION. The workflow begins with a Free disk space step.
Versioning
./bump-version.sh patch|minor|major
๐ฏ Common development tasks, debugging, and code style
See development conventions for templates covering new APIs, database changes, frontend pages, file types, and drivers, plus debugging commands, Go and Vue style, and Git commit rules.
Write commit messages in Chinese and omit
Co-Authored-Byand any AI attribution lines.
Maintainer: Hanxi ([email protected])