Increase supported image extensions

- Supports lower priority `<name>.preview.<extension>` preview names.
  - Note that this means that model names should not be of the format `<name>.preview`, else behavior may be unexpected.
- Removed use of splitext.
- Added checks for valid file type extensions.

- More conformal path accessing for `extension_uri` and `comfyui_model_uri`.
This commit is contained in:
Christian Bastian
2024-03-24 20:36:16 -04:00
parent 191d98565e
commit df8fb76f26
2 changed files with 137 additions and 89 deletions

View File

@@ -35,7 +35,21 @@ const modelNodeType = {
};
const MODEL_EXTENSIONS = [".bin", ".ckpt", ".onnx", ".pt", ".pth", ".safetensors"]; // TODO: ask server for?
const IMAGE_EXTENSIONS = [".apng", ".gif", ".jpeg", ".jpg", ".png", ".webp"]; // TODO: ask server for?
const IMAGE_EXTENSIONS = [
".png",
".webp",
".jpeg",
".jpg",
".gif",
".apng",
".preview.png",
".preview.webp",
".preview.jpeg",
".preview.jpg",
".preview.gif",
".preview.apng",
]; // TODO: /model-manager/image/extensions
class SearchPath {
/**
@@ -1413,7 +1427,7 @@ class ModelInfoView {
$: (el) => (this.elements.setPreviewButton = el),
textContent: "Set as Preview",
onclick: async(e) => {
const confirmation = window.confirm("Change preview image PERMANENTLY?");
const confirmation = window.confirm("Change preview image(s) PERMANENTLY?");
let updatedPreview = false;
if (confirmation) {
e.target.disabled = true;