- Replaced all instances of the placeholder image path from "/static/images/placeholder.jpg" to "/static/images/replaceable_template_image.png". - Added a new Nginx location block for serving app data with a long cache expiration. - Enhanced the image generation service to return the new template image when generation fails. - Updated various services and endpoints to ensure consistent handling of asset paths, including resolving backend asset URLs. - Removed Electron-specific checks from several components to streamline API calls and improve compatibility with web deployments. - Improved error handling and logging in the PDF export process. - Adjusted Next.js configuration for API routing to ensure proper asset serving in Docker environments.
21 lines
739 B
Python
21 lines
739 B
Python
"""Paths relative to the FastAPI process working directory (Docker / local dev).
|
|
|
|
The API is always started with cwd set to the `servers/fastapi` package root
|
|
(see start.js), without OS-specific layout handling.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
|
|
def get_resource_path(relative_path: str) -> str:
|
|
"""Absolute path to bundled read-only assets (e.g. ``static/``, ``assets/``)."""
|
|
return os.path.abspath(os.path.join(os.getcwd(), relative_path))
|
|
|
|
|
|
def get_writable_path(relative_path: str) -> str:
|
|
"""Absolute path under cwd for caches and generated files; ensures the directory exists."""
|
|
path = os.path.abspath(os.path.join(os.getcwd(), relative_path))
|
|
os.makedirs(path, exist_ok=True)
|
|
return path
|