comfylib

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

README

comfylib

Shared Go packages, styles and tools for the Comfyware apps: Folkweave, Imvault, Songstead, Tidings and Witmoot.

The core module uses only the Go standard library. Each app pins an exact version. The optional oidc module is versioned separately and carries its own dependencies.

Build with Go 1.26.11 or later on 1.26, or Go 1.27.4 or later on 1.27.

Packages

Package What it does
admin Renders the owner metrics dashboard and one account's sign-in state. Apps supply queries and access checks.
analytics Counts requests, response times and security events per day and route. See site health metrics.
analytics/analyticstest Checks the analytics storage against an app's SQLite driver.
autobackup Schedules compressed private snapshots with bounded retention.
brandimage Bounds uploaded PNG, JPEG and GIF branding images and converts them to PNG.
clientip Finds the client address and scheme behind trusted proxies.
displaytime Validates and formats saved account timezones. See display time.
invitation Reports whether an invitation is open, revoked, expired or used up.
keyfile Loads a key from its own file and creates it atomically on first use.
memberprofile Validates optional names, bios and profile links.
oidc Separate module: OpenID Connect sign-in for existing local accounts.
password Reads confirmed passwords from a hidden prompt, stdin or a private file.
privdrop Re-runs admin commands as the service account instead of root.
problem Writes plain-language error pages inside the app's layout, or JSON for API requests.
profileimage Bounds account pictures and makes still and animated versions.
proxyconfig Prints a checked Caddy, nginx or Apache site configuration.
proxyconfig/proxytest Runs those configurations in real nginx and Apache servers.
ratelimit Bounded in-memory token buckets and fixed windows.
reference Validates web addresses and prepares Witmoot discussion drafts.
sandbox Confines a service and its children with Bubblewrap.
setup Serves the first-owner setup page. See setup.
smtp Sends transactional mail through a relay that must use TLS.
suite App navigation, linked sign-in and discussion returns. See suite.
svcconfig Reads a service's settings the way OpenRC or systemd passes them. See configuration.
token Mints tokens, hashes them for storage and compares them in constant time.
ui Shared styles, palettes, theme picker and browser scripts, plus Size for user-facing byte counts. See theming.
ui/uitest Browser checks for app test suites. Not served by ui.Assets().

Shared UI

Serve ui.Assets() at /static/comfyware/. Load accounts.css, components.css and, for palettes, palettes.css after the app stylesheet. Load theme.js and suite.js in <head> without defer. Theming lists the tokens and palettes.

Checks

make check runs formatting, vet, cyclomatic complexity, golangci-lint, race tests, browser helper tests and every mutation table in mutations/. make test-sandbox needs bwrap, make test-proxies needs nginx and Apache, and make fuzz-smoke runs each fuzz target briefly.

Apps run tools/mutate.py and the other tools straight from the pinned module through scripts/comfy.py. See suite maintenance.

Developing alongside an app

Use a go.work file in the app's worktree:

go work init . ../comfylib

Never commit a go.work file or a replace directive in an app. Release builds resolve comfylib through the Go module proxy.

Releases

See release notes.

Licensed under AGPL-3.0-or-later. See LICENSE.

Documentation

Overview

Package comfylib holds the code the Comfyware apps share: Folkweave, Imvault, Songstead, Tidings and Witmoot. Each subpackage uses only the standard library and never imports app code. See README.md for the list.

Directories

