Added button in settings to correct preview image extensions.
- Civitai in the past and present sends incorrect image extension information. (content type? content disposition?)
This commit is contained in:
@@ -628,6 +628,7 @@
|
||||
.model-manager .tag-generator-settings > div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 16px 0;
|
||||
@@ -635,7 +636,7 @@
|
||||
|
||||
.model-manager .model-manager-settings button {
|
||||
height: 40px;
|
||||
width: 120px;
|
||||
min-width: 120px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -3680,6 +3680,32 @@ class SettingsView {
|
||||
}).element;
|
||||
this.elements.saveButton = saveButton;
|
||||
|
||||
const correctPreviewsButton = new ComfyButton({
|
||||
content: "Fix Preview Extensions",
|
||||
tooltip: "Correct image extensions in all model directories",
|
||||
action: async(e) => {
|
||||
const [button, icon, span] = comfyButtonDisambiguate(e.target);
|
||||
button.disabled = true;
|
||||
const data = await request(
|
||||
"/model-manager/preview/correct-extensions")
|
||||
.catch((err) => {
|
||||
return { "success": false };
|
||||
});
|
||||
const success = data["success"];
|
||||
if (success) {
|
||||
const detectPlural = data["detected"] === 1 ? "" : "s";
|
||||
const correctPlural = data["corrected"] === 1 ? "" : "s";
|
||||
const message = `Detected ${data["detected"]} extension${detectPlural}.\nCorrected ${data["corrected"]} extension${correctPlural}.`;
|
||||
window.alert(message);
|
||||
}
|
||||
comfyButtonAlert(e.target, success);
|
||||
if (data["corrected"] > 0) {
|
||||
await this.reload(true);
|
||||
}
|
||||
button.disabled = false;
|
||||
},
|
||||
}).element;
|
||||
|
||||
$el("div.model-manager-settings", {
|
||||
$: (el) => (this.element = el),
|
||||
}, [
|
||||
@@ -3822,6 +3848,10 @@ class SettingsView {
|
||||
min: 1,
|
||||
}),
|
||||
]),
|
||||
$el("h2", ["Preview"]),
|
||||
$el("div", [
|
||||
correctPreviewsButton,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user