File size: 1,331 Bytes
ae26e7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

function extensions_apply(_, _){
    var disable = []
    var update = []

    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()

    return [JSON.stringify(disable), JSON.stringify(update)]
}

function extensions_check(){
    var disable = []

    gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
        if(x.name.startsWith("enable_") && ! x.checked)
            disable.push(x.name.substr(7))
    })

    gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
        x.innerHTML = "Loading..."
    })


    var id = randomId()
    requestProgress(id, gradioApp().getElementById('extensions_installed_top'), null, function(){

    })

    return [id, JSON.stringify(disable)]
}

function install_extension_from_index(button, url){
    button.disabled = "disabled"
    button.value = "Installing..."

    textarea = gradioApp().querySelector('#extension_to_install textarea')
    textarea.value = url
    updateInput(textarea)

    gradioApp().querySelector('#install_extension_button').click()
}