Path Synopsis
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
Package analytics keeps daily site health and security counts in an application's SQLite database: requests, status classes, response times and bytes per route pattern, plus failed sign-ins, rate-limited attempts and rejected tokens.
Package analytics keeps daily site health and security counts in an application's SQLite database: requests, status classes, response times and bytes per route pattern, plus failed sign-ins, rate-limited attempts and rejected tokens.
analyticstest
Package analyticstest checks the analytics storage against an application's own SQLite driver.
Package analyticstest checks the analytics storage against an application's own SQLite driver.
Package autobackup schedules compressed private snapshots.
Package autobackup schedules compressed private snapshots.
Package brandimage validates small uploaded PNG, JPEG and GIF images and converts them to a single PNG without metadata or animation.
Package brandimage validates small uploaded PNG, JPEG and GIF images and converts them to a single PNG without metadata or animation.
Package clientip finds the client address behind trusted reverse proxies.
Package clientip finds the client address behind trusted reverse proxies.
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
displaytimetest
SPDX-License-Identifier: AGPL-3.0-or-later Package displaytimetest checks timezone storage against an app's own SQLite driver.
SPDX-License-Identifier: AGPL-3.0-or-later Package displaytimetest checks timezone storage against an app's own SQLite driver.
Package invitation reports whether an invitation is open, revoked, expired or used up.
Package invitation reports whether an invitation is open, revoked, expired or used up.
Package keyfile keeps a random key in its own file and creates it on first use.
Package keyfile keeps a random key in its own file and creates it on first use.
Package memberprofile validates optional plain-text names, bios and links.
Package memberprofile validates optional plain-text names, bios and links.
oidc module
Package password reads a password twice and checks that both match.
Package password reads a password twice and checks that both match.
Package privdrop re-runs an admin command as the service account when it is started as root, for example with sudo, so it never leaves root-owned files the service cannot read.
Package privdrop re-runs an admin command as the service account when it is started as root, for example with sudo, so it never leaves root-owned files the service cannot read.
SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-License-Identifier: AGPL-3.0-or-later
Package profileimage bounds account pictures and makes a still version and, for GIFs, a bounded animated version.
Package profileimage bounds account pictures and makes a still version and, for GIFs, a bounded animated version.
Package proxyconfig prints a reverse-proxy site configuration from the examples an app ships, passed in as an fs.FS.
Package proxyconfig prints a reverse-proxy site configuration from the examples an app ships, passed in as an fs.FS.
proxytest
Package proxytest runs an app's generated nginx and Apache configurations in real servers and checks what reaches the app through them.
Package proxytest runs an app's generated nginx and Apache configurations in real servers and checks what reaches the app through them.
Package ratelimit provides in-memory token buckets (Limiter) and fixed windows (Window), keyed by any string such as an account or address.
Package ratelimit provides in-memory token buckets (Limiter) and fixed windows (Window), keyed by any string such as an account or address.
Package reference validates web addresses and prepares Witmoot discussion drafts for the browser.
Package reference validates web addresses and prepares Witmoot discussion drafts for the browser.
Package sandbox runs a process under an explicit Bubblewrap policy.
Package sandbox runs a process under an explicit Bubblewrap policy.
Package setup serves the first-owner setup page, protected by a key only the host can read.
Package setup serves the first-owner setup page, protected by a key only the host can read.
Package smtp sends transactional mail, such as password reset links, through an SMTP relay.
Package smtp sends transactional mail, such as password reset links, through an SMTP relay.
Package suite provides navigation between Comfyware apps, linked OpenID Connect sign-in and Witmoot discussion returns.
Package suite provides navigation between Comfyware apps, linked OpenID Connect sign-in and Witmoot discussion returns.
Package svcconfig reads a service's settings the way OpenRC conf.d files or systemd units (with drop-ins, Environment= and EnvironmentFile=) pass them, so a command run by hand acts on the same instance as the service.
Package svcconfig reads a service's settings the way OpenRC conf.d files or systemd units (with drop-ins, Environment= and EnvironmentFile=) pass them, so a command run by hand acts on the same instance as the service.
Package token mints random tokens and stores only their digests.
Package token mints random tokens and stores only their digests.
Package ui serves the shared Comfyware styles, palettes and browser scripts, and validates palette names.
Package ui serves the shared Comfyware styles, palettes and browser scripts, and validates palette names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL