forked from cocktailpeanut/sd-webui.pinokio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_legacy.js
97 lines (96 loc) · 2.62 KB
/
install_legacy.js
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const path = require("path")
const os = require('os')
module.exports = async (kernel) => {
const platform = os.platform()
const graphics = await kernel.system.graphics()
//const vendor = graphics.controllers[0].vendor
const vendors = graphics.controllers.map((c) => { return c.vendor.toLowerCase() })
let setup
if (platform === "darwin") {
setup = [{
method: "shell.run",
params: { message: "brew install cmake protobuf rust [email protected] git wget", },
//params: { message: "brew install protobuf rust wget", },
}, {
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: path.resolve(__dirname) },
}]
} else {
//if (/amd/i.test(vendor)) {
let test = vendors.filter((vendor) => {
return /advanced micro devices/i.test(vendor)
}).length > 0
if (test) {
if (platform === 'win32') {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/lshqqytiger/stable-diffusion-webui-directml.git automatic1111", path: __dirname }
}]
} else {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: __dirname },
}]
}
} else {
setup = [{
method: "shell.run",
params: { message: "git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui automatic1111", path: __dirname },
}]
}
}
let run = setup.concat([{
"uri": "./index.js",
"method": "config",
"params": {
"legacy": true
}
}, {
"method": "shell.start",
"params": {
"path": "automatic1111",
"env": {
"SD_WEBUI_RESTARTING": 1,
"HF_HOME": "../huggingface"
},
}
}, {
"method": "shell.enter",
"params": {
"message": "{{os.platform() === 'win32' ? 'webui-user.bat' : 'bash webui.sh -f'}}",
"on": [{
"event": "/(http:\/\/[0-9.:]+)/",
"return": "{{event.matches[0][1]}}"
}]
}
}, {
"method": "local.set",
"params": {
"url": "{{input}}"
}
}, {
"method": "input",
"params": {
"title": "Install Success",
"description": "Go back to the dashboard and launch the app!"
}
}, {
"method": "browser.open",
"params": {
"uri": "/?selected=Stable Diffusion web UI"
}
}])
let o = { run }
if (platform === 'darwin') {
o.requires = [{
name: "zip",
uri: "zip",
type: "bin"
}, {
name: "brew",
uri: "brew",
type: "bin"
}]
}
return o
}