mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-03-01 00:31:27 +01:00
Merge pull request #534 from patriceac/Custom-modifiers-as-a-plugin
Custom modifiers as a plugin
This commit is contained in:
commit
1cd783d3a3
@ -359,8 +359,8 @@ async function init() {
|
|||||||
await getModels()
|
await getModels()
|
||||||
await getDiskPath()
|
await getDiskPath()
|
||||||
await getAppConfig()
|
await getAppConfig()
|
||||||
await loadModifiers()
|
|
||||||
await loadUIPlugins()
|
await loadUIPlugins()
|
||||||
|
await loadModifiers()
|
||||||
await getSystemInfo()
|
await getSystemInfo()
|
||||||
|
|
||||||
setInterval(healthCheck, HEALTH_PING_INTERVAL * 1000)
|
setInterval(healthCheck, HEALTH_PING_INTERVAL * 1000)
|
||||||
|
@ -325,31 +325,7 @@ function saveCustomModifiers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadCustomModifiers() {
|
function loadCustomModifiers() {
|
||||||
let customModifiers = localStorage.getItem(CUSTOM_MODIFIERS_KEY, '')
|
PLUGINS['MODIFIERS_LOAD'].forEach(fn=>fn.loader.call())
|
||||||
customModifiersTextBox.value = customModifiers
|
|
||||||
|
|
||||||
if (customModifiersGroupElement !== undefined) {
|
|
||||||
customModifiersGroupElement.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customModifiers && customModifiers.trim() !== '') {
|
|
||||||
customModifiers = customModifiers.split('\n')
|
|
||||||
customModifiers = customModifiers.filter(m => m.trim() !== '')
|
|
||||||
customModifiers = customModifiers.map(function(m) {
|
|
||||||
return {
|
|
||||||
"modifier": m
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let customGroup = {
|
|
||||||
'category': 'Custom Modifiers',
|
|
||||||
'modifiers': customModifiers
|
|
||||||
}
|
|
||||||
|
|
||||||
customModifiersGroupElement = createModifierGroup(customGroup, true)
|
|
||||||
|
|
||||||
createCollapsibles(customModifiersGroupElement)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
customModifiersTextBox.addEventListener('change', saveCustomModifiers)
|
customModifiersTextBox.addEventListener('change', saveCustomModifiers)
|
||||||
|
@ -24,7 +24,8 @@ const PLUGINS = {
|
|||||||
* }
|
* }
|
||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
IMAGE_INFO_BUTTONS: []
|
IMAGE_INFO_BUTTONS: [],
|
||||||
|
MODIFIERS_LOAD: []
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadUIPlugins() {
|
async function loadUIPlugins() {
|
||||||
|
31
ui/plugins/ui/custom-modifiers.plugin.js
Normal file
31
ui/plugins/ui/custom-modifiers.plugin.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
(function() {
|
||||||
|
PLUGINS['MODIFIERS_LOAD'].push({
|
||||||
|
loader: function() {
|
||||||
|
let customModifiers = localStorage.getItem(CUSTOM_MODIFIERS_KEY, '')
|
||||||
|
customModifiersTextBox.value = customModifiers
|
||||||
|
|
||||||
|
if (customModifiersGroupElement !== undefined) {
|
||||||
|
customModifiersGroupElement.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (customModifiers && customModifiers.trim() !== '') {
|
||||||
|
customModifiers = customModifiers.split('\n')
|
||||||
|
customModifiers = customModifiers.filter(m => m.trim() !== '')
|
||||||
|
customModifiers = customModifiers.map(function(m) {
|
||||||
|
return {
|
||||||
|
"modifier": m
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let customGroup = {
|
||||||
|
'category': 'Custom Modifiers',
|
||||||
|
'modifiers': customModifiers
|
||||||
|
}
|
||||||
|
|
||||||
|
customModifiersGroupElement = createModifierGroup(customGroup, true)
|
||||||
|
|
||||||
|
createCollapsibles(customModifiersGroupElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})()
|
Loading…
Reference in New Issue
Block a user