`;
+ newRow.classList.add('plugin-container')
+ //console.log(plugin.id, plugin.localInstallOnly)
+ pluginsTable.appendChild(newRow)
+ const pluginManualInstall = pluginsTable.querySelector('#plugin-' + plugin.id + '-install')
+ updateManualInstallButtonCaption()
+
+ // checkbox event handler
+ const pluginToggle = pluginsTable.querySelector('#plugin-' + plugin.id)
+ if (pluginToggle !== null) {
+ pluginToggle.checked = plugin.enabled // set initial state of checkbox
+ pluginToggle.addEventListener('change', async () => {
+ const container = pluginToggle.closest(".plugin-container");
+ const warningElement = container.querySelector(".plugin-warning");
+
+ // if the plugin got enabled, download the plugin's code
+ plugin.enabled = pluginToggle.checked
+ if (plugin.enabled) {
+ const pluginSource = await getDocument(plugin.url);
+ if (pluginSource !== null) {
+ // Store the current scroll position before navigating away
+ const currentPosition = window.pageYOffset;
+ initPluginTable(plugins)
+ // When returning to the page, set the scroll position to the stored value
+ window.scrollTo(0, currentPosition);
+ warningElement?.classList.remove("hide");
+ plugin.code = pluginSource
+ loadPlugins([plugin])
+ console.log(`Plugin ${plugin.name} installed`);
+ showPluginToast("Plugin " + plugin.name + " installed");
+ }
+ else {
+ plugin.enabled = false
+ pluginToggle.checked = false
+ console.error(`Couldn't download plugin ${plugin.name}`);
+ showPluginToast("Failed to install " + plugin.name + " (Couldn't fetch " + extractFilename(plugin.url) + ")", 5000, true);
+ }
+ } else {
+ warningElement?.classList.add("hide");
+ // Store the current scroll position before navigating away
+ const currentPosition = window.pageYOffset;
+ initPluginTable(plugins)
+ // When returning to the page, set the scroll position to the stored value
+ window.scrollTo(0, currentPosition);
+ console.log(`Plugin ${plugin.name} uninstalled`);
+ showPluginToast("Plugin " + plugin.name + " uninstalled");
+ }
+ await setStorageData('plugins', JSON.stringify(plugins))
+ })
+ }
+
+ // manual install event handler
+ if (pluginManualInstall !== null) {
+ pluginManualInstall.addEventListener('click', async () => {
+ pluginDialogOpenDialog(inputOK, inputCancel)
+ pluginDialogTextarea.value = plugin.code ? plugin.code : ''
+ pluginDialogTextarea.select()
+ pluginDialogTextarea.focus()
+ })
+ }
+ // Dialog OK
+ async function inputOK() {
+ let pluginSource = pluginDialogTextarea.value
+ // remove empty lines and trim existing lines
+ plugin.code = pluginSource
+ if (pluginSource.trim() !== '') {
+ plugin.enabled = true
+ console.log(`Plugin ${plugin.name} installed`);
+ showPluginToast("Plugin " + plugin.name + " installed");
+ }
+ else {
+ plugin.enabled = false
+ console.log(`No code provided for plugin ${plugin.name}, disabling the plugin`);
+ showPluginToast("No code provided for plugin " + plugin.name + ", disabling the plugin");
+ }
+ updateManualInstallButtonCaption()
+ await setStorageData('plugins', JSON.stringify(plugins))
+ }
+ // Dialog Cancel
+ async function inputCancel() {
+ plugin.enabled = false
+ console.log(`Installation of plugin ${plugin.name} cancelled`);
+ showPluginToast("Cancelled installation of " + plugin.name);
+ }
+ // update button caption
+ function updateManualInstallButtonCaption() {
+ if (pluginManualInstall !== null) {
+ pluginManualInstall.innerHTML = plugin.code === undefined || plugin.code.trim() === '' ? 'Install' : 'Edit'
+ }
+ }
+ })
+ prettifyInputs(pluginsTable)
+ filterPlugins()
+}
+
+/* version management. Thanks Madrang! */
+const parseVersion = function (versionString, options = {}) {
+ if (typeof versionString === "undefined") {
+ throw new Error("versionString is undefined.");
+ }
+ if (typeof versionString !== "string") {
+ throw new Error("versionString is not a string.");
+ }
+ const lexicographical = options && options.lexicographical;
+ const zeroExtend = options && options.zeroExtend;
+ let versionParts = versionString.split('.');
+ function isValidPart(x) {
+ const re = (lexicographical ? /^\d+[A-Za-z]*$/ : /^\d+$/);
+ return re.test(x);
+ }
+
+ if (!versionParts.every(isValidPart)) {
+ throw new Error("Version string is invalid.");
+ }
+
+ if (zeroExtend) {
+ while (versionParts.length < 4) {
+ versionParts.push("0");
+ }
+ }
+ if (!lexicographical) {
+ versionParts = versionParts.map(Number);
+ }
+ return versionParts;
+};
+
+const versionCompare = function (v1, v2, options = {}) {
+ if (typeof v1 == "undefined") {
+ throw new Error("vi is undefined.");
+ }
+ if (typeof v2 === "undefined") {
+ throw new Error("v2 is undefined.");
+ }
+
+ let v1parts;
+ if (typeof v1 === "string") {
+ v1parts = parseVersion(v1, options);
+ } else if (Array.isArray(v1)) {
+ v1parts = [...v1];
+ if (!v1parts.every(p => typeof p === "number" && p !== NaN)) {
+ throw new Error("v1 part array does not only contains numbers.");
+ }
+ } else {
+ throw new Error("v1 is of an unexpected type: " + typeof v1);
+ }
+
+ let v2parts;
+ if (typeof v2 === "string") {
+ v2parts = parseVersion(v2, options);
+ } else if (Array.isArray(v2)) {
+ v2parts = [...v2];
+ if (!v2parts.every(p => typeof p === "number" && p !== NaN)) {
+ throw new Error("v2 part array does not only contains numbers.");
+ }
+ } else {
+ throw new Error("v2 is of an unexpected type: " + typeof v2);
+ }
+
+ while (v1parts.length < v2parts.length) {
+ v1parts.push("0");
+ }
+ while (v2parts.length < v1parts.length) {
+ v2parts.push("0");
+ }
+
+ for (let i = 0; i < v1parts.length; ++i) {
+ if (v2parts.length == i) {
+ return 1;
+ }
+ if (v1parts[i] == v2parts[i]) {
+ continue;
+ } else if (v1parts[i] > v2parts[i]) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+};
+
+function filterPluginsByMinEDVersion(plugins, EDVersion) {
+ const filteredPlugins = plugins.filter(plugin => {
+ if (plugin.minEDVersion) {
+ return versionCompare(plugin.minEDVersion, EDVersion) <= 0;
+ }
+ return true;
+ });
+
+ return filteredPlugins;
+}
+
+function extractVersionNumber(elem) {
+ const versionStr = elem.innerHTML;
+ const regex = /v(\d+\.\d+\.\d+)/;
+ const matches = regex.exec(versionStr);
+ if (matches && matches.length > 1) {
+ return matches[1];
+ } else {
+ return null;
+ }
+}
+const EasyDiffusionVersion = extractVersionNumber(document.querySelector('#top-nav > #logo'))
+
+/* PLUGIN MANAGEMENT */
+let plugins
+let localPlugins
+let initPluginsInProgress = false
+
+async function initPlugins(refreshPlugins = false) {
+ let pluginsLoaded
+ if (initPluginsInProgress === true) {
+ return
+ }
+ initPluginsInProgress = true
+
+ const res = await fetch('/get/ui_plugins')
+ if (!res.ok) {
+ console.error(`Error HTTP${res.status} while loading plugins list. - ${res.statusText}`)
+ }
+ else {
+ localPlugins = await res.json()
+ }
+
+ if (refreshPlugins === false) {
+ // load the notifications
+ pluginNotifications = await getStorageData('notifications')
+ if (typeof pluginNotifications === "string") {
+ try {
+ pluginNotifications = JSON.parse(pluginNotifications)
+ } catch (e) {
+ console.error("Failed to parse pluginNotifications", e);
+ pluginNotifications = {};
+ pluginNotifications.entries = [];
+ }
+ }
+ if (pluginNotifications !== undefined) {
+ if (pluginNotifications.entries && pluginNotifications.entries.length > 0 && pluginNotifications.entries[0].date && pluginNotifications.lastUpdated <= pluginNotifications.entries[0].date) {
+ notificationPill.style.display = "block";
+ }
+ } else {
+ pluginNotifications = {};
+ pluginNotifications.entries = [];
+ }
+
+ // try and load plugins from local cache
+ plugins = await getStorageData('plugins')
+ if (plugins !== undefined) {
+ plugins = JSON.parse(plugins)
+
+ // remove duplicate entries if any (should not happen)
+ plugins = deduplicatePluginsById(plugins)
+
+ // remove plugins that don't meet the min ED version requirement
+ plugins = filterPluginsByMinEDVersion(plugins, EasyDiffusionVersion)
+
+ // remove from plugins the entries that don't have mandatory fields (id, name, url)
+ plugins = plugins.filter((plugin) => { return plugin.id !== '' && plugin.name !== '' && plugin.url !== ''; });
+
+ // populate the table
+ initPluginTable(plugins)
+ await loadPlugins(plugins)
+ pluginsLoaded = true
+ }
+ else {
+ plugins = []
+ pluginsLoaded = false
+ }
+ }
+
+ // update plugins asynchronously (updated versions will be available next time the UI is loaded)
+ if (refreshAllowed()) {
+ let pluginCatalog = await getDocument(PLUGIN_CATALOG)
+ if (pluginCatalog !== null) {
+ let parseError = false;
+ try {
+ pluginCatalog = JSON.parse(pluginCatalog);
+ console.log('Plugin catalog successfully downloaded');
+ } catch (error) {
+ console.error('Error parsing plugin catalog:', error);
+ parseError = true;
+ }
+
+ if (!parseError) {
+ await downloadPlugins(pluginCatalog, plugins, refreshPlugins)
+
+ // update compatIssueIds
+ updateCompatIssueIds()
+
+ // remove plugins that don't meet the min ED version requirement
+ plugins = filterPluginsByMinEDVersion(plugins, EasyDiffusionVersion)
+
+ // remove from plugins the entries that don't have mandatory fields (id, name, url)
+ plugins = plugins.filter((plugin) => { return plugin.id !== '' && plugin.name !== '' && plugin.url !== ''; });
+
+ // remove from plugins the entries that no longer exist in the catalog
+ plugins = plugins.filter((plugin) => { return pluginCatalog.some((p) => p.id === plugin.id) });
+
+ if (pluginCatalog.length > plugins.length) {
+ const newPlugins = pluginCatalog.filter((plugin) => {
+ return !plugins.some((p) => p.id === plugin.id);
+ });
+
+ newPlugins.forEach((plugin, index) => {
+ setTimeout(() => {
+ showPluginToast(`New plugin "${plugin.name}" is available.`);
+ }, (index + 1) * 1000);
+ });
+ }
+
+ let pluginsJson;
+ try {
+ pluginsJson = JSON.stringify(plugins); // attempt to parse plugins to JSON
+ } catch (error) {
+ console.error('Error converting plugins to JSON:', error);
+ }
+
+ if (pluginsJson) { // only store the data if pluginsJson is not null or undefined
+ await setStorageData('plugins', pluginsJson)
+ }
+
+ // refresh the display of the plugins table
+ initPluginTable(plugins)
+ if (pluginsLoaded && pluginsLoaded === false) {
+ loadPlugins(plugins)
+ }
+ }
+ }
+ }
+ else {
+ if (refreshPlugins) {
+ showPluginToast('Plugins have been refreshed recently, refresh will be available in ' + convertSeconds(getTimeUntilNextRefresh()), 5000, true, false)
+ }
+ }
+ initPluginsInProgress = false
+}
+
+function updateMetaTagPlugins(plugin) {
+ // Update the meta tag with the list of loaded plugins
+ let metaTag = document.querySelector('meta[name="plugins"]');
+ if (metaTag === null) {
+ metaTag = document.createElement('meta');
+ metaTag.name = 'plugins';
+ document.head.appendChild(metaTag);
+ }
+ const pluginArray = [...(metaTag.content ? metaTag.content.split(',') : []), plugin.id];
+ metaTag.content = pluginArray.join(',');
+}
+
+function updateCompatIssueIds() {
+ // Loop through each plugin
+ plugins.forEach(plugin => {
+ // Check if the plugin has `compatIssueIds` property
+ if (plugin.compatIssueIds !== undefined) {
+ // Loop through each of the `compatIssueIds`
+ plugin.compatIssueIds.forEach(issueId => {
+ // Find the plugin with the corresponding `issueId`
+ const issuePlugin = plugins.find(p => p.id === issueId);
+ // If the corresponding plugin is found, initialize its `compatIssueIds` property with an empty array if it's undefined
+ if (issuePlugin) {
+ if (issuePlugin.compatIssueIds === undefined) {
+ issuePlugin.compatIssueIds = [];
+ }
+ // If the current plugin's ID is not already in the `compatIssueIds` array, add it
+ if (!issuePlugin.compatIssueIds.includes(plugin.id)) {
+ issuePlugin.compatIssueIds.push(plugin.id);
+ }
+ }
+ });
+ } else {
+ // If the plugin doesn't have `compatIssueIds` property, initialize it with an empty array
+ plugin.compatIssueIds = [];
+ }
+ });
+}
+
+function deduplicatePluginsById(plugins) {
+ const seenIds = new Set();
+ const deduplicatedPlugins = [];
+
+ for (const plugin of plugins) {
+ if (!seenIds.has(plugin.id)) {
+ seenIds.add(plugin.id);
+ deduplicatedPlugins.push(plugin);
+ } else {
+ // favor dupes that have enabled == true
+ const index = deduplicatedPlugins.findIndex(p => p.id === plugin.id);
+ if (index >= 0) {
+ if (plugin.enabled) {
+ deduplicatedPlugins[index] = plugin;
+ }
+ }
+ }
+ }
+
+ return deduplicatedPlugins;
+}
+
+async function loadPlugins(plugins) {
+ for (let i = 0; i < plugins.length; i++) {
+ const plugin = plugins[i];
+ if (plugin.enabled === true && plugin.localInstallOnly !== true) {
+ const localPluginFound = checkFileNameInArray(localPlugins, plugin.url);
+ if (!localPluginFound) {
+ try {
+ // Indirect eval to work around sloppy plugin implementations
+ const indirectEval = { eval };
+ console.log("Loading plugin " + plugin.name);
+ indirectEval.eval(plugin.code);
+ console.log("Plugin " + plugin.name + " loaded");
+ await updateMetaTagPlugins(plugin); // add plugin to the meta tag
+ } catch (err) {
+ showPluginToast("Error loading plugin " + plugin.name + " (" + err.message + ")", null, true);
+ console.error("Error loading plugin " + plugin.name + ": " + err.message);
+ }
+ } else {
+ console.log("Skipping plugin " + plugin.name + " (installed locally)");
+ }
+ }
+ }
+}
+
+async function getFileHash(url) {
+ const regex = /^https:\/\/raw\.githubusercontent\.com\/(?[^/]+)\/(?[^/]+)\/(?[^/]+)\/(?.+)$/;
+ const match = url.match(regex);
+ if (!match) {
+ console.error('Invalid GitHub repository URL.');
+ return Promise.resolve(null);
+ }
+ const owner = match.groups.owner;
+ const repo = match.groups.repo;
+ const branch = match.groups.branch;
+ const filePath = match.groups.filePath;
+ const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${filePath}?ref=${branch}`;
+
+ try {
+ const response = await fetch(apiUrl);
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}, url: ${apiUrl}`);
+ }
+ const data = await response.json();
+ return data.sha;
+ } catch (error) {
+ console.error('Error fetching data from url:', apiUrl, 'Error:', error);
+ return null;
+ }
+}
+
+// only allow two refresh per hour
+function getTimeUntilNextRefresh() {
+ const lastRuns = JSON.parse(localStorage.getItem('lastRuns') || '[]');
+ const currentTime = new Date().getTime();
+ const numRunsLast60Min = lastRuns.filter(run => currentTime - run <= 60 * 60 * 1000).length;
+
+ if (numRunsLast60Min >= 2) {
+ return 3600 - Math.round((currentTime - lastRuns[lastRuns.length - 1]) / 1000);
+ }
+
+ return 0;
+}
+
+function refreshAllowed() {
+ const timeUntilNextRefresh = getTimeUntilNextRefresh();
+
+ if (timeUntilNextRefresh > 0) {
+ console.log(`Next refresh available in ${timeUntilNextRefresh} seconds`);
+ return false;
+ }
+
+ const lastRuns = JSON.parse(localStorage.getItem('lastRuns') || '[]');
+ const currentTime = new Date().getTime();
+ lastRuns.push(currentTime);
+ localStorage.setItem('lastRuns', JSON.stringify(lastRuns));
+ return true;
+}
+
+async function downloadPlugins(pluginCatalog, plugins, refreshPlugins) {
+ // download the plugins as needed
+ for (const plugin of pluginCatalog) {
+ //console.log(plugin.id, plugin.url)
+ const existingPlugin = plugins.find(p => p.id === plugin.id);
+ // get the file hash in the GitHub repo
+ let sha
+ if (isGitHub(plugin.url) && existingPlugin?.enabled === true) {
+ sha = await getFileHash(plugin.url)
+ }
+ if (plugin.localInstallOnly !== true && isGitHub(plugin.url) && existingPlugin?.enabled === true && (refreshPlugins || (existingPlugin.sha !== undefined && existingPlugin.sha !== null && existingPlugin.sha !== sha) || existingPlugin?.code === undefined)) {
+ const pluginSource = await getDocument(plugin.url);
+ if (pluginSource !== null && pluginSource !== existingPlugin.code) {
+ console.log(`Plugin ${plugin.name} updated`);
+ showPluginToast("Plugin " + plugin.name + " updated", 5000);
+ // Update the corresponding plugin
+ const updatedPlugin = {
+ ...existingPlugin,
+ icon: plugin.icon ? plugin.icon : "fa-puzzle-piece",
+ id: plugin.id,
+ name: plugin.name,
+ description: plugin.description,
+ url: plugin.url,
+ localInstallOnly: Boolean(plugin.localInstallOnly),
+ version: plugin.version,
+ code: pluginSource,
+ author: plugin.author,
+ sha: sha,
+ compatIssueIds: plugin.compatIssueIds
+ };
+ // Replace the old plugin in the plugins array
+ const pluginIndex = plugins.indexOf(existingPlugin);
+ if (pluginIndex >= 0) {
+ plugins.splice(pluginIndex, 1, updatedPlugin);
+ } else {
+ plugins.push(updatedPlugin);
+ }
+ }
+ }
+ else if (existingPlugin !== undefined) {
+ // Update the corresponding plugin's metadata
+ const updatedPlugin = {
+ ...existingPlugin,
+ icon: plugin.icon ? plugin.icon : "fa-puzzle-piece",
+ id: plugin.id,
+ name: plugin.name,
+ description: plugin.description,
+ url: plugin.url,
+ localInstallOnly: Boolean(plugin.localInstallOnly),
+ version: plugin.version,
+ author: plugin.author,
+ compatIssueIds: plugin.compatIssueIds
+ };
+ // Replace the old plugin in the plugins array
+ const pluginIndex = plugins.indexOf(existingPlugin);
+ plugins.splice(pluginIndex, 1, updatedPlugin);
+ }
+ else {
+ plugins.push(plugin);
+ }
+ }
+}
+
+async function getDocument(url) {
+ try {
+ let response = await fetch(url === PLUGIN_CATALOG ? PLUGIN_CATALOG : url, { cache: "no-cache" });
+ if (!response.ok) {
+ throw new Error(`Response error: ${response.status} ${response.statusText}`);
+ }
+ let document = await response.text();
+ return document;
+ } catch (error) {
+ showPluginToast("Couldn't fetch " + extractFilename(url) + " (" + error + ")", null, true);
+ console.error(error);
+ return null;
+ }
+}
+
+/* MODAL DIALOG */
+const pluginDialogDialog = document.createElement("div");
+pluginDialogDialog.id = "pluginDialog-input-dialog";
+pluginDialogDialog.style.display = "none";
+
+pluginDialogDialog.innerHTML = `
+
+
+
+
Paste the plugin's code here
+
+
+
+
+
+
+
+
+
+
+`;
+
+document.body.appendChild(pluginDialogDialog);
+
+const pluginDialogOverlay = document.querySelector(".pluginDialog-dialog-overlay");
+const pluginDialogOkButton = document.getElementById("pluginDialog-input-ok");
+const pluginDialogCancelButton = document.getElementById("pluginDialog-input-cancel");
+const pluginDialogCloseButton = document.querySelector(".pluginDialog-dialog-close-button");
+const pluginDialogTextarea = document.getElementById("pluginDialog-input-textarea");
+let callbackOK
+let callbackCancel
+
+function pluginDialogOpenDialog(inputOK, inputCancel) {
+ pluginDialogDialog.style.display = "block";
+ callbackOK = inputOK
+ callbackCancel = inputCancel
+}
+
+function pluginDialogCloseDialog() {
+ pluginDialogDialog.style.display = "none";
+}
+
+function pluginDialogHandleOkClick() {
+ const userInput = pluginDialogTextarea.value;
+ // Do something with the user input
+ callbackOK()
+ pluginDialogCloseDialog();
+}
+
+function pluginDialogHandleCancelClick() {
+ callbackCancel()
+ pluginDialogCloseDialog();
+}
+
+function pluginDialogHandleOverlayClick(event) {
+ if (event.target === pluginDialogOverlay) {
+ pluginDialogCloseDialog();
+ }
+}
+
+function pluginDialogHandleKeyDown(event) {
+ if ((event.key === "Enter" && event.ctrlKey) || event.key === "Escape") {
+ event.preventDefault();
+ if (event.key === "Enter" && event.ctrlKey) {
+ pluginDialogHandleOkClick();
+ } else {
+ pluginDialogCloseDialog();
+ }
+ }
+}
+
+pluginDialogTextarea.addEventListener("keydown", pluginDialogHandleKeyDown);
+pluginDialogOkButton.addEventListener("click", pluginDialogHandleOkClick);
+pluginDialogCancelButton.addEventListener("click", pluginDialogHandleCancelClick);
+pluginDialogCloseButton.addEventListener("click", pluginDialogCloseDialog);
+pluginDialogOverlay.addEventListener("click", pluginDialogHandleOverlayClick);
diff --git a/ui/media/js/utils.js b/ui/media/js/utils.js
index d1578d8e..324600f2 100644
--- a/ui/media/js/utils.js
+++ b/ui/media/js/utils.js
@@ -841,6 +841,7 @@ function createTab(request) {
})
}
+
/* TOAST NOTIFICATIONS */
function showToast(message, duration = 5000, error = false) {
const toast = document.createElement("div");
@@ -897,3 +898,130 @@ function showToast(message, duration = 5000, error = false) {
// Remove the toast after specified duration
setTimeout(removeToast, duration);
}
+
+
+/* STORAGE MANAGEMENT */
+// Request persistent storage
+async function requestPersistentStorage() {
+ if (navigator.storage && navigator.storage.persist) {
+ const isPersisted = await navigator.storage.persist();
+ console.log(`Persisted storage granted: ${isPersisted}`);
+ }
+}
+requestPersistentStorage()
+
+// Open a database
+async function openDB() {
+ return new Promise((resolve, reject) => {
+ let request = indexedDB.open("EasyDiffusionSettingsDatabase", 1);
+ request.addEventListener("upgradeneeded", function () {
+ let db = request.result;
+ db.createObjectStore("EasyDiffusionSettings", { keyPath: "id" });
+ });
+ request.addEventListener("success", function () {
+ resolve(request.result);
+ });
+ request.addEventListener("error", function () {
+ reject(request.error);
+ });
+ });
+}
+
+// Function to write data to the object store
+async function setStorageData(key, value) {
+ return openDB().then(db => {
+ let tx = db.transaction("EasyDiffusionSettings", "readwrite");
+ let store = tx.objectStore("EasyDiffusionSettings");
+ let data = { id: key, value: value };
+ return new Promise((resolve, reject) => {
+ let request = store.put(data);
+ request.addEventListener("success", function () {
+ resolve(request.result);
+ });
+ request.addEventListener("error", function () {
+ reject(request.error);
+ });
+ });
+ });
+}
+
+// Function to retrieve data from the object store
+async function getStorageData(key) {
+ return openDB().then(db => {
+ let tx = db.transaction("EasyDiffusionSettings", "readonly");
+ let store = tx.objectStore("EasyDiffusionSettings");
+ return new Promise((resolve, reject) => {
+ let request = store.get(key);
+ request.addEventListener("success", function () {
+ if (request.result) {
+ resolve(request.result.value);
+ } else {
+ // entry not found
+ resolve();
+ }
+ });
+ request.addEventListener("error", function () {
+ reject(request.error);
+ });
+ });
+ });
+}
+
+// indexedDB debug functions
+async function getAllKeys() {
+ return openDB().then(db => {
+ let tx = db.transaction("EasyDiffusionSettings", "readonly");
+ let store = tx.objectStore("EasyDiffusionSettings");
+ let keys = [];
+ return new Promise((resolve, reject) => {
+ store.openCursor().onsuccess = function (event) {
+ let cursor = event.target.result;
+ if (cursor) {
+ keys.push(cursor.key);
+ cursor.continue();
+ } else {
+ resolve(keys);
+ }
+ };
+ });
+ });
+}
+
+async function logAllStorageKeys() {
+ try {
+ let keys = await getAllKeys();
+ console.log("All keys:", keys);
+ for (const k of keys) {
+ console.log(k, await getStorageData(k))
+ }
+ } catch (error) {
+ console.error("Error retrieving keys:", error);
+ }
+}
+
+// USE WITH CARE - THIS MAY DELETE ALL ENTRIES
+async function deleteKeys(keyToDelete) {
+ let confirmationMessage = keyToDelete
+ ? `This will delete the template with key "${keyToDelete}". Continue?`
+ : "This will delete ALL templates. Continue?";
+ if (confirm(confirmationMessage)) {
+ return openDB().then(db => {
+ let tx = db.transaction("EasyDiffusionSettings", "readwrite");
+ let store = tx.objectStore("EasyDiffusionSettings");
+ return new Promise((resolve, reject) => {
+ store.openCursor().onsuccess = function (event) {
+ let cursor = event.target.result;
+ if (cursor) {
+ if (!keyToDelete || cursor.key === keyToDelete) {
+ cursor.delete();
+ }
+ cursor.continue();
+ } else {
+ // refresh the dropdown and resolve
+ resolve();
+ }
+ };
+ });
+ });
+ }
+}
From a548c026b1fa01822ae9518d0de10a0d811003bf Mon Sep 17 00:00:00 2001
From: patriceac <48073125+patriceac@users.noreply.github.com>
Date: Thu, 25 May 2023 00:32:48 -0700
Subject: [PATCH 02/10] Revert "Fix face restoration model selection"
This reverts commit a5a1d3358918626e2860db1effcabea3787fee2b.
---
ui/easydiffusion/model_manager.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/ui/easydiffusion/model_manager.py b/ui/easydiffusion/model_manager.py
index a0b2489a..2bb4852d 100644
--- a/ui/easydiffusion/model_manager.py
+++ b/ui/easydiffusion/model_manager.py
@@ -107,18 +107,12 @@ def resolve_model_to_use(model_name: str = None, model_type: str = None):
def reload_models_if_necessary(context: Context, task_data: TaskData):
- if hasattr(task_data, 'use_face_correction') and task_data.use_face_correction:
- face_correction_model = "codeformer" if "codeformer" in task_data.use_face_correction.lower() else "gfpgan"
- face_correction_value = task_data.use_face_correction
- else:
- face_correction_model = "gfpgan"
- face_correction_value = None
-
+ face_correction_model = "codeformer" if "codeformer" in task_data.use_face_correction.lower() else "gfpgan"
model_paths_in_req = {
"stable-diffusion": task_data.use_stable_diffusion_model,
"vae": task_data.use_vae_model,
"hypernetwork": task_data.use_hypernetwork_model,
- face_correction_model: face_correction_value,
+ face_correction_model: task_data.use_face_correction,
"realesrgan": task_data.use_upscale,
"nsfw_checker": True if task_data.block_nsfw else None,
"lora": task_data.use_lora_model,
From 3a059bb919b63b77fbddf383d9124d492bdc7fec Mon Sep 17 00:00:00 2001
From: patriceac <48073125+patriceac@users.noreply.github.com>
Date: Thu, 25 May 2023 00:32:57 -0700
Subject: [PATCH 03/10] Revert "Support for CodeFormer"
This reverts commit a25364732b3f74dbfd5083cc4d7a0f84ccc5d9d5.
---
ui/easydiffusion/model_manager.py | 3 +--
ui/easydiffusion/renderer.py | 4 +---
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/ui/easydiffusion/model_manager.py b/ui/easydiffusion/model_manager.py
index 2bb4852d..7bf56575 100644
--- a/ui/easydiffusion/model_manager.py
+++ b/ui/easydiffusion/model_manager.py
@@ -107,12 +107,11 @@ def resolve_model_to_use(model_name: str = None, model_type: str = None):
def reload_models_if_necessary(context: Context, task_data: TaskData):
- face_correction_model = "codeformer" if "codeformer" in task_data.use_face_correction.lower() else "gfpgan"
model_paths_in_req = {
"stable-diffusion": task_data.use_stable_diffusion_model,
"vae": task_data.use_vae_model,
"hypernetwork": task_data.use_hypernetwork_model,
- face_correction_model: task_data.use_face_correction,
+ "gfpgan": task_data.use_face_correction,
"realesrgan": task_data.use_upscale,
"nsfw_checker": True if task_data.block_nsfw else None,
"lora": task_data.use_lora_model,
diff --git a/ui/easydiffusion/renderer.py b/ui/easydiffusion/renderer.py
index e1176c8b..f685d038 100644
--- a/ui/easydiffusion/renderer.py
+++ b/ui/easydiffusion/renderer.py
@@ -158,9 +158,7 @@ def filter_images(task_data: TaskData, images: list, user_stopped):
filters_to_apply = []
if task_data.block_nsfw:
filters_to_apply.append("nsfw_checker")
- if task_data.use_face_correction and "codeformer" in task_data.use_face_correction.lower():
- filters_to_apply.append("codeformer")
- elif task_data.use_face_correction and "gfpgan" in task_data.use_face_correction.lower():
+ if task_data.use_face_correction and "gfpgan" in task_data.use_face_correction.lower():
filters_to_apply.append("gfpgan")
if task_data.use_upscale and "realesrgan" in task_data.use_upscale.lower():
filters_to_apply.append("realesrgan")
From e213f6cb9559a16fa69a227363924cc19ce586a6 Mon Sep 17 00:00:00 2001
From: ManInDark <61268856+ManInDark@users.noreply.github.com>
Date: Mon, 12 Jun 2023 12:48:52 +0200
Subject: [PATCH 04/10] Added calculation as to how many images will be
generated with given prompts.
---
ui/media/js/main.js | 65 ++++++++++++++++++++++++++++++++++++++++++--
ui/media/js/utils.js | 4 +++
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/ui/media/js/main.js b/ui/media/js/main.js
index b44af102..cb516a37 100644
--- a/ui/media/js/main.js
+++ b/ui/media/js/main.js
@@ -1327,6 +1327,43 @@ function getPrompts(prompts) {
return promptsToMake
}
+function getPromptsNumber(prompts) {
+ if (typeof prompts === "undefined") {
+ prompts = promptField.value
+ }
+ if (prompts.trim() === "" && activeTags.length === 0) {
+ return [""]
+ }
+
+ let promptsToMake = []
+ let numberOfPrompts = 0
+ if (prompts.trim() !== "") { // this needs to stay sort of the same, as the prompts have to be passed through to the other functions
+ prompts = prompts.split("\n")
+ prompts = prompts.map((prompt) => prompt.trim())
+ prompts = prompts.filter((prompt) => prompt !== "")
+
+ promptsToMake = applySetOperator(prompts) // switched those around as Set grows in a linear fashion and permute in 2^n, and one has to be computed for the other to be calculated
+ numberOfPrompts = applyPermuteOperatorNumber(promptsToMake)
+ }
+ const newTags = activeTags.filter((tag) => tag.inactive === undefined || tag.inactive === false)
+ if (newTags.length > 0) {
+ const promptTags = newTags.map((x) => x.name).join(", ")
+ if (numberOfPrompts > 0) {
+ // promptsToMake = promptsToMake.map((prompt) => `${prompt}, ${promptTags}`)
+ // nothing changes, as all prompts just get modified
+ } else {
+ // promptsToMake.push(promptTags)
+ numberOfPrompts = 1
+ }
+ }
+
+ // Why is this applied twice? It does not do anything here, as everything should have already been done earlier
+ // promptsToMake = applyPermuteOperator(promptsToMake)
+ // promptsToMake = applySetOperator(promptsToMake)
+
+ return numberOfPrompts
+}
+
function applySetOperator(prompts) {
let promptsToMake = []
let braceExpander = new BraceExpander()
@@ -1338,7 +1375,7 @@ function applySetOperator(prompts) {
return promptsToMake
}
-function applyPermuteOperator(prompts) {
+function applyPermuteOperator(prompts) { // prompts is array of input, trimmed, filtered and split by \n
let promptsToMake = []
prompts.forEach((prompt) => {
let promptMatrix = prompt.split("|")
@@ -1357,6 +1394,26 @@ function applyPermuteOperator(prompts) {
return promptsToMake
}
+// returns how many prompts would have to be made with the given prompts
+function applyPermuteOperatorNumber(prompts) { // prompts is array of input, trimmed, filtered and split by \n
+ let numberOfPrompts = 0
+ prompts.forEach((prompt) => {
+ let promptCounter = 1
+ let promptMatrix = prompt.split("|")
+ promptMatrix.shift()
+
+ promptMatrix = promptMatrix.map((p) => p.trim())
+ promptMatrix = promptMatrix.filter((p) => p !== "")
+
+ if (promptMatrix.length > 0) {
+ promptCounter *= permutePromptsNumber(promptMatrix)
+ }
+ numberOfPrompts += promptCounter
+ })
+
+ return numberOfPrompts
+}
+
function permutePrompts(promptBase, promptMatrix) {
let prompts = []
let permutations = permute(promptMatrix)
@@ -1378,6 +1435,10 @@ function permutePrompts(promptBase, promptMatrix) {
return prompts
}
+function permutePromptsNumber(promptMatrix) { // this should calculate how many different prompts can be made with the prompt matrix
+ return permuteNumber(promptMatrix)
+}
+
// create a file name with embedded prompt and metadata
// for easier cateloging and comparison
function createFileName(prompt, seed, steps, guidance, outputFormat) {
@@ -1546,7 +1607,7 @@ heightField.addEventListener("change", onDimensionChange)
function renameMakeImageButton() {
let totalImages =
- Math.max(parseInt(numOutputsTotalField.value), parseInt(numOutputsParallelField.value)) * getPrompts().length
+ Math.max(parseInt(numOutputsTotalField.value), parseInt(numOutputsParallelField.value)) * getPromptsNumber()
let imageLabel = "Image"
if (totalImages > 1) {
imageLabel = totalImages + " Images"
diff --git a/ui/media/js/utils.js b/ui/media/js/utils.js
index 871ba714..111a12e1 100644
--- a/ui/media/js/utils.js
+++ b/ui/media/js/utils.js
@@ -153,6 +153,10 @@ function permute(arr) {
return permutations
}
+function permuteNumber(arr) {
+ return Math.pow(2, arr.length)
+}
+
// https://stackoverflow.com/a/8212878
function millisecondsToStr(milliseconds) {
function numberEnding(number) {
From 3e34cdc8845fa91fd16018bf70a94569d97db7bb Mon Sep 17 00:00:00 2001
From: ManInDark <61268856+ManInDark@users.noreply.github.com>
Date: Mon, 12 Jun 2023 13:25:12 +0200
Subject: [PATCH 05/10] Added sets to the readme
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 6a629e57..5366772f 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,7 @@ Just delete the `EasyDiffusion` folder to uninstall all the downloaded packages.
- **Attention/Emphasis**: () in the prompt increases the model's attention to enclosed words, and [] decreases it.
- **Weighted Prompts**: Use weights for specific words in your prompt to change their importance, e.g. `red:2.4 dragon:1.2`.
- **Prompt Matrix**: Quickly create multiple variations of your prompt, e.g. `a photograph of an astronaut riding a horse | illustration | cinematic lighting`.
+- **Prompt Set**: Quickly create multiple variations of your prompt, e.g. `a photograph of an astronaut on the {moon,earth}`
- **1-click Upscale/Face Correction**: Upscale or correct an image after it has been generated.
- **Make Similar Images**: Click to generate multiple variations of a generated image.
- **NSFW Setting**: A setting in the UI to control *NSFW content*.
From 6ae4314b798efe7d3e952e111fd9fc1b6d73c4f4 Mon Sep 17 00:00:00 2001
From: ManInDark <61268856+ManInDark@users.noreply.github.com>
Date: Tue, 13 Jun 2023 16:09:54 +0200
Subject: [PATCH 06/10] Incorporated proposal by @JeLuF in #1324
---
ui/media/js/main.js | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/ui/media/js/main.js b/ui/media/js/main.js
index cb516a37..a7cccc55 100644
--- a/ui/media/js/main.js
+++ b/ui/media/js/main.js
@@ -1342,6 +1342,16 @@ function getPromptsNumber(prompts) {
prompts = prompts.map((prompt) => prompt.trim())
prompts = prompts.filter((prompt) => prompt !== "")
+ // estimate number of prompts
+ let estimatedNumberOfPrompts = 0
+ prompts.forEach((prompt) => {
+ estimatedNumberOfPrompts += (prompt.match(/{[^}]*}/g) || []).map((e) => e.match(/,/g).length + 1).reduce( (p,a) => p*a, 1) * (2**(prompt.match(/\|/g) || []).length)
+ })
+
+ if (estimatedNumberOfPrompts >= 10000) {
+ return 10000
+ }
+
promptsToMake = applySetOperator(prompts) // switched those around as Set grows in a linear fashion and permute in 2^n, and one has to be computed for the other to be calculated
numberOfPrompts = applyPermuteOperatorNumber(promptsToMake)
}
@@ -1613,9 +1623,15 @@ function renameMakeImageButton() {
imageLabel = totalImages + " Images"
}
if (SD.activeTasks.size == 0) {
- makeImageBtn.innerText = "Make " + imageLabel
+ if (totalImages >= 10000)
+ makeImageBtn.innerText = "Make tens of thousands of images"
+ else
+ makeImageBtn.innerText = "Make " + imageLabel
} else {
- makeImageBtn.innerText = "Enqueue Next " + imageLabel
+ if (totalImages >= 10000)
+ makeImageBtn.innerText = "Enqueue tens of thousands of images"
+ else
+ makeImageBtn.innerText = "Enqueue Next " + imageLabel
}
}
numOutputsTotalField.addEventListener("change", renameMakeImageButton)
From ed59972b032b49e497e57985be92926659dc6441 Mon Sep 17 00:00:00 2001
From: ManInDark <61268856+ManInDark@users.noreply.github.com>
Date: Wed, 14 Jun 2023 11:57:06 +0200
Subject: [PATCH 07/10] Changed all links as mentioned in #1339
---
CHANGES.md | 12 ++++-----
CONTRIBUTING.md | 4 +--
How to install and run.txt | 6 ++---
PRIVACY.md | 2 +-
README BEFORE YOU RUN THIS.txt | 2 +-
README.md | 14 +++++------
build.bat | 2 +-
build.sh | 2 +-
scripts/bootstrap.bat | 2 +-
scripts/check_modules.py | 4 +--
scripts/functions.sh | 4 +--
scripts/on_env_start.bat | 4 +--
scripts/on_env_start.sh | 2 +-
scripts/on_sd_start.bat | 4 +--
ui/easydiffusion/app.py | 2 +-
ui/index.html | 36 +++++++++++++--------------
ui/plugins/ui/release-notes.plugin.js | 4 +--
17 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index b53ac141..d222d795 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,13 +8,13 @@
- **Full support for Stable Diffusion 2.1 (including CPU)** - supports loading v1.4 or v2.0 or v2.1 models seamlessly. No need to enable "Test SD2", and no need to add `sd2_` to your SD 2.0 model file names. Works on CPU as well.
- **Memory optimized Stable Diffusion 2.1** - you can now use Stable Diffusion 2.1 models, with the same low VRAM optimizations that we've always had for SD 1.4. Please note, the SD 2.0 and 2.1 models require more GPU and System RAM, as compared to the SD 1.4 and 1.5 models.
- **11 new samplers!** - explore the new samplers, some of which can generate great images in less than 10 inference steps! We've added the Karras and UniPC samplers. Thanks @Schorny for the UniPC samplers.
-- **Model Merging** - You can now merge two models (`.ckpt` or `.safetensors`) and output `.ckpt` or `.safetensors` models, optionally in `fp16` precision. Details: https://github.com/cmdr2/stable-diffusion-ui/wiki/Model-Merging . Thanks @JeLuf.
+- **Model Merging** - You can now merge two models (`.ckpt` or `.safetensors`) and output `.ckpt` or `.safetensors` models, optionally in `fp16` precision. Details: https://github.com/easydiffusion/easydiffusion/wiki/Model-Merging . Thanks @JeLuf.
- **Fast loading/unloading of VAEs** - No longer needs to reload the entire Stable Diffusion model, each time you change the VAE
- **Database of known models** - automatically picks the right configuration for known models. E.g. we automatically detect and apply "v" parameterization (required for some SD 2.0 models), and "fp32" attention precision (required for some SD 2.1 models).
- **Color correction for img2img** - an option to preserve the color profile (histogram) of the initial image. This is especially useful if you're getting red-tinted images after inpainting/masking.
- **Three GPU Memory Usage Settings** - `High` (fastest, maximum VRAM usage), `Balanced` (default - almost as fast, significantly lower VRAM usage), `Low` (slowest, very low VRAM usage). The `Low` setting is applied automatically for GPUs with less than 4 GB of VRAM.
- **Find models in sub-folders** - This allows you to organize your models into sub-folders inside `models/stable-diffusion`, instead of keeping them all in a single folder. Thanks @patriceac and @ogmaresca.
-- **Custom Modifier Categories** - Ability to create custom modifiers with thumbnails, and custom categories (and hierarchy of categories). Details: https://github.com/cmdr2/stable-diffusion-ui/wiki/Custom-Modifiers . Thanks @ogmaresca.
+- **Custom Modifier Categories** - Ability to create custom modifiers with thumbnails, and custom categories (and hierarchy of categories). Details: https://github.com/easydiffusion/easydiffusion/wiki/Custom-Modifiers . Thanks @ogmaresca.
- **Embed metadata, or save as TXT/JSON** - You can now embed the metadata directly into the images, or save them as text or json files (choose in the Settings tab). Thanks @patriceac.
- **Major rewrite of the code** - Most of the codebase has been reorganized and rewritten, to make it more manageable and easier for new developers to contribute features. We've separated our core engine into a new project called `sdkit`, which allows anyone to easily integrate Stable Diffusion (and related modules like GFPGAN etc) into their programming projects (via a simple `pip install sdkit`): https://github.com/easydiffusion/sdkit/
- **Name change** - Last, and probably the least, the UI is now called "Easy Diffusion". It indicates the focus of this project - an easy way for people to play with Stable Diffusion.
@@ -67,7 +67,7 @@ Our focus continues to remain on an easy installation experience, and an easy us
* 2.5.24 - 11 Mar 2023 - Button to load an image mask from a file.
* 2.5.24 - 10 Mar 2023 - Logo change. Image credit: @lazlo_vii.
* 2.5.23 - 8 Mar 2023 - Experimental support for Mac M1/M2. Thanks @michaelgallacher, @JeLuf and vishae!
-* 2.5.23 - 8 Mar 2023 - Ability to create custom modifiers with thumbnails, and custom categories (and hierarchy of categories). More details - https://github.com/cmdr2/stable-diffusion-ui/wiki/Custom-Modifiers . Thanks @ogmaresca.
+* 2.5.23 - 8 Mar 2023 - Ability to create custom modifiers with thumbnails, and custom categories (and hierarchy of categories). More details - https://github.com/easydiffusion/easydiffusion/wiki/Custom-Modifiers . Thanks @ogmaresca.
* 2.5.22 - 28 Feb 2023 - Minor styling changes to UI buttons, and the models dropdown.
* 2.5.22 - 28 Feb 2023 - Lots of UI-related bug fixes. Thanks @patriceac.
* 2.5.21 - 22 Feb 2023 - An option to control the size of the image thumbnails. You can use the `Display options` in the top-right corner to change this. Thanks @JeLuf.
@@ -92,7 +92,7 @@ Our focus continues to remain on an easy installation experience, and an easy us
* 2.5.14 - 3 Feb 2023 - Fix the 'Make Similar Images' button, which was producing incorrect images (weren't very similar).
* 2.5.13 - 1 Feb 2023 - Fix the remaining GPU memory leaks, including a better fix (more comprehensive) for the change in 2.5.12 (27 Jan).
* 2.5.12 - 27 Jan 2023 - Fix a memory leak, which made the UI unresponsive after an out-of-memory error. The allocated memory is now freed-up after an error.
-* 2.5.11 - 25 Jan 2023 - UI for Merging Models. Thanks @JeLuf. More info: https://github.com/cmdr2/stable-diffusion-ui/wiki/Model-Merging
+* 2.5.11 - 25 Jan 2023 - UI for Merging Models. Thanks @JeLuf. More info: https://github.com/easydiffusion/easydiffusion/wiki/Model-Merging
* 2.5.10 - 24 Jan 2023 - Reduce the VRAM usage for img2img in 'balanced' mode (without reducing the rendering speed), to make it similar to v2.4 of this UI.
* 2.5.9 - 23 Jan 2023 - Fix a bug where img2img would produce poorer-quality images for the same settings, as compared to version 2.4 of this UI.
* 2.5.9 - 23 Jan 2023 - Reduce the VRAM usage for 'balanced' mode (without reducing the rendering speed), to make it similar to v2.4 of the UI.
@@ -121,8 +121,8 @@ Our focus continues to remain on an easy installation experience, and an easy us
- **Automatic scanning for malicious model files** - using `picklescan`, and support for `safetensor` model format. Thanks @JeLuf
- **Image Editor** - for drawing simple images for guiding the AI. Thanks @mdiller
- **Use pre-trained hypernetworks** - for improving the quality of images. Thanks @C0bra5
-- **Support for custom VAE models**. You can place your VAE files in the `models/vae` folder, and refresh the browser page to use them. More info: https://github.com/cmdr2/stable-diffusion-ui/wiki/VAE-Variational-Auto-Encoder
-- **Experimental support for multiple GPUs!** It should work automatically. Just open one browser tab per GPU, and spread your tasks across your GPUs. For e.g. open our UI in two browser tabs if you have two GPUs. You can customize which GPUs it should use in the "Settings" tab, otherwise let it automatically pick the best GPUs. Thanks @madrang . More info: https://github.com/cmdr2/stable-diffusion-ui/wiki/Run-on-Multiple-GPUs
+- **Support for custom VAE models**. You can place your VAE files in the `models/vae` folder, and refresh the browser page to use them. More info: https://github.com/easydiffusion/easydiffusion/wiki/VAE-Variational-Auto-Encoder
+- **Experimental support for multiple GPUs!** It should work automatically. Just open one browser tab per GPU, and spread your tasks across your GPUs. For e.g. open our UI in two browser tabs if you have two GPUs. You can customize which GPUs it should use in the "Settings" tab, otherwise let it automatically pick the best GPUs. Thanks @madrang . More info: https://github.com/easydiffusion/easydiffusion/wiki/Run-on-Multiple-GPUs
- **Cleaner UI design** - Show settings and help in new tabs, instead of dropdown popups (which were buggy). Thanks @mdiller
- **Progress bar.** Thanks @mdiller
- **Custom Image Modifiers** - You can now save your custom image modifiers! Your saved modifiers can include special characters like `{}, (), [], |`
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c01d489a..bb6408c8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
Hi there, these instructions are meant for the developers of this project.
-If you only want to use the Stable Diffusion UI, you've downloaded the wrong file. In that case, please download and follow the instructions at https://github.com/cmdr2/stable-diffusion-ui#installation
+If you only want to use the Stable Diffusion UI, you've downloaded the wrong file. In that case, please download and follow the instructions at https://github.com/easydiffusion/easydiffusion#installation
Thanks
@@ -13,7 +13,7 @@ If you would like to contribute to this project, there is a discord for discussi
This is in-flux, but one way to get a development environment running for editing the UI of this project is:
(swap `.sh` or `.bat` in instructions depending on your environment, and be sure to adjust any paths to match where you're working)
-1) Install the project to a new location using the [usual installation process](https://github.com/cmdr2/stable-diffusion-ui#installation), e.g. to `/projects/stable-diffusion-ui-archive`
+1) Install the project to a new location using the [usual installation process](https://github.com/easydiffusion/easydiffusion#installation), e.g. to `/projects/stable-diffusion-ui-archive`
2) Start the newly installed project, and check that you can view and generate images on `localhost:9000`
3) Next, please clone the project repository using `git clone` (e.g. to `/projects/stable-diffusion-ui-repo`)
4) Close the server (started in step 2), and edit `/projects/stable-diffusion-ui-archive/scripts/on_env_start.sh` (or `on_env_start.bat`)
diff --git a/How to install and run.txt b/How to install and run.txt
index e48d217c..af783b64 100644
--- a/How to install and run.txt
+++ b/How to install and run.txt
@@ -1,6 +1,6 @@
Congrats on downloading Stable Diffusion UI, version 2!
-If you haven't downloaded Stable Diffusion UI yet, please download from https://github.com/cmdr2/stable-diffusion-ui#installation
+If you haven't downloaded Stable Diffusion UI yet, please download from https://github.com/easydiffusion/easydiffusion#installation
After downloading, to install please follow these instructions:
@@ -16,9 +16,9 @@ To start the UI in the future, please run the same command mentioned above.
If you have any problems, please:
-1. Try the troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting
+1. Try the troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting
2. Or, seek help from the community at https://discord.com/invite/u9yhsFmEkB
-3. Or, file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues
+3. Or, file an issue at https://github.com/easydiffusion/easydiffusion/issues
Thanks
cmdr2 (and contributors to the project)
\ No newline at end of file
diff --git a/PRIVACY.md b/PRIVACY.md
index 6c997997..543a167d 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -3,7 +3,7 @@
This is a summary of whether Easy Diffusion uses your data or tracks you:
* The short answer is - Easy Diffusion does *not* use your data, and does *not* track you.
* Easy Diffusion does not send your prompts or usage or analytics to anyone. There is no tracking. We don't even know how many people use Easy Diffusion, let alone their prompts.
-* Easy Diffusion fetches updates to the code whenever it starts up. It does this by contacting GitHub directly, via SSL (secure connection). Only your computer and GitHub and [this repository](https://github.com/cmdr2/stable-diffusion-ui) are involved, and no third party is involved. Some countries intercepts SSL connections, that's not something we can do much about. GitHub does *not* share statistics (even with me) about how many people fetched code updates.
+* Easy Diffusion fetches updates to the code whenever it starts up. It does this by contacting GitHub directly, via SSL (secure connection). Only your computer and GitHub and [this repository](https://github.com/easydiffusion/easydiffusion) are involved, and no third party is involved. Some countries intercepts SSL connections, that's not something we can do much about. GitHub does *not* share statistics (even with me) about how many people fetched code updates.
* Easy Diffusion fetches the models from huggingface.co and github.com, if they don't exist on your PC. For e.g. if the safety checker (NSFW) model doesn't exist, it'll try to download it.
* Easy Diffusion fetches code packages from pypi.org, which is the standard hosting service for all Python projects. That's where packages installed via `pip install` are stored.
* Occasionally, antivirus software are known to *incorrectly* flag and delete some model files, which will result in Easy Diffusion re-downloading `pytorch_model.bin`. This *incorrect deletion* affects other Stable Diffusion UIs as well, like Invoke AI - https://itch.io/post/7509488
diff --git a/README BEFORE YOU RUN THIS.txt b/README BEFORE YOU RUN THIS.txt
index e9f81544..a989b835 100644
--- a/README BEFORE YOU RUN THIS.txt
+++ b/README BEFORE YOU RUN THIS.txt
@@ -3,6 +3,6 @@ Hi there,
What you have downloaded is meant for the developers of this project, not for users.
If you only want to use the Stable Diffusion UI, you've downloaded the wrong file.
-Please download and follow the instructions at https://github.com/cmdr2/stable-diffusion-ui#installation
+Please download and follow the instructions at https://github.com/easydiffusion/easydiffusion#installation
Thanks
\ No newline at end of file
diff --git a/README.md b/README.md
index 5366772f..b97c35d1 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
Does not require technical knowledge, does not require pre-installed software. 1-click install, powerful features, friendly community.
-[Installation guide](#installation) | [Troubleshooting guide](https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting) | [](https://discord.com/invite/u9yhsFmEkB)(for support queries, and development discussions)
+[Installation guide](#installation) | [Troubleshooting guide](https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting) | [](https://discord.com/invite/u9yhsFmEkB)(for support queries, and development discussions)

@@ -11,9 +11,9 @@ Does not require technical knowledge, does not require pre-installed software. 1
Click the download button for your operating system:
-
-
-
+
+
+
**Hardware requirements:**
@@ -83,7 +83,7 @@ Just delete the `EasyDiffusion` folder to uninstall all the downloaded packages.
- **Use custom VAE models**
- **Use pre-trained Hypernetworks**
- **Use custom GFPGAN models**
-- **UI Plugins**: Choose from a growing list of [community-generated UI plugins](https://github.com/cmdr2/stable-diffusion-ui/wiki/UI-Plugins), or write your own plugin to add features to the project!
+- **UI Plugins**: Choose from a growing list of [community-generated UI plugins](https://github.com/easydiffusion/easydiffusion/wiki/UI-Plugins), or write your own plugin to add features to the project!
### Performance and security
- **Fast**: Creates a 512x512 image with euler_a in 5 seconds, on an NVIDIA 3060 12GB.
@@ -119,10 +119,10 @@ Useful for judging (and stopping) an image quickly, without waiting for it to fi
----
# How to use?
-Please refer to our [guide](https://github.com/cmdr2/stable-diffusion-ui/wiki/How-to-Use) to understand how to use the features in this UI.
+Please refer to our [guide](https://github.com/easydiffusion/easydiffusion/wiki/How-to-Use) to understand how to use the features in this UI.
# Bugs reports and code contributions welcome
-If there are any problems or suggestions, please feel free to ask on the [discord server](https://discord.com/invite/u9yhsFmEkB) or [file an issue](https://github.com/cmdr2/stable-diffusion-ui/issues).
+If there are any problems or suggestions, please feel free to ask on the [discord server](https://discord.com/invite/u9yhsFmEkB) or [file an issue](https://github.com/easydiffusion/easydiffusion/issues).
We could really use help on these aspects (click to view tasks that need your help):
* [User Interface](https://github.com/users/cmdr2/projects/1/views/1)
diff --git a/build.bat b/build.bat
index 6e3f3f81..dc9e622f 100644
--- a/build.bat
+++ b/build.bat
@@ -2,7 +2,7 @@
@echo "Hi there, what you are running is meant for the developers of this project, not for users." & echo.
@echo "If you only want to use the Stable Diffusion UI, you've downloaded the wrong file."
-@echo "Please download and follow the instructions at https://github.com/cmdr2/stable-diffusion-ui#installation" & echo.
+@echo "Please download and follow the instructions at https://github.com/easydiffusion/easydiffusion#installation" & echo.
@echo "If you are actually a developer of this project, please type Y and press enter" & echo.
set /p answer=Are you a developer of this project (Y/N)?
diff --git a/build.sh b/build.sh
index f4538e5c..bddf3c49 100755
--- a/build.sh
+++ b/build.sh
@@ -2,7 +2,7 @@
printf "Hi there, what you are running is meant for the developers of this project, not for users.\n\n"
printf "If you only want to use the Stable Diffusion UI, you've downloaded the wrong file.\n"
-printf "Please download and follow the instructions at https://github.com/cmdr2/stable-diffusion-ui#installation\n\n"
+printf "Please download and follow the instructions at https://github.com/easydiffusion/easydiffusion#installation \n\n"
printf "If you are actually a developer of this project, please type Y and press enter\n\n"
read -p "Are you a developer of this project (Y/N) " yn
diff --git a/scripts/bootstrap.bat b/scripts/bootstrap.bat
index d3cdd19f..8c1069c8 100644
--- a/scripts/bootstrap.bat
+++ b/scripts/bootstrap.bat
@@ -11,7 +11,7 @@ setlocal enabledelayedexpansion
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
set INSTALL_ENV_DIR=%cd%\installer_files\env
set LEGACY_INSTALL_ENV_DIR=%cd%\installer
-set MICROMAMBA_DOWNLOAD_URL=https://github.com/cmdr2/stable-diffusion-ui/releases/download/v1.1/micromamba.exe
+set MICROMAMBA_DOWNLOAD_URL=https://github.com/easydiffusion/easydiffusion/releases/download/v1.1/micromamba.exe
set umamba_exists=F
set OLD_APPDATA=%APPDATA%
diff --git a/scripts/check_modules.py b/scripts/check_modules.py
index 6275de45..5f1a9bb8 100644
--- a/scripts/check_modules.py
+++ b/scripts/check_modules.py
@@ -148,9 +148,9 @@ def fail(module_name):
print(
f"""Error installing {module_name}. Sorry about that, please try to:
1. Run this installer again.
-2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting
+2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting
3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB
-4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues
+4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues
Thanks!"""
)
exit(1)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index 495e9950..477b7743 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -15,9 +15,9 @@ fail() {
Error downloading Stable Diffusion UI. Sorry about that, please try to:
1. Run this installer again.
- 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting
+ 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting
3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB
- 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues
+ 4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues
Thanks!
diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat
index bc92d0e9..0871973f 100644
--- a/scripts/on_env_start.bat
+++ b/scripts/on_env_start.bat
@@ -55,10 +55,10 @@ if "%update_branch%"=="" (
@echo. & echo "Downloading Easy Diffusion..." & echo.
@echo "Using the %update_branch% channel" & echo.
- @call git clone -b "%update_branch%" https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files && (
+ @call git clone -b "%update_branch%" https://github.com/easydiffusion/easydiffusion.git sd-ui-files && (
@echo sd_ui_git_cloned >> scripts\install_status.txt
) || (
- @echo "Error downloading Easy Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!"
+ @echo "Error downloading Easy Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues" & echo "Thanks!"
pause
@exit /b
)
diff --git a/scripts/on_env_start.sh b/scripts/on_env_start.sh
index 366b5dd1..d936924e 100755
--- a/scripts/on_env_start.sh
+++ b/scripts/on_env_start.sh
@@ -38,7 +38,7 @@ else
printf "\n\nDownloading Easy Diffusion..\n\n"
printf "Using the $update_branch channel\n\n"
- if git clone -b "$update_branch" https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files ; then
+ if git clone -b "$update_branch" https://github.com/easydiffusion/easydiffusion.git sd-ui-files ; then
echo sd_ui_git_cloned >> scripts/install_status.txt
else
fail "git clone failed"
diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat
index f92b9f6f..860361d4 100644
--- a/scripts/on_sd_start.bat
+++ b/scripts/on_sd_start.bat
@@ -26,7 +26,7 @@ if exist "%cd%\stable-diffusion\env" (
@rem activate the installer env
call conda activate
@if "%ERRORLEVEL%" NEQ "0" (
- @echo. & echo "Error activating conda for Easy Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo.
+ @echo. & echo "Error activating conda for Easy Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues" & echo "Thanks!" & echo.
pause
exit /b
)
@@ -68,7 +68,7 @@ if "%ERRORLEVEL%" NEQ "0" (
call WHERE uvicorn > .tmp
@>nul findstr /m "uvicorn" .tmp
@if "%ERRORLEVEL%" NEQ "0" (
- @echo. & echo "UI packages not found! Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo.
+ @echo. & echo "UI packages not found! Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/easydiffusion/easydiffusion/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues" & echo "Thanks!" & echo.
pause
exit /b
)
diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py
index 38e3392c..99810e75 100644
--- a/ui/easydiffusion/app.py
+++ b/ui/easydiffusion/app.py
@@ -237,7 +237,7 @@ def fail_and_die(fail_type: str, data: str):
suggestions = [
"Run this installer again.",
"If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB",
- "If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues",
+ "If that doesn't solve the problem, please file an issue at https://github.com/easydiffusion/easydiffusion/issues",
]
if fail_type == "model_download":
diff --git a/ui/index.html b/ui/index.html
index 0c4386de..2afdfd84 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -60,7 +60,7 @@