A trigger->replacement library (core/shortcuts.py, a close port of v4's apply_prompt_shortcuts/resolve_variables), a Settings section to manage it, autocomplete on the real prompt textarea (composer.autocomplete.default, so it outranks the Constructor modal it lives inside), and a stateless /api/prompt/expand that combines anchor + shortcuts + $variables + postfix at the moment a run is queued -- scene.text itself stays exactly what was typed. Project gained anchor/postfix/variables editing UI on its own tab. Along the way: a real layout bug in the Properties column (every composer stack can flex-shrink below its own content, and once the Project tab grew past a couple of rows the column started squeezing its own children's content into each other and, at the outer level, into the sibling Generation section below) -- fixed with flex-shrink:0 at each level that needs it, caught by a Playwright regression test.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""Paths and constants. No logic, no imports from the rest of core."""
|
|
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
APP_DIR = ROOT / "app"
|
|
MODULES_DIR = ROOT / "modules"
|
|
|
|
UI_PREFIX = "/funpack"
|
|
|
|
# Extension allowlists per served root. These are rule 1 ("a module never styles
|
|
# anything") enforced at the transport layer: a .css inside modules/ is a 404, so
|
|
# a module cannot ship a stylesheet even if someone writes one.
|
|
APP_EXTS = frozenset({".js", ".css", ".html", ".woff2", ".svg"})
|
|
MODULE_EXTS = frozenset({".js"})
|
|
|
|
# Where projects are kept. Inside the pack rather than ComfyUI's output tree: a
|
|
# project is FunPack's own state, and clearing outputs must not take a user's
|
|
# edits with it.
|
|
PROJECTS_DIR = ROOT / "projects"
|
|
|
|
# Uploaded media (reference images, imported clips) -- FunPack's own state for
|
|
# the same reason PROJECTS_DIR is: clearing ComfyUI's output tree must not take
|
|
# something the user deliberately imported with it.
|
|
MEDIA_DIR = ROOT / "media"
|
|
|
|
# The shortcut library: trigger -> replacement text. Global, not per-project --
|
|
# a shortcut is reused across every project, not redefined in each one, so it
|
|
# lives beside PROJECTS_DIR rather than inside any one project file.
|
|
SHORTCUTS_FILE = ROOT / "shortcuts.json"
|