Files
PozzettiAndrea-ComfyUI-Geom…/javascript/js/utils/extensionFolder.js
T
PozzettiAndrea 414f759791 Vendor frontend JS into javascript/; drop the prestartup copy dance
The viewer JS/HTML/bundles are now committed in javascript/ (declared via
pyproject [tool.comfy] web = "javascript") instead of being copied from the
shared comfy-3d-viewers pip package at prestartup. Consequences:

- requirements.txt is now just comfy-env (host env installs nothing else,
  per the never-touch-the-host-env principle)
- prestartup_script.py no longer copies viewers or web_src; it keeps only
  setup_env() and the input-asset copies
- WEB_DIRECTORY attribute removed; the pyproject declaration is the single
  source (served at /extensions/comfyui-geometrypack/, keyed by project name)
- web_src/ deleted; its 6 widgets now live in javascript/js/ as the tracked
  source, edited directly
- viewer_pbr.html hardcoded-fallback URL updated to the new mount name

Iframe URLs auto-detect the mount from import.meta.url, so the folder rename
and mount-name change are transparent at runtime.
2026-08-12 17:37:09 +02:00

20 lines
636 B
JavaScript

/**
* Auto-detect extension folder name from import.meta.url
* Handles both ComfyUI-GeometryPack and comfyui-geometrypack (lowercase)
*/
export const EXTENSION_FOLDER = (() => {
const url = import.meta.url;
const match = url.match(/\/extensions\/([^/]+)\//);
return match ? match[1] : "ComfyUI-GeometryPack";
})();
/**
* Build a viewer URL with cache buster
* @param {string} viewerName - Name of the viewer HTML file (e.g., "viewer_vtk")
* @returns {string} Full URL with cache buster
*/
export function getViewerUrl(viewerName) {
return `/extensions/${EXTENSION_FOLDER}/${viewerName}.html?v=` + Date.now();
}