2022-10-31 22:36:45 +08:00
|
|
|
|
2023-03-28 00:44:49 +08:00
|
|
|
function extensions_apply(_, _, disable_all){
|
2023-01-28 20:57:56 +08:00
|
|
|
var disable = []
|
|
|
|
var update = []
|
|
|
|
|
2022-10-31 22:36:45 +08:00
|
|
|
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
|
|
|
|
if(x.name.startsWith("enable_") && ! x.checked)
|
|
|
|
disable.push(x.name.substr(7))
|
|
|
|
|
|
|
|
if(x.name.startsWith("update_") && x.checked)
|
|
|
|
update.push(x.name.substr(7))
|
|
|
|
})
|
|
|
|
|
|
|
|
restart_reload()
|
|
|
|
|
2023-03-28 00:44:49 +08:00
|
|
|
return [JSON.stringify(disable), JSON.stringify(update), disable_all]
|
2022-10-31 22:36:45 +08:00
|
|
|
}
|
|
|
|
|
2023-03-28 00:44:49 +08:00
|
|
|
function extensions_check(_, _){
|
2023-01-28 20:57:56 +08:00
|
|
|
var disable = []
|
|
|
|
|
|
|
|
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
|
|
|
|
if(x.name.startsWith("enable_") && ! x.checked)
|
|
|
|
disable.push(x.name.substr(7))
|
|
|
|
})
|
|
|
|
|
2022-10-31 22:36:45 +08:00
|
|
|
gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
|
|
|
|
x.innerHTML = "Loading..."
|
|
|
|
})
|
|
|
|
|
2023-01-28 20:57:56 +08:00
|
|
|
|
|
|
|
var id = randomId()
|
|
|
|
requestProgress(id, gradioApp().getElementById('extensions_installed_top'), null, function(){
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return [id, JSON.stringify(disable)]
|
2022-11-01 14:59:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_extension_from_index(button, url){
|
|
|
|
button.disabled = "disabled"
|
|
|
|
button.value = "Installing..."
|
|
|
|
|
|
|
|
textarea = gradioApp().querySelector('#extension_to_install textarea')
|
|
|
|
textarea.value = url
|
2023-01-17 19:15:47 +08:00
|
|
|
updateInput(textarea)
|
2022-11-01 14:59:00 +08:00
|
|
|
|
|
|
|
gradioApp().querySelector('#install_extension_button').click()
|
|
|
|
}
|